Class: Snap::Response

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

Overview

Wraps HTTParty response so we can provide some helpful methods.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response, model) ⇒ Response

Returns a new instance of Response.



6
7
8
9
# File 'lib/snap/response.rb', line 6

def initialize(response, model)
  @model = model
  super(response)
end

Instance Attribute Details

#modelObject (readonly)

Returns the value of attribute model.



10
11
12
# File 'lib/snap/response.rb', line 10

def model
  @model
end

Instance Method Details

#hydrateObject



12
13
14
# File 'lib/snap/response.rb', line 12

def hydrate
  model.new(parsed_response)
end