simplify 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/simplify.rb +1 -0
- data/lib/simplify/constants.rb +1 -1
- data/lib/simplify/coupon.rb +1 -1
- data/lib/simplify/customer.rb +1 -1
- data/lib/simplify/invoice.rb +56 -2
- data/lib/simplify/invoiceitem.rb +10 -26
- data/lib/simplify/payment.rb +1 -1
- data/lib/simplify/plan.rb +1 -1
- data/lib/simplify/refund.rb +1 -1
- data/lib/simplify/subscription.rb +2 -2
- data/lib/simplify/tax.rb +120 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 686ecfa3f52547d7ec7bde0b239165cea64cd852
|
4
|
+
data.tar.gz: e51c6c223e164765786c9cde3849c2c36c2756b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f097f50a9a98c5e64114e919f3359c8fcf50404475816cbc0ee7900bae5f6862e5ce3b8835083520dd8e5c79799d686300b38d72a90524eebd90a62452d47c10
|
7
|
+
data.tar.gz: 0e545d1d5635a6594313f95b8743fd8bab82332e15423620929945a6a56888dc9a094fba6ab606b7d31df8d2b49d2687ab5b12d37563058583f8fb54352b9e48
|
data/lib/simplify.rb
CHANGED
@@ -35,6 +35,7 @@ require File.dirname(__FILE__) + '/simplify/deposit'
|
|
35
35
|
require File.dirname(__FILE__) + '/simplify/event'
|
36
36
|
require File.dirname(__FILE__) + '/simplify/invoice'
|
37
37
|
require File.dirname(__FILE__) + '/simplify/invoiceitem'
|
38
|
+
require File.dirname(__FILE__) + '/simplify/tax'
|
38
39
|
require File.dirname(__FILE__) + '/simplify/payment'
|
39
40
|
require File.dirname(__FILE__) + '/simplify/plan'
|
40
41
|
require File.dirname(__FILE__) + '/simplify/refund'
|
data/lib/simplify/constants.rb
CHANGED
@@ -30,7 +30,7 @@ module Simplify
|
|
30
30
|
# Constants.
|
31
31
|
class Constants
|
32
32
|
|
33
|
-
@@version = '1.1.
|
33
|
+
@@version = '1.1.2'
|
34
34
|
@@api_base_live_url = 'https://api.simplify.com/v1/api'
|
35
35
|
@@api_base_sandbox_url = 'https://sandbox.simplify.com/v1/api'
|
36
36
|
@@oauth_base_url = 'https://www.simplify.com/commerce/oauth';
|
data/lib/simplify/coupon.rb
CHANGED
@@ -60,7 +60,7 @@ class Coupon < Hash
|
|
60
60
|
# Creates an Coupon object
|
61
61
|
#
|
62
62
|
# parms:: a hash of parameters; valid keys are:
|
63
|
-
# * <code>amountOff</code> Amount off of the price of the product in minor units in the currency of the merchant. While this field is optional, you must provide either amountOff or percentOff for a coupon. Example: 1000 = 10.00 [min value: 1, max value:
|
63
|
+
# * <code>amountOff</code> Amount off of the price of the product in minor units in the currency of the merchant. While this field is optional, you must provide either amountOff or percentOff for a coupon. Example: 1000 = 10.00 [min value: 1, max value: 9999900]
|
64
64
|
# * <code>couponCode</code> Code that identifies the coupon to be used. [min length: 2] <b>required </b>
|
65
65
|
# * <code>description</code> A brief section that describes the coupon.
|
66
66
|
# * <code>durationInMonths</code> Duration in months that the coupon will be applied after it has first been selected. [min value: 1, max value: 9999]
|
data/lib/simplify/customer.rb
CHANGED
@@ -75,7 +75,7 @@ class Customer < Hash
|
|
75
75
|
# * <code>email</code> Email address of the customer <b>required </b>
|
76
76
|
# * <code>name</code> Customer name [min length: 2] <b>required </b>
|
77
77
|
# * <code>reference</code> Reference field for external applications use.
|
78
|
-
# * <code>subscriptions => amount</code> Amount of payment in minor units. Example: 1000 = 10.00 [min value: 50, max value:
|
78
|
+
# * <code>subscriptions => amount</code> Amount of payment in minor units. Example: 1000 = 10.00 [min value: 50, max value: 9999900]
|
79
79
|
# * <code>subscriptions => coupon</code> Coupon associated with the subscription for the customer.
|
80
80
|
# * <code>subscriptions => currency</code> Currency code (ISO-4217). Must match the currency associated with your account. [default: USD]
|
81
81
|
# * <code>subscriptions => customer</code> The customer ID to create the subscription for. Do not supply this when creating a customer.
|
data/lib/simplify/invoice.rb
CHANGED
@@ -57,12 +57,52 @@ class Invoice < Hash
|
|
57
57
|
end
|
58
58
|
|
59
59
|
|
60
|
+
# Creates an Invoice object
|
61
|
+
#
|
62
|
+
# parms:: a hash of parameters; valid keys are:
|
63
|
+
# * <code>currency</code> Currency code (ISO-4217). Must match the currency associated with your account. [max length: 3, min length: 3, default: USD]
|
64
|
+
# * <code>customer</code> The customer ID of the customer we are invoicing. This is optional is a name and email are provided
|
65
|
+
# * <code>discountRate</code> The discount percent as a decimal e.g. 12.5. This is used to calculate the discount amount which is subtracted from the total amount due before any tax is applied. [max length: 6]
|
66
|
+
# * <code>dueDate</code> The date invoice payment is due. If a late fee is provided this will be added to the invoice total is the due date has past.
|
67
|
+
# * <code>email</code> The email of the customer we are invoicing. This is optional if a customer id is provided. A new customer will be created using the the name and email.
|
68
|
+
# * <code>invoiceId</code> User defined invoice id. If not provided the system will generate a numeric id. [max length: 255]
|
69
|
+
# * <code>items => amount</code> Amount of the invoice item (minor units). Example: 1000 = 10.00. [min value: 1, max value: 9999900] <b>required </b>
|
70
|
+
# * <code>items => description</code> The description of the invoice item. [max length: 1024]
|
71
|
+
# * <code>items => invoice</code> The ID of the invoice this item belongs to.
|
72
|
+
# * <code>items => quantity</code> Quantity of the item. This total amount of the invoice item is the amount * quantity. [min value: 1, max value: 999999, default: 1]
|
73
|
+
# * <code>items => reference</code> User defined reference field. [max length: 255]
|
74
|
+
# * <code>items => tax</code> The tax ID of the tax charge in the invoice item.
|
75
|
+
# * <code>lateFee</code> The late fee amount that will be added to the invoice total is the due date is past due. Value provided must be in minor units. Example: 1000 = 10.00 [max value: 9999900]
|
76
|
+
# * <code>memo</code> A memo that is displayed to the customer on the invoice payment screen. [max length: 4000]
|
77
|
+
# * <code>name</code> The name of the customer we are invoicing. This is optional if a customer id is provided. A new customer will be created using the the name and email. [max length: 50, min length: 2]
|
78
|
+
# * <code>note</code> This field can be used to store a note that is not displayed to the customer. [max length: 4000]
|
79
|
+
# * <code>reference</code> User defined reference field. [max length: 255]
|
80
|
+
# * <code>type</code> The type of invoice. One of WEB or MOBILE. [valid values: WEB, MOBILE, default: WEB]
|
81
|
+
# auth:: Authentication information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. For backwards compatibility the public and private keys may be passed instead of the authentication object.
|
82
|
+
# Returns a Invoice object.
|
83
|
+
def self.create(parms, *auth)
|
84
|
+
|
85
|
+
auth_obj = Simplify::PaymentsApi.create_auth_object(auth)
|
86
|
+
h = Simplify::PaymentsApi.execute("invoice", 'create', parms, auth_obj)
|
87
|
+
obj = Invoice.new()
|
88
|
+
obj.authentication = auth_obj
|
89
|
+
obj = obj.merge!(h)
|
90
|
+
obj
|
91
|
+
end
|
92
|
+
|
93
|
+
# Delete this object
|
94
|
+
def delete()
|
95
|
+
h = Simplify::PaymentsApi.execute("invoice", 'delete', self, self.authentication)
|
96
|
+
self.merge!(h)
|
97
|
+
self
|
98
|
+
end
|
99
|
+
|
60
100
|
# Retrieve Invoice objects.
|
61
101
|
# criteria:: a hash of parameters; valid keys are:
|
62
102
|
# * <code>filter</code> Filters to apply to the list.
|
63
103
|
# * <code>max</code> Allows up to a max of 50 list items to return. [max value: 50, default: 20]
|
64
104
|
# * <code>offset</code> Used in paging of the list. This is the start offset of the page. [default: 0]
|
65
|
-
# * <code>sorting</code> Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either <code>asc</code> for ascending or <code>desc</code> for descending). Sortable properties are: <code> id</code><code> invoiceDate</code><code>
|
105
|
+
# * <code>sorting</code> Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either <code>asc</code> for ascending or <code>desc</code> for descending). Sortable properties are: <code> id</code><code> invoiceDate</code><code> dueDate</code><code> datePaid</code><code> customer</code><code> status</code>.
|
66
106
|
# auth:: Authentication information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. For backwards compatibility the public and private keys may be passed instead of the authentication object.
|
67
107
|
# Returns an object where the <code>list</code> property contains the list of Invoice objects and the <code>total</code>
|
68
108
|
# property contains the total number of Invoice objects available for the given criteria.
|
@@ -95,7 +135,21 @@ class Invoice < Hash
|
|
95
135
|
# Updates this object
|
96
136
|
#
|
97
137
|
# The properties that can be updated:
|
98
|
-
# * <code>
|
138
|
+
# * <code>datePaid</code> This is the date the invoice was PAID in UTC millis.
|
139
|
+
# * <code>discountRate</code> The discount percent as a decimal e.g. 12.5. This is used to calculate the discount amount which is subtracted from the total amount due before any tax is applied. [max length: 6]
|
140
|
+
# * <code>dueDate</code> The date invoice payment is due. If a late fee is provided this will be added to the invoice total is the due date has past.
|
141
|
+
# * <code>items => amount</code> Amount of the invoice item (minor units). Example: 1000 = 10.00 [min value: 1, max value: 9999900] <b>(required)</b>
|
142
|
+
# * <code>items => description</code> The description of the invoice item. [max length: 1024]
|
143
|
+
# * <code>items => invoice</code> The ID of the invoice this item belongs to.
|
144
|
+
# * <code>items => quantity</code> Quantity of the item. This total amount of the invoice item is the amount * quantity. [min value: 1, max value: 999999, default: 1]
|
145
|
+
# * <code>items => reference</code> User defined reference field. [max length: 255]
|
146
|
+
# * <code>items => tax</code> The tax ID of the tax charge in the invoice item.
|
147
|
+
# * <code>lateFee</code> The late fee amount that will be added to the invoice total is the due date is past due. Value provided must be in minor units. Example: 1000 = 10.00.
|
148
|
+
# * <code>memo</code> A memo that is displayed to the customer on the invoice payment screen. [max length: 4000]
|
149
|
+
# * <code>note</code> This field can be used to store a note that is not displayed to the customer. [max length: 4000]
|
150
|
+
# * <code>payment</code> The ID of the payment. Use this ID to query the /payment API. [max length: 255]
|
151
|
+
# * <code>reference</code> User defined reference field. [max length: 255]
|
152
|
+
# * <code>status</code> New status of the invoice.
|
99
153
|
def update()
|
100
154
|
h = Simplify::PaymentsApi.execute("invoice", 'update', self, self.authentication)
|
101
155
|
self.merge!(h)
|
data/lib/simplify/invoiceitem.rb
CHANGED
@@ -60,10 +60,12 @@ class InvoiceItem < Hash
|
|
60
60
|
# Creates an InvoiceItem object
|
61
61
|
#
|
62
62
|
# parms:: a hash of parameters; valid keys are:
|
63
|
-
# * <code>amount</code> Amount of the invoice item (minor units). Example: 1000 = 10.00 [min value: 1, max value:
|
64
|
-
# * <code>
|
65
|
-
# * <code>
|
66
|
-
# * <code>
|
63
|
+
# * <code>amount</code> Amount of the invoice item (minor units). Example: 1000 = 10.00 [min value: 1, max value: 9999900] <b>required </b>
|
64
|
+
# * <code>description</code> Individual items of an invoice [max length: 1024]
|
65
|
+
# * <code>invoice</code> The ID of the invoice this item belongs to.
|
66
|
+
# * <code>quantity</code> Quantity of the item. This total amount of the invoice item is the amount * quantity. [min value: 1, max value: 999999, default: 1]
|
67
|
+
# * <code>reference</code> User defined reference field. [max length: 255]
|
68
|
+
# * <code>tax</code> The tax ID of the tax charge in the invoice item.
|
67
69
|
# auth:: Authentication information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. For backwards compatibility the public and private keys may be passed instead of the authentication object.
|
68
70
|
# Returns a InvoiceItem object.
|
69
71
|
def self.create(parms, *auth)
|
@@ -83,26 +85,6 @@ class InvoiceItem < Hash
|
|
83
85
|
self
|
84
86
|
end
|
85
87
|
|
86
|
-
# Retrieve InvoiceItem objects.
|
87
|
-
# criteria:: a hash of parameters; valid keys are:
|
88
|
-
# * <code>filter</code> Filters to apply to the list.
|
89
|
-
# * <code>max</code> Allows up to a max of 50 list items to return. [max value: 50, default: 20]
|
90
|
-
# * <code>offset</code> Used in paging of the list. This is the start offset of the page. [default: 0]
|
91
|
-
# * <code>sorting</code> Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either <code>asc</code> for ascending or <code>desc</code> for descending). Sortable properties are: <code> id</code><code> amount</code><code> description</code><code> invoice</code>.
|
92
|
-
# auth:: Authentication information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. For backwards compatibility the public and private keys may be passed instead of the authentication object.
|
93
|
-
# Returns an object where the <code>list</code> property contains the list of InvoiceItem objects and the <code>total</code>
|
94
|
-
# property contains the total number of InvoiceItem objects available for the given criteria.
|
95
|
-
def self.list(criteria = nil, *auth)
|
96
|
-
|
97
|
-
auth_obj = Simplify::PaymentsApi.create_auth_object(auth)
|
98
|
-
h = Simplify::PaymentsApi.execute("invoiceItem", 'list', criteria, auth_obj)
|
99
|
-
obj = InvoiceItem.new()
|
100
|
-
obj.authentication = auth_obj
|
101
|
-
obj = obj.merge!(h)
|
102
|
-
obj
|
103
|
-
|
104
|
-
end
|
105
|
-
|
106
88
|
# Retrieve a InvoiceItem object from the API
|
107
89
|
#
|
108
90
|
# id:: ID of object to retrieve
|
@@ -121,9 +103,11 @@ class InvoiceItem < Hash
|
|
121
103
|
# Updates this object
|
122
104
|
#
|
123
105
|
# The properties that can be updated:
|
124
|
-
# * <code>amount</code> Amount of the invoice item (minor units). Example: 1000 = 10.00 [min value: 1, max value:
|
125
|
-
# * <code>currency</code> Currency code (ISO-4217) for the invoice item. Must match the currency associated with your account. [default: USD]
|
106
|
+
# * <code>amount</code> Amount of the invoice item (minor units). Example: 1000 = 10.00 [min value: 1, max value: 9999900]
|
126
107
|
# * <code>description</code> Individual items of an invoice
|
108
|
+
# * <code>quantity</code> Quantity of the item. This total amount of the invoice item is the amount * quantity. [min value: 1, max value: 999999]
|
109
|
+
# * <code>reference</code> User defined reference field.
|
110
|
+
# * <code>tax</code> The tax ID of the tax charge in the invoice item.
|
127
111
|
def update()
|
128
112
|
h = Simplify::PaymentsApi.execute("invoiceItem", 'update', self, self.authentication)
|
129
113
|
self.merge!(h)
|
data/lib/simplify/payment.rb
CHANGED
@@ -60,7 +60,7 @@ class Payment < Hash
|
|
60
60
|
# Creates an Payment object
|
61
61
|
#
|
62
62
|
# parms:: a hash of parameters; valid keys are:
|
63
|
-
# * <code>amount</code> Amount of the payment (minor units). Example: 1000 = 10.00 [min value: 50, max value:
|
63
|
+
# * <code>amount</code> Amount of the payment (minor units). Example: 1000 = 10.00 [min value: 50, max value: 9999900] <b>required </b>
|
64
64
|
# * <code>card => addressCity</code> City of the cardholder. [max length: 50, min length: 2]
|
65
65
|
# * <code>card => addressCountry</code> Country code (ISO-3166-1-alpha-2 code) of residence of the cardholder. [max length: 2, min length: 2]
|
66
66
|
# * <code>card => addressLine1</code> Address of the cardholder. [max length: 255]
|
data/lib/simplify/plan.rb
CHANGED
@@ -60,7 +60,7 @@ class Plan < Hash
|
|
60
60
|
# Creates an Plan object
|
61
61
|
#
|
62
62
|
# parms:: a hash of parameters; valid keys are:
|
63
|
-
# * <code>amount</code> Amount of payment for the plan in minor units. Example: 1000 = 10.00 [min value: 50, max value:
|
63
|
+
# * <code>amount</code> Amount of payment for the plan in minor units. Example: 1000 = 10.00 [min value: 50, max value: 9999900] <b>required </b>
|
64
64
|
# * <code>currency</code> Currency code (ISO-4217) for the plan. Must match the currency associated with your account. [default: USD] <b>required </b>
|
65
65
|
# * <code>frequency</code> Frequency of payment for the plan. Example: Monthly <b>required </b>
|
66
66
|
# * <code>name</code> Name of the plan [max length: 50, min length: 2] <b>required </b>
|
data/lib/simplify/refund.rb
CHANGED
@@ -60,7 +60,7 @@ class Refund < Hash
|
|
60
60
|
# Creates an Refund object
|
61
61
|
#
|
62
62
|
# parms:: a hash of parameters; valid keys are:
|
63
|
-
# * <code>amount</code> Amount of the refund in minor units. Example: 1000 = 10.00 [min value: 1, max value:
|
63
|
+
# * <code>amount</code> Amount of the refund in minor units. Example: 1000 = 10.00 [min value: 1, max value: 9999900] <b>required </b>
|
64
64
|
# * <code>payment</code> ID of the payment for the refund <b>required </b>
|
65
65
|
# * <code>reason</code> Reason for the refund
|
66
66
|
# * <code>reference</code> Custom reference field to be used with outside systems.
|
@@ -60,7 +60,7 @@ class Subscription < Hash
|
|
60
60
|
# Creates an Subscription object
|
61
61
|
#
|
62
62
|
# parms:: a hash of parameters; valid keys are:
|
63
|
-
# * <code>amount</code> Amount of the payment (minor units). Example: 1000 = 10.00 [min value: 50, max value:
|
63
|
+
# * <code>amount</code> Amount of the payment (minor units). Example: 1000 = 10.00 [min value: 50, max value: 9999900]
|
64
64
|
# * <code>coupon</code> Coupon ID associated with the subscription
|
65
65
|
# * <code>currency</code> Currency code (ISO-4217). Must match the currency associated with your account. [default: USD]
|
66
66
|
# * <code>customer</code> Customer that is enrolling in the subscription.
|
@@ -125,7 +125,7 @@ class Subscription < Hash
|
|
125
125
|
# Updates this object
|
126
126
|
#
|
127
127
|
# The properties that can be updated:
|
128
|
-
# * <code>amount</code> Amount of the payment (minor units). Example: 1000 = 10.00 [min value: 50, max value:
|
128
|
+
# * <code>amount</code> Amount of the payment (minor units). Example: 1000 = 10.00 [min value: 50, max value: 9999900]
|
129
129
|
# * <code>coupon</code> Coupon being assigned to this subscription
|
130
130
|
# * <code>currency</code> Currency code (ISO-4217). Must match the currency associated with your account. [default: USD]
|
131
131
|
# * <code>frequency</code> Frequency of payment for the plan. Example: Monthly
|
data/lib/simplify/tax.rb
ADDED
@@ -0,0 +1,120 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (c) 2013, 2014 MasterCard International Incorporated
|
3
|
+
# All rights reserved.
|
4
|
+
#
|
5
|
+
# Redistribution and use in source and binary forms, with or without modification, are
|
6
|
+
# permitted provided that the following conditions are met:
|
7
|
+
#
|
8
|
+
# Redistributions of source code must retain the above copyright notice, this list of
|
9
|
+
# conditions and the following disclaimer.
|
10
|
+
# Redistributions in binary form must reproduce the above copyright notice, this list of
|
11
|
+
# conditions and the following disclaimer in the documentation and/or other materials
|
12
|
+
# provided with the distribution.
|
13
|
+
# Neither the name of the MasterCard International Incorporated nor the names of its
|
14
|
+
# contributors may be used to endorse or promote products derived from this software
|
15
|
+
# without specific prior written permission.
|
16
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
17
|
+
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
18
|
+
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
19
|
+
# SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
20
|
+
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
21
|
+
# TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
22
|
+
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
23
|
+
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
24
|
+
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
25
|
+
# SUCH DAMAGE.
|
26
|
+
#
|
27
|
+
|
28
|
+
require 'simplify/paymentsapi'
|
29
|
+
|
30
|
+
module Simplify
|
31
|
+
|
32
|
+
# A Tax object.
|
33
|
+
#
|
34
|
+
class Tax < Hash
|
35
|
+
|
36
|
+
# Authentication object used to access the API (See Simplify::Authentication for details)
|
37
|
+
attr_accessor :authentication
|
38
|
+
|
39
|
+
# Returns the public key used when accessing this object. <b>Deprecated: please use 'authentication' instead.</b>
|
40
|
+
def public_key
|
41
|
+
return self.authentication.public_key
|
42
|
+
end
|
43
|
+
|
44
|
+
# Sets the public key used when accessing this object. <b>Deprecated: please use 'authentication' instead.</b>
|
45
|
+
def public_key=(k)
|
46
|
+
return self.authentication.public_key = k
|
47
|
+
end
|
48
|
+
|
49
|
+
# Returns the private key used when accessing this object. <b>Deprecated: please use 'authentication' instead.</b>
|
50
|
+
def private_key
|
51
|
+
return self.authentication.private_key
|
52
|
+
end
|
53
|
+
|
54
|
+
# Sets the private key used when accessing this object. <b>Deprecated: please use 'authentication' instead.</b>
|
55
|
+
def private_key=(k)
|
56
|
+
return self.authentication.private_key = k
|
57
|
+
end
|
58
|
+
|
59
|
+
|
60
|
+
# Creates an Tax object
|
61
|
+
#
|
62
|
+
# parms:: a hash of parameters; valid keys are:
|
63
|
+
# * <code>label</code> The label of the tax object. [max length: 255] <b>required </b>
|
64
|
+
# * <code>rate</code> The tax rate. Decimal value up three decimal places. e.g 12.501. [max length: 6] <b>required </b>
|
65
|
+
# auth:: Authentication information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. For backwards compatibility the public and private keys may be passed instead of the authentication object.
|
66
|
+
# Returns a Tax object.
|
67
|
+
def self.create(parms, *auth)
|
68
|
+
|
69
|
+
auth_obj = Simplify::PaymentsApi.create_auth_object(auth)
|
70
|
+
h = Simplify::PaymentsApi.execute("tax", 'create', parms, auth_obj)
|
71
|
+
obj = Tax.new()
|
72
|
+
obj.authentication = auth_obj
|
73
|
+
obj = obj.merge!(h)
|
74
|
+
obj
|
75
|
+
end
|
76
|
+
|
77
|
+
# Delete this object
|
78
|
+
def delete()
|
79
|
+
h = Simplify::PaymentsApi.execute("tax", 'delete', self, self.authentication)
|
80
|
+
self.merge!(h)
|
81
|
+
self
|
82
|
+
end
|
83
|
+
|
84
|
+
# Retrieve Tax objects.
|
85
|
+
# criteria:: a hash of parameters; valid keys are:
|
86
|
+
# * <code>filter</code> Filters to apply to the list.
|
87
|
+
# * <code>max</code> Allows up to a max of 50 list items to return. [max value: 50, default: 20]
|
88
|
+
# * <code>offset</code> Used in paging of the list. This is the start offset of the page. [default: 0]
|
89
|
+
# * <code>sorting</code> Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either <code>asc</code> for ascending or <code>desc</code> for descending). Sortable properties are: <code> id</code><code> label</code>.
|
90
|
+
# auth:: Authentication information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. For backwards compatibility the public and private keys may be passed instead of the authentication object.
|
91
|
+
# Returns an object where the <code>list</code> property contains the list of Tax objects and the <code>total</code>
|
92
|
+
# property contains the total number of Tax objects available for the given criteria.
|
93
|
+
def self.list(criteria = nil, *auth)
|
94
|
+
|
95
|
+
auth_obj = Simplify::PaymentsApi.create_auth_object(auth)
|
96
|
+
h = Simplify::PaymentsApi.execute("tax", 'list', criteria, auth_obj)
|
97
|
+
obj = Tax.new()
|
98
|
+
obj.authentication = auth_obj
|
99
|
+
obj = obj.merge!(h)
|
100
|
+
obj
|
101
|
+
|
102
|
+
end
|
103
|
+
|
104
|
+
# Retrieve a Tax object from the API
|
105
|
+
#
|
106
|
+
# id:: ID of object to retrieve
|
107
|
+
# auth:: Authentication information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. For backwards compatibility the public and private keys may be passed instead of the authentication object.
|
108
|
+
# Returns a Tax object.
|
109
|
+
def self.find(id, *auth)
|
110
|
+
|
111
|
+
auth_obj = Simplify::PaymentsApi.create_auth_object(auth)
|
112
|
+
h = Simplify::PaymentsApi.execute("tax", 'show', {"id" => id}, auth_obj)
|
113
|
+
obj = Tax.new()
|
114
|
+
obj.authentication = auth_obj
|
115
|
+
obj = obj.merge!(h)
|
116
|
+
obj
|
117
|
+
end
|
118
|
+
|
119
|
+
end
|
120
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simplify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Simplify Commerce
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-03-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -75,6 +75,7 @@ files:
|
|
75
75
|
- lib/simplify/plan.rb
|
76
76
|
- lib/simplify/refund.rb
|
77
77
|
- lib/simplify/subscription.rb
|
78
|
+
- lib/simplify/tax.rb
|
78
79
|
- lib/simplify/webhook.rb
|
79
80
|
- lib/simplify.rb
|
80
81
|
homepage: https://www.simplify.com/commerce
|