Class: Seahorse::Client::Http::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/seahorse/client/http/response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Response

Returns a new instance of Response.

Options Hash (options):

  • :status_code (Integer) — default: 0
  • :headers (Headers) — default: Headers.new
  • :body (IO) — default: StringIO.new


9
10
11
12
13
# File 'lib/seahorse/client/http/response.rb', line 9

def initialize(options = {})
  @status_code = options[:status_code] || 0
  @headers = options[:headers] || Headers.new
  @body = options[:body] || StringIO.new
end

Instance Attribute Details

#bodyIO



23
24
25
# File 'lib/seahorse/client/http/response.rb', line 23

def body
  @body
end

#headersHeaders



20
21
22
# File 'lib/seahorse/client/http/response.rb', line 20

def headers
  @headers
end

#status_codeInteger



17
18
19
# File 'lib/seahorse/client/http/response.rb', line 17

def status_code
  @status_code
end

Instance Method Details

#body_contentsString



35
36
37
38
39
40
# File 'lib/seahorse/client/http/response.rb', line 35

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