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.
34 35 36 37 38 39 40 41 42 43 |
# File 'lib/looker-sdk/sawyer_patch.rb', line 34 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.
32 33 34 |
# File 'lib/looker-sdk/sawyer_patch.rb', line 32 def body @body end |
#env ⇒ Object (readonly)
Returns the value of attribute env.
32 33 34 |
# File 'lib/looker-sdk/sawyer_patch.rb', line 32 def env @env end |
Instance Method Details
#data ⇒ Object
45 46 47 48 49 50 |
# File 'lib/looker-sdk/sawyer_patch.rb', line 45 def data @data ||= begin return(body) unless (headers[:content_type] =~ /json|msgpack/) process_data(agent.decode_body(body)) end end |
#inspect ⇒ Object
52 53 54 |
# File 'lib/looker-sdk/sawyer_patch.rb', line 52 def inspect %(#<#{self.class}: #{@status} @rels=#{@rels.inspect} @data=#{data.inspect}>) end |