Class: ApiConsumer::Parsers::Collection

Inherits:
ActiveResource::Collection
  • Object
show all
Defined in:
lib/api_consumer/parsers/collection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#responseObject

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