Sha256: 6b60e111d9137cede704b769e86624cfb731ae8cb0a7730b55f33c6fdac43842

Contents?: true

Size: 601 Bytes

Versions: 4

Compression:

Stored size: 601 Bytes

Contents

module Mollie
	module API
		module Object
			class List < Base
				include Enumerable  

				attr_accessor :totalCount,
				              :offset,
				              :count,
				              :data	

				def initialize (hash, classResourceObject)
					data        = hash[:data] || []
					hash[:data] = nil
					super hash

					@data = []
					data.each { |hash| 
						@data << (classResourceObject.new hash)
					}
				end

				def each (&block)
					@data.each { |object|
						if block_given?
							block.call object
						else  
							yield object
						end
					}
				end
			end
		end
	end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mollie-api-ruby-1.1.2 lib/Mollie/API/Object/List.rb
mollie-api-ruby-1.1.1 lib/Mollie/API/Object/List.rb
mollie-api-ruby-1.1.0 lib/Mollie/API/Object/List.rb
mollie-api-ruby-1.0.1 lib/Mollie/API/Object/List.rb