Class: Sawyer::Response
- Inherits:
-
Object
- Object
- Sawyer::Response
- Defined in:
- lib/looker-sdk/sawyer_patch.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#env ⇒ Object
readonly
Returns the value of attribute env.
Instance Method Summary collapse
- #data ⇒ Object
-
#initialize(agent, res, options = {}) ⇒ Response
constructor
A new instance of Response.
- #inspect ⇒ Object
Constructor Details
#initialize(agent, res, options = {}) ⇒ Response
Returns a new instance of Response.
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/looker-sdk/sawyer_patch.rb', line 10 def initialize(agent, res, = {}) @agent = agent @status = res.status @headers = res.headers @env = res.env @body = res.body @rels = process_rels @started = [:sawyer_started] @ended = [:sawyer_ended] end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
8 9 10 |
# File 'lib/looker-sdk/sawyer_patch.rb', line 8 def body @body end |
#env ⇒ Object (readonly)
Returns the value of attribute env.
8 9 10 |
# File 'lib/looker-sdk/sawyer_patch.rb', line 8 def env @env end |
Instance Method Details
#data ⇒ Object
21 22 23 24 25 26 |
# File 'lib/looker-sdk/sawyer_patch.rb', line 21 def data @data ||= begin return(body) unless (headers[:content_type] =~ /json|msgpack/) process_data(agent.decode_body(body)) end end |
#inspect ⇒ Object
28 29 30 |
# File 'lib/looker-sdk/sawyer_patch.rb', line 28 def inspect %(#<#{self.class}: #{@status} @rels=#{@rels.inspect} @data=#{data.inspect}>) end |