Class: EcwidApi::UnpagedEcwidResponse
- Inherits:
-
Object
- Object
- EcwidApi::UnpagedEcwidResponse
- Extended by:
- Forwardable
- Includes:
- Enumerable
- Defined in:
- lib/ecwid_api/unpaged_ecwid_response.rb
Instance Method Summary collapse
-
#initialize(client, path, params = {}, &block) ⇒ UnpagedEcwidResponse
constructor
client - an EcwidApi::Client path - a String that is the path to retrieve from the client params - a Hash of parameters to pass along with the request &block - a Block that processes each item returned in the Response.
Constructor Details
#initialize(client, path, params = {}, &block) ⇒ UnpagedEcwidResponse
client - an EcwidApi::Client path - a String that is the path to retrieve from the client params - a Hash of parameters to pass along with the request &block - a Block that processes each item returned in the Response
28 29 30 31 32 33 34 35 36 |
# File 'lib/ecwid_api/unpaged_ecwid_response.rb', line 28 def initialize(client, path, params = {}, &block) block ||= Proc.new { |item| item } @records = [] response = client.get(path, params) response.body.each do |item| @records << block.call(item) end end |