Class: Simplify::Chargeback

Inherits:
Hash
  • Object
show all
Defined in:
lib/simplify/chargeback.rb

Overview

A Chargeback object.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#private_keyObject

Private key used to access the API.



40
41
42
# File 'lib/simplify/chargeback.rb', line 40

def private_key
  @private_key
end

#public_keyObject

Public key used to access the API.



37
38
39
# File 'lib/simplify/chargeback.rb', line 37

def public_key
  @public_key
end

Class Method Details

.find(id, public_key = nil, private_key = nil) ⇒ Object

Retrieve a Chargeback object from the API

id

ID of object to retrieve

public_key

Public to use for the API call. If nil, the value of Simplify::public_key will be used.

private_key

Private key to use for the API call. If nil, the value of Simplify::private_key will be used.

Returns a Chargeback object.



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/simplify/chargeback.rb', line 78

def self.find(id, public_key = nil, private_key = nil)
    if public_key == nil then
         public_key = Simplify::public_key
    end
    if private_key == nil then
        private_key = Simplify::private_key
    end

    h = Simplify::PaymentsApi.execute("chargeback", 'show', {"id" => id}, public_key, private_key)
    obj = Chargeback.new()
    obj.public_key = public_key
    obj.private_key = private_key
    obj = obj.merge(h)
    obj
end

.list(criteria = nil, public_key = nil, private_key = nil) ⇒ Object

Retrieve Chargeback objects.

criteria

a hash of parameters; valid keys are:

  • filter Filters to apply to the list.

  • max Allows up to a max of 50 list items to return. default:20

  • offset Used in paging of the list. This is the start offset of the page. default:0

  • sorting Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either asc for ascending or desc for descending). Sortable properties are: id amount description dateCreated paymentDate.

public_key

Public to use for the API call. If nil, the value of Simplify::public_key will be used.

private_key

Private key to use for the API call. If nil, the value of Simplify::private_key will be used.

Returns an object where the list property contains the list of Chargeback objects and the total property contains the total number of Chargeback objects available for the given criteria.



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/simplify/chargeback.rb', line 54

def self.list(criteria = nil, public_key = nil, private_key = nil)

    if public_key == nil then
        public_key = Simplify::public_key
    end
    if private_key == nil then
       private_key = Simplify::private_key
    end

    h = Simplify::PaymentsApi.execute("chargeback", 'list', criteria, public_key, private_key)
    obj = Chargeback.new()
    obj.public_key = public_key
    obj.private_key = private_key
    obj = obj.merge(h)
    obj

end