Request — AWS SDK for Ruby V3 (original) (raw)

Class: Seahorse::Client::Http::Request

Inherits:

Object

Defined in:

gems/aws-sdk-core/lib/seahorse/client/http/request.rb

Instance Attribute Summary collapse

Instance Method Summarycollapse

Constructor Details

#initialize(options = {}) ⇒ Request

Returns a new instance of Request.

| 15 16 17 18 19 20 | # File 'gems/aws-sdk-core/lib/seahorse/client/http/request.rb', line 15 def initialize(options = {}) self.endpoint = options[:endpoint] self.http_method = options[:http_method] || 'GET' self. = Headers.new(options[:headers] | | {}) self.body = options[:body] end | | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------- |

Instance Attribute Details

Returns The hash of request headers.

26 27 28 # File 'gems/aws-sdk-core/lib/seahorse/client/http/request.rb', line 26 def @headers end

#http_method ⇒ String

Returns The HTTP request method, e.g. GET, PUT, etc.

23 24 25 # File 'gems/aws-sdk-core/lib/seahorse/client/http/request.rb', line 23 def http_method @http_method end

Instance Method Details

#body ⇒ IO

46 47 48 # File 'gems/aws-sdk-core/lib/seahorse/client/http/request.rb', line 46 def body @body end

#body=(io) ⇒ Object

59 60 61 62 63 64 65 # File 'gems/aws-sdk-core/lib/seahorse/client/http/request.rb', line 59 def body=(io) @body = case io when nil then StringIO.new('') when String then StringIO.new(io) else io end end

#body_contents ⇒ String

51 52 53 54 55 56 # File 'gems/aws-sdk-core/lib/seahorse/client/http/request.rb', line 51 def body_contents body.rewind contents = body.read body.rewind contents end

#endpoint ⇒ URI::HTTP, ...

29 30 31 # File 'gems/aws-sdk-core/lib/seahorse/client/http/request.rb', line 29 def endpoint @endpoint end

#endpoint=(endpoint) ⇒ Object

34 35 36 37 38 39 40 41 42 43 # File 'gems/aws-sdk-core/lib/seahorse/client/http/request.rb', line 34 def endpoint=(endpoint) endpoint = URI.parse(endpoint) if endpoint.is_a?(String) if endpoint.nil? or URI::HTTP === endpoint or URI::HTTPS === endpoint @endpoint = endpoint else msg = 'invalid endpoint, expected URI::HTTP, URI::HTTPS, or nil, '\ "got #{endpoint.inspect}" raise ArgumentError, msg end end