processout 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/deploy.sh +2 -2
- data/lib/processout.rb +38 -38
- data/lib/processout/activity.rb +16 -10
- data/lib/processout/authorization_request.rb +24 -18
- data/lib/processout/card.rb +20 -14
- data/lib/processout/coupon.rb +26 -20
- data/lib/processout/customer.rb +36 -30
- data/lib/processout/customer_action.rb +9 -3
- data/lib/processout/discount.rb +19 -13
- data/lib/processout/event.rb +18 -12
- data/lib/processout/gateway.rb +15 -9
- data/lib/processout/gateway_configuration.rb +12 -6
- data/lib/processout/invoice.rb +40 -34
- data/lib/processout/plan.rb +25 -19
- data/lib/processout/product.rb +28 -22
- data/lib/processout/project.rb +14 -8
- data/lib/processout/refund.rb +17 -11
- data/lib/processout/subscription.rb +49 -43
- data/lib/processout/token.rb +15 -9
- data/lib/processout/transaction.rb +29 -23
- data/lib/processout/version.rb +1 -1
- data/lib/processout/webhook.rb +19 -13
- metadata +2 -2
data/lib/processout/customer.rb
CHANGED
@@ -105,29 +105,35 @@ module ProcessOut
|
|
105
105
|
# Initializes the Customer object
|
106
106
|
# Params:
|
107
107
|
# +client+:: +ProcessOut+ client instance
|
108
|
-
|
108
|
+
# +data+:: data that can be used to fill the object
|
109
|
+
def initialize(client, data = {})
|
109
110
|
@client = client
|
110
111
|
|
111
|
-
@id = ""
|
112
|
-
@project = nil
|
113
|
-
@email = ""
|
114
|
-
@first_name = ""
|
115
|
-
@last_name = ""
|
116
|
-
@address1 = ""
|
117
|
-
@address2 = ""
|
118
|
-
@city = ""
|
119
|
-
@state = ""
|
120
|
-
@zip = ""
|
121
|
-
@country_code = ""
|
122
|
-
@balance = "0"
|
123
|
-
@currency = ""
|
124
|
-
@metadata = Hash.new
|
125
|
-
@has_pin = false
|
126
|
-
@sandbox = false
|
127
|
-
@created_at = ""
|
112
|
+
@id = data.fetch(:id, "")
|
113
|
+
@project = data.fetch(:project, nil)
|
114
|
+
@email = data.fetch(:email, "")
|
115
|
+
@first_name = data.fetch(:first_name, "")
|
116
|
+
@last_name = data.fetch(:last_name, "")
|
117
|
+
@address1 = data.fetch(:address1, "")
|
118
|
+
@address2 = data.fetch(:address2, "")
|
119
|
+
@city = data.fetch(:city, "")
|
120
|
+
@state = data.fetch(:state, "")
|
121
|
+
@zip = data.fetch(:zip, "")
|
122
|
+
@country_code = data.fetch(:country_code, "")
|
123
|
+
@balance = data.fetch(:balance, "0")
|
124
|
+
@currency = data.fetch(:currency, "")
|
125
|
+
@metadata = data.fetch(:metadata, Hash.new)
|
126
|
+
@has_pin = data.fetch(:has_pin, false)
|
127
|
+
@sandbox = data.fetch(:sandbox, false)
|
128
|
+
@created_at = data.fetch(:created_at, "")
|
128
129
|
|
129
130
|
end
|
130
131
|
|
132
|
+
# Create a new Customer using the current client
|
133
|
+
def new(data = {})
|
134
|
+
Customer.new(@client, data)
|
135
|
+
end
|
136
|
+
|
131
137
|
# Fills the object with data coming from the API
|
132
138
|
# Params:
|
133
139
|
# +data+:: +Hash+ of data coming from the API
|
@@ -190,7 +196,7 @@ module ProcessOut
|
|
190
196
|
# Get the subscriptions belonging to the customer.
|
191
197
|
# Params:
|
192
198
|
# +options+:: +Hash+ of options
|
193
|
-
def subscriptions(options =
|
199
|
+
def subscriptions(options = {})
|
194
200
|
request = Request.new(@client)
|
195
201
|
path = "/customers/" + CGI.escape(@id) + "/subscriptions"
|
196
202
|
data = {
|
@@ -203,7 +209,7 @@ module ProcessOut
|
|
203
209
|
a = Array.new
|
204
210
|
body = response.body
|
205
211
|
for v in body['subscriptions']
|
206
|
-
tmp = Subscription(@client)
|
212
|
+
tmp = Subscription.new(@client)
|
207
213
|
tmp.fill_with_data(v)
|
208
214
|
a.push(tmp)
|
209
215
|
end
|
@@ -218,7 +224,7 @@ module ProcessOut
|
|
218
224
|
# Get the customer's tokens.
|
219
225
|
# Params:
|
220
226
|
# +options+:: +Hash+ of options
|
221
|
-
def tokens(options =
|
227
|
+
def tokens(options = {})
|
222
228
|
request = Request.new(@client)
|
223
229
|
path = "/customers/" + CGI.escape(@id) + "/tokens"
|
224
230
|
data = {
|
@@ -231,7 +237,7 @@ module ProcessOut
|
|
231
237
|
a = Array.new
|
232
238
|
body = response.body
|
233
239
|
for v in body['tokens']
|
234
|
-
tmp = Token(@client)
|
240
|
+
tmp = Token.new(@client)
|
235
241
|
tmp.fill_with_data(v)
|
236
242
|
a.push(tmp)
|
237
243
|
end
|
@@ -246,7 +252,7 @@ module ProcessOut
|
|
246
252
|
# Get the transactions belonging to the customer.
|
247
253
|
# Params:
|
248
254
|
# +options+:: +Hash+ of options
|
249
|
-
def transactions(options =
|
255
|
+
def transactions(options = {})
|
250
256
|
request = Request.new(@client)
|
251
257
|
path = "/customers/" + CGI.escape(@id) + "/transactions"
|
252
258
|
data = {
|
@@ -259,7 +265,7 @@ module ProcessOut
|
|
259
265
|
a = Array.new
|
260
266
|
body = response.body
|
261
267
|
for v in body['transactions']
|
262
|
-
tmp = Transaction(@client)
|
268
|
+
tmp = Transaction.new(@client)
|
263
269
|
tmp.fill_with_data(v)
|
264
270
|
a.push(tmp)
|
265
271
|
end
|
@@ -274,7 +280,7 @@ module ProcessOut
|
|
274
280
|
# Get all the customers.
|
275
281
|
# Params:
|
276
282
|
# +options+:: +Hash+ of options
|
277
|
-
def all(options =
|
283
|
+
def all(options = {})
|
278
284
|
request = Request.new(@client)
|
279
285
|
path = "/customers"
|
280
286
|
data = {
|
@@ -287,7 +293,7 @@ module ProcessOut
|
|
287
293
|
a = Array.new
|
288
294
|
body = response.body
|
289
295
|
for v in body['customers']
|
290
|
-
tmp = Customer(@client)
|
296
|
+
tmp = Customer.new(@client)
|
291
297
|
tmp.fill_with_data(v)
|
292
298
|
a.push(tmp)
|
293
299
|
end
|
@@ -302,7 +308,7 @@ module ProcessOut
|
|
302
308
|
# Create a new customer.
|
303
309
|
# Params:
|
304
310
|
# +options+:: +Hash+ of options
|
305
|
-
def create(options =
|
311
|
+
def create(options = {})
|
306
312
|
request = Request.new(@client)
|
307
313
|
path = "/customers"
|
308
314
|
data = {
|
@@ -338,7 +344,7 @@ module ProcessOut
|
|
338
344
|
# Params:
|
339
345
|
# +customer_id+:: ID of the customer
|
340
346
|
# +options+:: +Hash+ of options
|
341
|
-
def find(customer_id, options =
|
347
|
+
def find(customer_id, options = {})
|
342
348
|
request = Request.new(@client)
|
343
349
|
path = "/customers/" + CGI.escape(customer_id) + ""
|
344
350
|
data = {
|
@@ -363,7 +369,7 @@ module ProcessOut
|
|
363
369
|
# Save the updated customer attributes.
|
364
370
|
# Params:
|
365
371
|
# +options+:: +Hash+ of options
|
366
|
-
def save(options =
|
372
|
+
def save(options = {})
|
367
373
|
request = Request.new(@client)
|
368
374
|
path = "/customers/" + CGI.escape(@id) + ""
|
369
375
|
data = {
|
@@ -397,7 +403,7 @@ module ProcessOut
|
|
397
403
|
# Delete the customer.
|
398
404
|
# Params:
|
399
405
|
# +options+:: +Hash+ of options
|
400
|
-
def delete(options =
|
406
|
+
def delete(options = {})
|
401
407
|
request = Request.new(@client)
|
402
408
|
path = "/customers/" + CGI.escape(@id) + ""
|
403
409
|
data = {
|
@@ -23,14 +23,20 @@ module ProcessOut
|
|
23
23
|
# Initializes the CustomerAction object
|
24
24
|
# Params:
|
25
25
|
# +client+:: +ProcessOut+ client instance
|
26
|
-
|
26
|
+
# +data+:: data that can be used to fill the object
|
27
|
+
def initialize(client, data = {})
|
27
28
|
@client = client
|
28
29
|
|
29
|
-
@type = ""
|
30
|
-
@value = ""
|
30
|
+
@type = data.fetch(:type, "")
|
31
|
+
@value = data.fetch(:value, "")
|
31
32
|
|
32
33
|
end
|
33
34
|
|
35
|
+
# Create a new CustomerAction using the current client
|
36
|
+
def new(data = {})
|
37
|
+
CustomerAction.new(@client, data)
|
38
|
+
end
|
39
|
+
|
34
40
|
# Fills the object with data coming from the API
|
35
41
|
# Params:
|
36
42
|
# +data+:: +Hash+ of data coming from the API
|
data/lib/processout/discount.rb
CHANGED
@@ -79,21 +79,27 @@ module ProcessOut
|
|
79
79
|
# Initializes the Discount object
|
80
80
|
# Params:
|
81
81
|
# +client+:: +ProcessOut+ client instance
|
82
|
-
|
82
|
+
# +data+:: data that can be used to fill the object
|
83
|
+
def initialize(client, data = {})
|
83
84
|
@client = client
|
84
85
|
|
85
|
-
@id = ""
|
86
|
-
@project = nil
|
87
|
-
@subscription = nil
|
88
|
-
@coupon = nil
|
89
|
-
@amount = ""
|
90
|
-
@expires_at = ""
|
91
|
-
@metadata = Hash.new
|
92
|
-
@sandbox = false
|
93
|
-
@created_at = ""
|
86
|
+
@id = data.fetch(:id, "")
|
87
|
+
@project = data.fetch(:project, nil)
|
88
|
+
@subscription = data.fetch(:subscription, nil)
|
89
|
+
@coupon = data.fetch(:coupon, nil)
|
90
|
+
@amount = data.fetch(:amount, "")
|
91
|
+
@expires_at = data.fetch(:expires_at, "")
|
92
|
+
@metadata = data.fetch(:metadata, Hash.new)
|
93
|
+
@sandbox = data.fetch(:sandbox, false)
|
94
|
+
@created_at = data.fetch(:created_at, "")
|
94
95
|
|
95
96
|
end
|
96
97
|
|
98
|
+
# Create a new Discount using the current client
|
99
|
+
def new(data = {})
|
100
|
+
Discount.new(@client, data)
|
101
|
+
end
|
102
|
+
|
97
103
|
# Fills the object with data coming from the API
|
98
104
|
# Params:
|
99
105
|
# +data+:: +Hash+ of data coming from the API
|
@@ -133,7 +139,7 @@ module ProcessOut
|
|
133
139
|
# Params:
|
134
140
|
# +subscription_id+:: ID of the subscription
|
135
141
|
# +options+:: +Hash+ of options
|
136
|
-
def apply(subscription_id, options =
|
142
|
+
def apply(subscription_id, options = {})
|
137
143
|
request = Request.new(@client)
|
138
144
|
path = "/subscriptions/" + CGI.escape(subscription_id) + "/discounts"
|
139
145
|
data = {
|
@@ -161,7 +167,7 @@ module ProcessOut
|
|
161
167
|
# +subscription_id+:: ID of the subscription
|
162
168
|
# +coupon_id+:: ID of the coupon
|
163
169
|
# +options+:: +Hash+ of options
|
164
|
-
def apply_coupon(subscription_id, coupon_id, options =
|
170
|
+
def apply_coupon(subscription_id, coupon_id, options = {})
|
165
171
|
request = Request.new(@client)
|
166
172
|
path = "/subscriptions/" + CGI.escape(subscription_id) + "/discounts"
|
167
173
|
data = {
|
@@ -190,7 +196,7 @@ module ProcessOut
|
|
190
196
|
# +subscription_id+:: ID of the subscription
|
191
197
|
# +discount_id+:: ID of the discount
|
192
198
|
# +options+:: +Hash+ of options
|
193
|
-
def find(subscription_id, discount_id, options =
|
199
|
+
def find(subscription_id, discount_id, options = {})
|
194
200
|
request = Request.new(@client)
|
195
201
|
path = "/subscriptions/" + CGI.escape(subscription_id) + "/discounts/" + CGI.escape(discount_id) + ""
|
196
202
|
data = {
|
data/lib/processout/event.rb
CHANGED
@@ -51,18 +51,24 @@ module ProcessOut
|
|
51
51
|
# Initializes the Event object
|
52
52
|
# Params:
|
53
53
|
# +client+:: +ProcessOut+ client instance
|
54
|
-
|
54
|
+
# +data+:: data that can be used to fill the object
|
55
|
+
def initialize(client, data = {})
|
55
56
|
@client = client
|
56
57
|
|
57
|
-
@id = ""
|
58
|
-
@project = nil
|
59
|
-
@name = ""
|
60
|
-
@data = nil
|
61
|
-
@sandbox = false
|
62
|
-
@fired_at = ""
|
58
|
+
@id = data.fetch(:id, "")
|
59
|
+
@project = data.fetch(:project, nil)
|
60
|
+
@name = data.fetch(:name, "")
|
61
|
+
@data = data.fetch(:data, nil)
|
62
|
+
@sandbox = data.fetch(:sandbox, false)
|
63
|
+
@fired_at = data.fetch(:fired_at, "")
|
63
64
|
|
64
65
|
end
|
65
66
|
|
67
|
+
# Create a new Event using the current client
|
68
|
+
def new(data = {})
|
69
|
+
Event.new(@client, data)
|
70
|
+
end
|
71
|
+
|
66
72
|
# Fills the object with data coming from the API
|
67
73
|
# Params:
|
68
74
|
# +data+:: +Hash+ of data coming from the API
|
@@ -92,7 +98,7 @@ module ProcessOut
|
|
92
98
|
# Get all the webhooks of the event.
|
93
99
|
# Params:
|
94
100
|
# +options+:: +Hash+ of options
|
95
|
-
def webhooks(options =
|
101
|
+
def webhooks(options = {})
|
96
102
|
request = Request.new(@client)
|
97
103
|
path = "/events/" + CGI.escape(@id) + "/webhooks"
|
98
104
|
data = {
|
@@ -105,7 +111,7 @@ module ProcessOut
|
|
105
111
|
a = Array.new
|
106
112
|
body = response.body
|
107
113
|
for v in body['webhooks']
|
108
|
-
tmp = Webhook(@client)
|
114
|
+
tmp = Webhook.new(@client)
|
109
115
|
tmp.fill_with_data(v)
|
110
116
|
a.push(tmp)
|
111
117
|
end
|
@@ -120,7 +126,7 @@ module ProcessOut
|
|
120
126
|
# Get all the events.
|
121
127
|
# Params:
|
122
128
|
# +options+:: +Hash+ of options
|
123
|
-
def all(options =
|
129
|
+
def all(options = {})
|
124
130
|
request = Request.new(@client)
|
125
131
|
path = "/events"
|
126
132
|
data = {
|
@@ -133,7 +139,7 @@ module ProcessOut
|
|
133
139
|
a = Array.new
|
134
140
|
body = response.body
|
135
141
|
for v in body['events']
|
136
|
-
tmp = Event(@client)
|
142
|
+
tmp = Event.new(@client)
|
137
143
|
tmp.fill_with_data(v)
|
138
144
|
a.push(tmp)
|
139
145
|
end
|
@@ -149,7 +155,7 @@ module ProcessOut
|
|
149
155
|
# Params:
|
150
156
|
# +event_id+:: ID of the event
|
151
157
|
# +options+:: +Hash+ of options
|
152
|
-
def find(event_id, options =
|
158
|
+
def find(event_id, options = {})
|
153
159
|
request = Request.new(@client)
|
154
160
|
path = "/events/" + CGI.escape(event_id) + ""
|
155
161
|
data = {
|
data/lib/processout/gateway.rb
CHANGED
@@ -53,20 +53,26 @@ module ProcessOut
|
|
53
53
|
# Initializes the Gateway object
|
54
54
|
# Params:
|
55
55
|
# +client+:: +ProcessOut+ client instance
|
56
|
-
|
56
|
+
# +data+:: data that can be used to fill the object
|
57
|
+
def initialize(client, data = {})
|
57
58
|
@client = client
|
58
59
|
|
59
|
-
@id = ""
|
60
|
-
@name = ""
|
61
|
-
@display_name = ""
|
62
|
-
@logo_url = ""
|
63
|
-
@url = ""
|
64
|
-
@flows = Array.new
|
65
|
-
@tags = Array.new
|
66
|
-
@description = ""
|
60
|
+
@id = data.fetch(:id, "")
|
61
|
+
@name = data.fetch(:name, "")
|
62
|
+
@display_name = data.fetch(:display_name, "")
|
63
|
+
@logo_url = data.fetch(:logo_url, "")
|
64
|
+
@url = data.fetch(:url, "")
|
65
|
+
@flows = data.fetch(:flows, Array.new)
|
66
|
+
@tags = data.fetch(:tags, Array.new)
|
67
|
+
@description = data.fetch(:description, "")
|
67
68
|
|
68
69
|
end
|
69
70
|
|
71
|
+
# Create a new Gateway using the current client
|
72
|
+
def new(data = {})
|
73
|
+
Gateway.new(@client, data)
|
74
|
+
end
|
75
|
+
|
70
76
|
# Fills the object with data coming from the API
|
71
77
|
# Params:
|
72
78
|
# +data+:: +Hash+ of data coming from the API
|
@@ -52,17 +52,23 @@ module ProcessOut
|
|
52
52
|
# Initializes the GatewayConfiguration object
|
53
53
|
# Params:
|
54
54
|
# +client+:: +ProcessOut+ client instance
|
55
|
-
|
55
|
+
# +data+:: data that can be used to fill the object
|
56
|
+
def initialize(client, data = {})
|
56
57
|
@client = client
|
57
58
|
|
58
|
-
@id = ""
|
59
|
-
@project = nil
|
60
|
-
@gateway = nil
|
61
|
-
@enabled = false
|
62
|
-
@public_keys = Hash.new
|
59
|
+
@id = data.fetch(:id, "")
|
60
|
+
@project = data.fetch(:project, nil)
|
61
|
+
@gateway = data.fetch(:gateway, nil)
|
62
|
+
@enabled = data.fetch(:enabled, false)
|
63
|
+
@public_keys = data.fetch(:public_keys, Hash.new)
|
63
64
|
|
64
65
|
end
|
65
66
|
|
67
|
+
# Create a new GatewayConfiguration using the current client
|
68
|
+
def new(data = {})
|
69
|
+
GatewayConfiguration.new(@client, data)
|
70
|
+
end
|
71
|
+
|
66
72
|
# Fills the object with data coming from the API
|
67
73
|
# Params:
|
68
74
|
# +data+:: +Hash+ of data coming from the API
|
data/lib/processout/invoice.rb
CHANGED
@@ -121,28 +121,34 @@ module ProcessOut
|
|
121
121
|
# Initializes the Invoice object
|
122
122
|
# Params:
|
123
123
|
# +client+:: +ProcessOut+ client instance
|
124
|
-
|
124
|
+
# +data+:: data that can be used to fill the object
|
125
|
+
def initialize(client, data = {})
|
125
126
|
@client = client
|
126
127
|
|
127
|
-
@id = ""
|
128
|
-
@project = nil
|
129
|
-
@transaction = nil
|
130
|
-
@customer = nil
|
131
|
-
@subscription = nil
|
132
|
-
@url = ""
|
133
|
-
@name = ""
|
134
|
-
@amount = ""
|
135
|
-
@currency = ""
|
136
|
-
@metadata = Hash.new
|
137
|
-
@request_email = false
|
138
|
-
@request_shipping = false
|
139
|
-
@return_url = ""
|
140
|
-
@cancel_url = ""
|
141
|
-
@sandbox = false
|
142
|
-
@created_at = ""
|
128
|
+
@id = data.fetch(:id, "")
|
129
|
+
@project = data.fetch(:project, nil)
|
130
|
+
@transaction = data.fetch(:transaction, nil)
|
131
|
+
@customer = data.fetch(:customer, nil)
|
132
|
+
@subscription = data.fetch(:subscription, nil)
|
133
|
+
@url = data.fetch(:url, "")
|
134
|
+
@name = data.fetch(:name, "")
|
135
|
+
@amount = data.fetch(:amount, "")
|
136
|
+
@currency = data.fetch(:currency, "")
|
137
|
+
@metadata = data.fetch(:metadata, Hash.new)
|
138
|
+
@request_email = data.fetch(:request_email, false)
|
139
|
+
@request_shipping = data.fetch(:request_shipping, false)
|
140
|
+
@return_url = data.fetch(:return_url, "")
|
141
|
+
@cancel_url = data.fetch(:cancel_url, "")
|
142
|
+
@sandbox = data.fetch(:sandbox, false)
|
143
|
+
@created_at = data.fetch(:created_at, "")
|
143
144
|
|
144
145
|
end
|
145
146
|
|
147
|
+
# Create a new Invoice using the current client
|
148
|
+
def new(data = {})
|
149
|
+
Invoice.new(@client, data)
|
150
|
+
end
|
151
|
+
|
146
152
|
# Fills the object with data coming from the API
|
147
153
|
# Params:
|
148
154
|
# +data+:: +Hash+ of data coming from the API
|
@@ -203,7 +209,7 @@ module ProcessOut
|
|
203
209
|
# Params:
|
204
210
|
# +source+:: Source used to authorization the payment. Can be a card, a token or a gateway request
|
205
211
|
# +options+:: +Hash+ of options
|
206
|
-
def authorize(source, options =
|
212
|
+
def authorize(source, options = {})
|
207
213
|
request = Request.new(@client)
|
208
214
|
path = "/invoices/" + CGI.escape(@id) + "/authorize"
|
209
215
|
data = {
|
@@ -215,7 +221,7 @@ module ProcessOut
|
|
215
221
|
|
216
222
|
body = response.body
|
217
223
|
body = body["transaction"]
|
218
|
-
transaction = Transaction(
|
224
|
+
transaction = Transaction.new(@client)
|
219
225
|
return_values.push(transaction.fill_with_data(body))
|
220
226
|
|
221
227
|
|
@@ -226,7 +232,7 @@ module ProcessOut
|
|
226
232
|
# Params:
|
227
233
|
# +source+:: Source used to authorization the payment. Can be a card, a token or a gateway request
|
228
234
|
# +options+:: +Hash+ of options
|
229
|
-
def capture(source, options =
|
235
|
+
def capture(source, options = {})
|
230
236
|
request = Request.new(@client)
|
231
237
|
path = "/invoices/" + CGI.escape(@id) + "/capture"
|
232
238
|
data = {
|
@@ -238,7 +244,7 @@ module ProcessOut
|
|
238
244
|
|
239
245
|
body = response.body
|
240
246
|
body = body["transaction"]
|
241
|
-
transaction = Transaction(
|
247
|
+
transaction = Transaction.new(@client)
|
242
248
|
return_values.push(transaction.fill_with_data(body))
|
243
249
|
|
244
250
|
|
@@ -248,7 +254,7 @@ module ProcessOut
|
|
248
254
|
# Get the customer linked to the invoice.
|
249
255
|
# Params:
|
250
256
|
# +options+:: +Hash+ of options
|
251
|
-
def customer(options =
|
257
|
+
def customer(options = {})
|
252
258
|
request = Request.new(@client)
|
253
259
|
path = "/invoices/" + CGI.escape(@id) + "/customers"
|
254
260
|
data = {
|
@@ -260,7 +266,7 @@ module ProcessOut
|
|
260
266
|
|
261
267
|
body = response.body
|
262
268
|
body = body["customer"]
|
263
|
-
customer = Customer(
|
269
|
+
customer = Customer.new(@client)
|
264
270
|
return_values.push(customer.fill_with_data(body))
|
265
271
|
|
266
272
|
|
@@ -271,7 +277,7 @@ module ProcessOut
|
|
271
277
|
# Params:
|
272
278
|
# +customer_id+:: ID of the customer to be linked to the invoice
|
273
279
|
# +options+:: +Hash+ of options
|
274
|
-
def assign_customer(customer_id, options =
|
280
|
+
def assign_customer(customer_id, options = {})
|
275
281
|
request = Request.new(@client)
|
276
282
|
path = "/invoices/" + CGI.escape(@id) + "/customers"
|
277
283
|
data = {
|
@@ -283,7 +289,7 @@ module ProcessOut
|
|
283
289
|
|
284
290
|
body = response.body
|
285
291
|
body = body["customer"]
|
286
|
-
customer = Customer(
|
292
|
+
customer = Customer.new(@client)
|
287
293
|
return_values.push(customer.fill_with_data(body))
|
288
294
|
|
289
295
|
|
@@ -293,7 +299,7 @@ module ProcessOut
|
|
293
299
|
# Get the transaction of the invoice.
|
294
300
|
# Params:
|
295
301
|
# +options+:: +Hash+ of options
|
296
|
-
def transaction(options =
|
302
|
+
def transaction(options = {})
|
297
303
|
request = Request.new(@client)
|
298
304
|
path = "/invoices/" + CGI.escape(@id) + "/transactions"
|
299
305
|
data = {
|
@@ -305,7 +311,7 @@ module ProcessOut
|
|
305
311
|
|
306
312
|
body = response.body
|
307
313
|
body = body["transaction"]
|
308
|
-
transaction = Transaction(
|
314
|
+
transaction = Transaction.new(@client)
|
309
315
|
return_values.push(transaction.fill_with_data(body))
|
310
316
|
|
311
317
|
|
@@ -315,7 +321,7 @@ module ProcessOut
|
|
315
321
|
# Void the invoice
|
316
322
|
# Params:
|
317
323
|
# +options+:: +Hash+ of options
|
318
|
-
def void(options =
|
324
|
+
def void(options = {})
|
319
325
|
request = Request.new(@client)
|
320
326
|
path = "/invoices/" + CGI.escape(@id) + "/void"
|
321
327
|
data = {
|
@@ -327,7 +333,7 @@ module ProcessOut
|
|
327
333
|
|
328
334
|
body = response.body
|
329
335
|
body = body["transaction"]
|
330
|
-
transaction = Transaction(
|
336
|
+
transaction = Transaction.new(@client)
|
331
337
|
return_values.push(transaction.fill_with_data(body))
|
332
338
|
|
333
339
|
|
@@ -337,7 +343,7 @@ module ProcessOut
|
|
337
343
|
# Get all the invoices.
|
338
344
|
# Params:
|
339
345
|
# +options+:: +Hash+ of options
|
340
|
-
def all(options =
|
346
|
+
def all(options = {})
|
341
347
|
request = Request.new(@client)
|
342
348
|
path = "/invoices"
|
343
349
|
data = {
|
@@ -350,7 +356,7 @@ module ProcessOut
|
|
350
356
|
a = Array.new
|
351
357
|
body = response.body
|
352
358
|
for v in body['invoices']
|
353
|
-
tmp = Invoice(@client)
|
359
|
+
tmp = Invoice.new(@client)
|
354
360
|
tmp.fill_with_data(v)
|
355
361
|
a.push(tmp)
|
356
362
|
end
|
@@ -365,7 +371,7 @@ module ProcessOut
|
|
365
371
|
# Create a new invoice.
|
366
372
|
# Params:
|
367
373
|
# +options+:: +Hash+ of options
|
368
|
-
def create(options =
|
374
|
+
def create(options = {})
|
369
375
|
request = Request.new(@client)
|
370
376
|
path = "/invoices"
|
371
377
|
data = {
|
@@ -397,7 +403,7 @@ module ProcessOut
|
|
397
403
|
# Params:
|
398
404
|
# +customer_id+:: ID of the customer
|
399
405
|
# +options+:: +Hash+ of options
|
400
|
-
def create_for_customer(customer_id, options =
|
406
|
+
def create_for_customer(customer_id, options = {})
|
401
407
|
request = Request.new(@client)
|
402
408
|
path = "/invoices"
|
403
409
|
data = {
|
@@ -430,7 +436,7 @@ module ProcessOut
|
|
430
436
|
# Params:
|
431
437
|
# +invoice_id+:: ID of the invoice
|
432
438
|
# +options+:: +Hash+ of options
|
433
|
-
def find(invoice_id, options =
|
439
|
+
def find(invoice_id, options = {})
|
434
440
|
request = Request.new(@client)
|
435
441
|
path = "/invoices/" + CGI.escape(invoice_id) + ""
|
436
442
|
data = {
|