Sha256: 84fa196b0daab51a950930056464d68f7d59b053b4ed6ee01ce654690b65f5c2

Contents?: true

Size: 967 Bytes

Versions: 18

Compression:

Stored size: 967 Bytes

Contents

module Pin
  ##
  # This class models Pin's Charges API
  class Refund < Base

    ##
    # 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]
    #
    # https://pin.net.au/docs/api/refunds#get-refunds
    def self.find(token, page = nil, pagination = false)
      build_collection_response(auth_get("charges/#{token}/refunds?page=#{page}"), pagination)
    end

    ##
    # 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
    # https://pin.net.au/docs/api/refunds#post-refunds
    def self.create(token, amount = nil)
      options = {amount: amount}
      build_response(auth_post("charges/#{token}/refunds", options))
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
pin_up-0.9.4 lib/pin_up/refund.rb
pin_up-0.9.3 lib/pin_up/refund.rb
pin_up-0.9.2 lib/pin_up/refund.rb
pin_up-0.9.1 lib/pin_up/refund.rb
pin_up-0.9.0 lib/pin_up/refund.rb
pin_up-0.8.2 lib/pin_up/refund.rb
pin_up-0.8.0 lib/pin_up/refund.rb
pin_up-0.7.5 lib/pin_up/refund.rb
pin_up-0.7.4 lib/pin_up/refund.rb
pin_up-0.7.3 lib/pin_up/refund.rb
pin_up-0.7.2 lib/pin_up/refund.rb
pin_up-0.7.1 lib/pin_up/refund.rb
pin_up-0.7.0 lib/pin_up/refund.rb
pin_up-0.6.4 lib/pin_up/refund.rb
pin_up-0.6.3 lib/pin_up/refund.rb
pin_up-0.6.2 lib/pin_up/refund.rb
pin_up-0.6.1 lib/pin_up/refund.rb
pin_up-0.5.0 lib/pin_up/refund.rb