class Mollie::List
Attributes
Public Class Methods
Source
# File lib/mollie/list.rb, line 8 def initialize(list_attributes, klass) @klass = klass list_attributes['items'] ||= if list_attributes['_embedded'] list_attributes['_embedded'].fetch(klass.embedded_resource_name, []) else [] end super list_attributes @items = items.map do |attributes| klass.new attributes end end
Calls superclass method
Mollie::Base::new
Public Instance Methods
Source
# File lib/mollie/list.rb, line 35 def next(options = {}) return self.class.new({}, klass) if links['next'].nil? href = URI.parse(links['next']['href']) query = URI.decode_www_form(href.query).to_h response = Mollie::Client.instance.perform_http_call('GET', links['next']['href'], nil, {}, options.merge(query)) self.class.new(response, klass) end
Source
# File lib/mollie/list.rb, line 45 def previous(options = {}) return self.class.new({}, klass) if links['previous'].nil? href = URI.parse(links['previous']['href']) query = URI.decode_www_form(href.query).to_h response = Mollie::Client.instance.perform_http_call('GET', links['previous']['href'], nil, {}, options.merge(query)) self.class.new(response, klass) end