Class: Pin::Refund

Inherits:
Base
  • Object
show all
Defined in:
lib/pin_up/refund.rb

Overview

This class models Pin’s Charges API

Class Method Summary collapse

Methods inherited from Base

#initialize, #key, #uri

Constructor Details

This class inherits a constructor from Pin::Base

Class Method Details

.create(token, amount = nil) ⇒ Object

Create a refund for a charge args: token (String), amount (String - optional) returns: a refund object if no amount is passed in, the full amount of the charge will be refunded pin.net.au/docs/api/refunds#post-refunds



25
26
27
28
# File 'lib/pin_up/refund.rb', line 25

def self.create(token, amount = nil)
  options = {amount: amount}
  build_response(auth_post("charges/#{token}/refunds", options))
end

.find(token, page = nil, pagination = false) ⇒ Object

Find a refund by charge token returns: a collection of refund objects args: token (String)

if pagination is passed, access the response hash with [:response] and the pagination hash with [:pagination]

pin.net.au/docs/api/refunds#get-refunds



15
16
17
# File 'lib/pin_up/refund.rb', line 15

def self.find(token, page = nil, pagination = false)
  build_collection_response(auth_get("charges/#{token}/refunds?page=#{page}"), pagination)
end