Class: Cage::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/cage/response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(faraday_response) ⇒ Response

Returns a new instance of Response.



5
6
7
# File 'lib/cage/response.rb', line 5

def initialize faraday_response
  @faraday_response = faraday_response
end

Instance Attribute Details

#faraday_responseObject (readonly)

Returns the value of attribute faraday_response.



3
4
5
# File 'lib/cage/response.rb', line 3

def faraday_response
  @faraday_response
end

Instance Method Details

#bodyObject



9
10
11
# File 'lib/cage/response.rb', line 9

def body
  @faraday_response.body
end

#headersObject



17
18
19
# File 'lib/cage/response.rb', line 17

def headers
  @faraday_response.headers
end

#inspectObject



25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/cage/response.rb', line 25

def inspect
  <<-PRETTY

Status: #{status}

Headers:
#{headers.map { |k, v| "  #{k}: #{v}" }.join "\n"}

Body:
  #{body}

#<Cage::Response:(#{url})>
  PRETTY
end

#statusObject



13
14
15
# File 'lib/cage/response.rb', line 13

def status
  @faraday_response.status
end

#urlObject



21
22
23
# File 'lib/cage/response.rb', line 21

def url
  @faraday_response.env[:url].to_s
end