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

Inherits:
Object
  • Object
show all
Defined in:
aws-sdk-core/lib/seahorse/client/http/request.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Request

Returns a new instance of Request

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :endpoint (URI::HTTP, URI::HTTPS) — default: nil
  • :http_method (String) — default: 'GET'
  • :headers (Headers) — default: Headers.new
  • :body (Body) — default: StringIO.new

13
14
15
16
17
18
# File 'aws-sdk-core/lib/seahorse/client/http/request.rb', line 13

def initialize(options = {})
  self.endpoint = options[:endpoint] if options[:endpoint]
  self.http_method = options[:http_method] || 'GET'
  self.headers = Headers.new(options[:headers] || {})
  self.body = options[:body]
end

Instance Attribute Details

#bodyIO

Returns:

  • (IO)

30
31
32
# File 'aws-sdk-core/lib/seahorse/client/http/request.rb', line 30

def body
  @body
end

#endpointURI::HTTP, ...

Returns:

  • (URI::HTTP, URI::HTTPS, nil)

21
22
23
# File 'aws-sdk-core/lib/seahorse/client/http/request.rb', line 21

def endpoint
  @endpoint
end

#headersHeaders

Returns The hash of request headers.

Returns:

  • (Headers)

    The hash of request headers.


27
28
29
# File 'aws-sdk-core/lib/seahorse/client/http/request.rb', line 27

def headers
  @headers
end

#http_methodString

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

Returns:

  • (String)

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


24
25
26
# File 'aws-sdk-core/lib/seahorse/client/http/request.rb', line 24

def http_method
  @http_method
end

Instance Method Details

#body_contentsString

Returns:

  • (String)

45
46
47
48
49
50
# File 'aws-sdk-core/lib/seahorse/client/http/request.rb', line 45

def body_contents
  body.rewind
  contents = body.read
  body.rewind
  contents
end