Class: LemonWay::ResponseAdapter
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- LemonWay::ResponseAdapter
- Defined in:
- lib/lemon_way/response_adapter.rb
Instance Method Summary collapse
-
#initialize(response) ⇒ ResponseAdapter
constructor
A new instance of ResponseAdapter.
Constructor Details
#initialize(response) ⇒ ResponseAdapter
Returns a new instance of ResponseAdapter.
8 9 10 11 12 13 14 |
# File 'lib/lemon_way/response_adapter.rb', line 8 def initialize(response) response = JSON.parse(response.body)['d'].deep_transform_keys { |key| key.underscore.to_sym } raise LemonWay::LemonWayError.new(response[:e]) if response[:e].present? super(values_for(response)) end |