class Faraday::Env
Experimental RBS support (using type sampling data from the type_fusion
project).
# sig/faraday/options/env.rbs class Faraday::Env def self.member_set: () -> untyped def []: (Symbol key) -> untyped def body: () -> untyped def in_member_set?: (Symbol key) -> untyped def in_member_set?: (Symbol key) -> untyped end
@return [String]
@!attribute reason_phrase
@return [Integer] HTTP response status code
@!attribute status
@return [Hash] HTTP headers from the server
@!attribute response_headers
@return [Response]
@!attribute response
@return [Hash]
@!attribute params
@return [Object] sent if the connection is in parallel mode
@!attribute parallel_manager
@return [Hash] options for configuring SSL requests
@!attribute ssl
@return [Hash] HTTP Headers to be sent to the server.
@!attribute request_headers
- ‘:password` - Proxy server password
- `:user` - Proxy server username
- `:uri` - Proxy server URI
- `:proxy` - Hash of proxy options
- `:on_data` - Proc for streaming
server (Integer in seconds)
- `:write_timeout` - time limit for the client to send the request to the
the server (Integer in seconds)
- `:read_timeout` - time limit for the first response byte received from
handshake) (Integer in seconds)
- `:open_timeout` - time limit for just the connection phase (e.g.
seconds)
- `:timeout` - time limit for the entire request (Integer in
Options for configuring the request.
@return [Hash] options for configuring the request.
@!attribute request
@return [URI] URI instance for the current request.
@!attribute url
string.
@return [String] The request body that will eventually be converted to a
@!attribute body
@return [Symbol] HTTP method (`:get`, `:post`)
@!attribute method
def self.from(value)
-
(Env)
- from given value
Parameters:
-
value
(Object
) -- a value fitting Option.from(v).
def self.from(value) env = super(value) if value.respond_to?(:custom_members) env.custom_members.update(value.custom_members) end env end
def self.member_set
Experimental RBS support (using type sampling data from the type_fusion
project).
def self.member_set: () -> untyped
This signature was generated using 2 samples from 1 application.
- Private: -
def self.member_set @member_set ||= Set.new(members) end
def [](key)
Experimental RBS support (using type sampling data from the type_fusion
project).
def []: (Symbol key) -> untyped
This signature was generated using 1 sample from 1 application.
-
key
(Object
) --
def [](key) return self[current_body] if key == :body if in_member_set?(key) super(key) else custom_members[key] end end
def []=(key, value)
-
value
(Object
) -- -
key
(Object
) --
def []=(key, value) if key == :body super(current_body, value) return end if in_member_set?(key) super(key, value) else custom_members[key] = value end end
def body
Experimental RBS support (using type sampling data from the type_fusion
project).
def body: () -> untyped
This signature was generated using 1 sample from 1 application.
def body self[:body] end
def body=(value)
def body=(value) self[:body] = value end
def clear_body
def clear_body request_headers[ContentLength] = '0' self.body = +'' end
def current_body
def current_body !!status ? :response_body : :request_body end
def custom_members
- Private: -
def custom_members @custom_members ||= {} end
def in_member_set?(key)
Experimental RBS support (using type sampling data from the type_fusion
project).
def in_member_set?: (Symbol key) -> untyped
This signature was generated using 1 sample from 1 application.
def in_member_set?(key) self.class.member_set.include?(key.to_sym) end
def in_member_set?(key)
Experimental RBS support (using type sampling data from the type_fusion
project).
def in_member_set?: (Symbol key) -> untyped
This signature was generated using 1 sample from 1 application.
def in_member_set?(key) self.class.member_set.include?(key.to_s) end
def inspect
def inspect attrs = [nil] members.each do |mem| if (value = send(mem)) attrs << "@#{mem}=#{value.inspect}" end end attrs << "@custom=#{custom_members.inspect}" unless custom_members.empty? %(#<#{self.class}#{attrs.join(' ')}>) end
def needs_body?
-
(Boolean)
- true if there's no body yet, and the method is in the
def needs_body? !body && MethodsWithBodies.include?(method) end
def parallel?
-
(Boolean)
- true if there is a parallel_manager
def parallel? !!parallel_manager end
def parse_body?
-
(Boolean)
- true if the status isn't in the set of
def parse_body? !StatusesWithoutBody.include?(status) end
def stream_response(&block)
def stream_response(&block) size = 0 yielded = false block_result = block.call do |chunk| # rubocop:disable Performance/RedundantBlockCall if chunk.bytesize.positive? || size.positive? yielded = true size += chunk.bytesize request.on_data.call(chunk, size, self) end end request.on_data.call(+'', 0, self) unless yielded block_result end
def stream_response?
def stream_response? request.stream_response? end
def success?
-
(Boolean)
- true if status is in the set of {SuccessfulStatuses}.
def success? SuccessfulStatuses.include?(status) end