Class: Cb::Responses::Spot::Retrieve
- Inherits:
-
RawApiResponse
- Object
- RawApiResponse
- Cb::Responses::Spot::Retrieve
- Defined in:
- lib/cb/responses/spot/retrieve_response.rb
Constant Summary collapse
- ROOT_NODE =
'ResponseRetrieve'- SPOT_COLLECTION =
'SpotData'
Instance Attribute Summary
Attributes inherited from RawApiResponse
Class Method Summary collapse
Instance Method Summary collapse
- #extract_models ⇒ Object
-
#initialize(raw_api_response = {}) ⇒ Retrieve
constructor
A new instance of Retrieve.
- #validate_raw_api_response ⇒ Object
Constructor Details
#initialize(raw_api_response = {}) ⇒ Retrieve
Returns a new instance of Retrieve.
13 14 15 |
# File 'lib/cb/responses/spot/retrieve_response.rb', line 13 def initialize(raw_api_response={}) super(raw_api_response) end |
Class Method Details
.extract_models(raw_api_response) ⇒ Object
8 9 10 |
# File 'lib/cb/responses/spot/retrieve_response.rb', line 8 def extract_models(raw_api_response) new(raw_api_response).extract_models end |
Instance Method Details
#extract_models ⇒ Object
22 23 24 25 |
# File 'lib/cb/responses/spot/retrieve_response.rb', line 22 def extract_models spot_models = raw_api_hash[ROOT_NODE][SPOT_COLLECTION].map { |spot_data| Cb::Models::Spot.new(spot_data) } Cb::Utils::Api.new.append_api_responses(spot_models, raw_api_hash[ROOT_NODE]) end |
#validate_raw_api_response ⇒ Object
17 18 19 20 |
# File 'lib/cb/responses/spot/retrieve_response.rb', line 17 def validate_raw_api_response required_response_field ROOT_NODE, raw_api_hash required_response_field SPOT_COLLECTION, raw_api_hash[ROOT_NODE] end |