lib/pin_up/charge.rb in pin_up-1.3.0 vs lib/pin_up/charge.rb in pin_up-1.3.2
- old
+ new
@@ -25,16 +25,22 @@
end
# Find a charge(s) for your account given a search term or set of terms
# args: options (Hash)
# returns: a collection of charge objects
+ #
+ # if pagination is passed, access the response hash with [:response]
+ # and the pagination hash with [:pagination]
+ #
# https://pin.net.au/docs/api/charges#search-charges
- def self.search(options = {})
+ def self.search(page = nil, pagination = false, **options)
term = ''
+ options.merge! page: page if page
+
options.each do |key, option|
- term += "#{key.to_s}=#{URI.encode(option)}&"
+ term += "#{key.to_s}=#{URI.encode(option.to_s)}&"
end
- build_response(make_request(:get, {url: "charges/search?#{term}" } ))
+ build_collection_response(make_request(:get, {url: "charges/search?#{term}" } ), pagination)
end
# Create a charge given charge details and a card,
# a card_token or a customer_token
# args: options (Hash)