Class: ApiConsumer::Parsers::Collection
- Inherits:
-
ActiveResource::Collection
- Object
- ActiveResource::Collection
- ApiConsumer::Parsers::Collection
- Defined in:
- lib/api_consumer/parsers/collection.rb
Instance Attribute Summary collapse
-
#response ⇒ Object
Returns the value of attribute response.
Instance Method Summary collapse
- #collect! ⇒ Object
-
#initialize(parsed = {}) ⇒ Collection
constructor
A new instance of Collection.
Constructor Details
#initialize(parsed = {}) ⇒ Collection
Returns a new instance of Collection.
8 9 10 11 12 |
# File 'lib/api_consumer/parsers/collection.rb', line 8 def initialize(parsed = {}) @elements = parsed.fetch('data') parsed.delete 'data' @response = parsed end |
Instance Attribute Details
#response ⇒ Object
Returns the value of attribute response.
6 7 8 |
# File 'lib/api_consumer/parsers/collection.rb', line 6 def response @response end |
Instance Method Details
#collect! ⇒ Object
14 15 16 17 |
# File 'lib/api_consumer/parsers/collection.rb', line 14 def collect! @response = ApiConsumer::Processor.process @response, resource_class.to_s super end |