class Pin::Transfer
This class models Pin's Transfers API
Public Class Methods
Returns a paginated list of all transfers. page: page (Fixnum), pagination (Boolean)
if pagination is passed, access the response hash with [:response] and the pagination hash with [:pagination]
pinpayments.com/docs/api/transfers#get-transfers
# File lib/pin_up/transfer.rb, line 21 def self.all(page = nil, pagination = false) build_collection_response(make_request(:get, {url: "transfers?page=#{page}" } ), pagination) end
Creates a new transfer and returns its details. pinpayments.com/docs/api/transfers#post-transfers args: options (Hash)
# File lib/pin_up/transfer.rb, line 9 def self.create(options) build_response(make_request(:post, { url: 'transfers', options: options })) end
Returns the details of a transfer. args: token (String) returns: a transfer pinpayments.com/docs/api/transfers#get-transfer
# File lib/pin_up/transfer.rb, line 30 def self.find(token) build_response(make_request(:get, {url: "transfers/#{token}" } )) end
Returns the line items associated with transfer. args: token (String), page (Fixnum), pagination (Boolean)
pinpayments.com/docs/api/transfers#get-transfer-line-items
# File lib/pin_up/transfer.rb, line 57 def self.line_items(token, page = nil, pagination = false) build_collection_response(make_request(:get, {url: "transfers/#{token}/line_items?page=#{page}" } ), pagination) end
Find a transfer(s) for your account given a search term or set of terms args: options (Hash) returns: a collection of transfer objects
if pagination is passed, access the response hash with [:response] and the pagination hash with [:pagination]
pinpayments.com/docs/api/transfers#search-transfers
# File lib/pin_up/transfer.rb, line 42 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.to_s)}&" end build_collection_response(make_request(:get, {url: "transfers/search?#{term}" } ), pagination) end