processout 0.3.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +48 -5
- data/lib/processout/authorization_request.rb +1 -1
- data/lib/processout/customer.rb +25 -2
- data/lib/processout/discount.rb +1 -1
- data/lib/processout/invoice.rb +2 -2
- data/lib/processout/product.rb +1 -1
- data/lib/processout/refund.rb +1 -1
- data/lib/processout/subscription.rb +27 -4
- data/lib/processout/token.rb +16 -0
- data/lib/processout/transaction.rb +39 -16
- data/lib/processout/version.rb +1 -1
- metadata +1 -2
- data/deploy.sh +0 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 64f051c78f0efef9ae4a7d881164c33142f7f606
|
4
|
+
data.tar.gz: 1b9ea2d114b5ee4fa90517442caf2116b8dfcc3a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51a8d10746b9a8ee8acfa31ff3d576743cba8a4730ca0cb89b9a7a4addb31bfa309da64e59d75da656bedb51c471fcd19aafad3f49ff62222f2290a636960fd7
|
7
|
+
data.tar.gz: 2a11229cf6c532f45cef1f85f89b6d9069583877f47f9730ebd8246c549cb57e62c372ee6a58203e0527615221eca525ddbfa5277d2f3e4b9a949312284ab51b
|
data/.gitignore
CHANGED
@@ -1,9 +1,52 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
/_yardoc/
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
5
4
|
/coverage/
|
6
|
-
/
|
5
|
+
/InstalledFiles
|
7
6
|
/pkg/
|
8
7
|
/spec/reports/
|
8
|
+
/spec/examples.txt
|
9
|
+
/test/tmp/
|
10
|
+
/test/version_tmp/
|
9
11
|
/tmp/
|
12
|
+
|
13
|
+
# Used by dotenv library to load environment variables.
|
14
|
+
# .env
|
15
|
+
|
16
|
+
## Specific to RubyMotion:
|
17
|
+
.dat*
|
18
|
+
.repl_history
|
19
|
+
build/
|
20
|
+
*.bridgesupport
|
21
|
+
build-iPhoneOS/
|
22
|
+
build-iPhoneSimulator/
|
23
|
+
|
24
|
+
## Specific to RubyMotion (use of CocoaPods):
|
25
|
+
#
|
26
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
27
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
28
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
29
|
+
#
|
30
|
+
# vendor/Pods/
|
31
|
+
|
32
|
+
## Documentation cache and generated files:
|
33
|
+
/.yardoc/
|
34
|
+
/_yardoc/
|
35
|
+
/doc/
|
36
|
+
/rdoc/
|
37
|
+
|
38
|
+
## Environment normalization:
|
39
|
+
/.bundle/
|
40
|
+
/vendor/bundle
|
41
|
+
/lib/bundler/man/
|
42
|
+
|
43
|
+
# for a library or gem, you might want to ignore these files since the code is
|
44
|
+
# intended to run in multiple environments; otherwise, check them in:
|
45
|
+
# Gemfile.lock
|
46
|
+
# .ruby-version
|
47
|
+
# .ruby-gemset
|
48
|
+
|
49
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
50
|
+
.rvmrc
|
51
|
+
|
52
|
+
deploy.sh
|
@@ -174,7 +174,7 @@ module ProcessOut
|
|
174
174
|
# Get the customer linked to the authorization request.
|
175
175
|
# Params:
|
176
176
|
# +options+:: +Hash+ of options
|
177
|
-
def
|
177
|
+
def get_customer(options = {})
|
178
178
|
request = Request.new(@client)
|
179
179
|
path = "/authorization-requests/" + CGI.escape(@id) + "/customers"
|
180
180
|
data = {
|
data/lib/processout/customer.rb
CHANGED
@@ -196,7 +196,7 @@ module ProcessOut
|
|
196
196
|
# Get the subscriptions belonging to the customer.
|
197
197
|
# Params:
|
198
198
|
# +options+:: +Hash+ of options
|
199
|
-
def
|
199
|
+
def get_subscriptions(options = {})
|
200
200
|
request = Request.new(@client)
|
201
201
|
path = "/customers/" + CGI.escape(@id) + "/subscriptions"
|
202
202
|
data = {
|
@@ -224,7 +224,7 @@ module ProcessOut
|
|
224
224
|
# Get the customer's tokens.
|
225
225
|
# Params:
|
226
226
|
# +options+:: +Hash+ of options
|
227
|
-
def
|
227
|
+
def get_tokens(options = {})
|
228
228
|
request = Request.new(@client)
|
229
229
|
path = "/customers/" + CGI.escape(@id) + "/tokens"
|
230
230
|
data = {
|
@@ -246,6 +246,29 @@ module ProcessOut
|
|
246
246
|
|
247
247
|
|
248
248
|
|
249
|
+
return_values[0]
|
250
|
+
end
|
251
|
+
|
252
|
+
# Find a customer's token by its ID.
|
253
|
+
# Params:
|
254
|
+
# +token_id+:: ID of the token
|
255
|
+
# +options+:: +Hash+ of options
|
256
|
+
def find_token(token_id, options = {})
|
257
|
+
request = Request.new(@client)
|
258
|
+
path = "/customers/" + CGI.escape(@id) + "/tokens/" + CGI.escape(token_id) + ""
|
259
|
+
data = {
|
260
|
+
|
261
|
+
}
|
262
|
+
|
263
|
+
response = Response.new(request.get(path, data, options))
|
264
|
+
return_values = Array.new
|
265
|
+
|
266
|
+
body = response.body
|
267
|
+
body = body["token"]
|
268
|
+
token = Token.new(@client)
|
269
|
+
return_values.push(token.fill_with_data(body))
|
270
|
+
|
271
|
+
|
249
272
|
return_values[0]
|
250
273
|
end
|
251
274
|
|
data/lib/processout/discount.rb
CHANGED
@@ -193,7 +193,7 @@ module ProcessOut
|
|
193
193
|
|
194
194
|
# Find a subscription's discount by its ID.
|
195
195
|
# Params:
|
196
|
-
# +subscription_id+:: ID of the subscription
|
196
|
+
# +subscription_id+:: ID of the subscription on which the discount was applied
|
197
197
|
# +discount_id+:: ID of the discount
|
198
198
|
# +options+:: +Hash+ of options
|
199
199
|
def find(subscription_id, discount_id, options = {})
|
data/lib/processout/invoice.rb
CHANGED
@@ -254,7 +254,7 @@ module ProcessOut
|
|
254
254
|
# Get the customer linked to the invoice.
|
255
255
|
# Params:
|
256
256
|
# +options+:: +Hash+ of options
|
257
|
-
def
|
257
|
+
def get_customer(options = {})
|
258
258
|
request = Request.new(@client)
|
259
259
|
path = "/invoices/" + CGI.escape(@id) + "/customers"
|
260
260
|
data = {
|
@@ -299,7 +299,7 @@ module ProcessOut
|
|
299
299
|
# Get the transaction of the invoice.
|
300
300
|
# Params:
|
301
301
|
# +options+:: +Hash+ of options
|
302
|
-
def
|
302
|
+
def get_transaction(options = {})
|
303
303
|
request = Request.new(@client)
|
304
304
|
path = "/invoices/" + CGI.escape(@id) + "/transactions"
|
305
305
|
data = {
|
data/lib/processout/product.rb
CHANGED
@@ -160,7 +160,7 @@ module ProcessOut
|
|
160
160
|
# Create a new invoice from the product.
|
161
161
|
# Params:
|
162
162
|
# +options+:: +Hash+ of options
|
163
|
-
def
|
163
|
+
def create_invoice(options = {})
|
164
164
|
request = Request.new(@client)
|
165
165
|
path = "/products/" + CGI.escape(@id) + "/invoices"
|
166
166
|
data = {
|
data/lib/processout/refund.rb
CHANGED
@@ -114,7 +114,7 @@ module ProcessOut
|
|
114
114
|
|
115
115
|
# Find a transaction's refund by its ID.
|
116
116
|
# Params:
|
117
|
-
# +transaction_id+:: ID of the transaction
|
117
|
+
# +transaction_id+:: ID of the transaction on which the refund was applied
|
118
118
|
# +refund_id+:: ID of the refund
|
119
119
|
# +options+:: +Hash+ of options
|
120
120
|
def find(transaction_id, refund_id, options = {})
|
@@ -280,7 +280,7 @@ module ProcessOut
|
|
280
280
|
# Get the customer owning the subscription.
|
281
281
|
# Params:
|
282
282
|
# +options+:: +Hash+ of options
|
283
|
-
def
|
283
|
+
def get_customer(options = {})
|
284
284
|
request = Request.new(@client)
|
285
285
|
path = "/subscriptions/" + CGI.escape(@id) + "/customers"
|
286
286
|
data = {
|
@@ -302,7 +302,7 @@ module ProcessOut
|
|
302
302
|
# Get the discounts applied to the subscription.
|
303
303
|
# Params:
|
304
304
|
# +options+:: +Hash+ of options
|
305
|
-
def
|
305
|
+
def get_discounts(options = {})
|
306
306
|
request = Request.new(@client)
|
307
307
|
path = "/subscriptions/" + CGI.escape(@id) + "/discounts"
|
308
308
|
data = {
|
@@ -324,6 +324,29 @@ module ProcessOut
|
|
324
324
|
|
325
325
|
|
326
326
|
|
327
|
+
return_values[0]
|
328
|
+
end
|
329
|
+
|
330
|
+
# Find a subscription's discount by its ID.
|
331
|
+
# Params:
|
332
|
+
# +discount_id+:: ID of the discount
|
333
|
+
# +options+:: +Hash+ of options
|
334
|
+
def find_discount(discount_id, options = {})
|
335
|
+
request = Request.new(@client)
|
336
|
+
path = "/subscriptions/" + CGI.escape(@id) + "/discounts/" + CGI.escape(discount_id) + ""
|
337
|
+
data = {
|
338
|
+
|
339
|
+
}
|
340
|
+
|
341
|
+
response = Response.new(request.get(path, data, options))
|
342
|
+
return_values = Array.new
|
343
|
+
|
344
|
+
body = response.body
|
345
|
+
body = body["discount"]
|
346
|
+
discount = Discount.new(@client)
|
347
|
+
return_values.push(discount.fill_with_data(body))
|
348
|
+
|
349
|
+
|
327
350
|
return_values[0]
|
328
351
|
end
|
329
352
|
|
@@ -355,7 +378,7 @@ module ProcessOut
|
|
355
378
|
# Get the subscriptions past transactions.
|
356
379
|
# Params:
|
357
380
|
# +options+:: +Hash+ of options
|
358
|
-
def
|
381
|
+
def get_transactions(options = {})
|
359
382
|
request = Request.new(@client)
|
360
383
|
path = "/subscriptions/" + CGI.escape(@id) + "/transactions"
|
361
384
|
data = {
|
@@ -612,7 +635,7 @@ module ProcessOut
|
|
612
635
|
# +cancel_at+:: Cancellation date, in the form of a string
|
613
636
|
# +cancellation_reason+:: Cancellation reason
|
614
637
|
# +options+:: +Hash+ of options
|
615
|
-
def
|
638
|
+
def cancel_at_date(cancel_at, cancellation_reason, options = {})
|
616
639
|
request = Request.new(@client)
|
617
640
|
path = "/subscriptions/" + CGI.escape(@id) + ""
|
618
641
|
data = {
|
data/lib/processout/token.rb
CHANGED
@@ -9,6 +9,7 @@ module ProcessOut
|
|
9
9
|
|
10
10
|
attr_reader :id
|
11
11
|
attr_reader :customer
|
12
|
+
attr_reader :card
|
12
13
|
attr_reader :metadata
|
13
14
|
attr_reader :is_subscription_only
|
14
15
|
attr_reader :created_at
|
@@ -29,6 +30,17 @@ module ProcessOut
|
|
29
30
|
|
30
31
|
end
|
31
32
|
|
33
|
+
def card=(val)
|
34
|
+
if val.instance_of? Card
|
35
|
+
@card = val
|
36
|
+
else
|
37
|
+
obj = Card.new(@client)
|
38
|
+
obj.fill_with_data(val)
|
39
|
+
@card = obj
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
|
32
44
|
def metadata=(val)
|
33
45
|
@metadata = val
|
34
46
|
end
|
@@ -51,6 +63,7 @@ module ProcessOut
|
|
51
63
|
|
52
64
|
@id = data.fetch(:id, "")
|
53
65
|
@customer = data.fetch(:customer, nil)
|
66
|
+
@card = data.fetch(:card, nil)
|
54
67
|
@metadata = data.fetch(:metadata, Hash.new)
|
55
68
|
@is_subscription_only = data.fetch(:is_subscription_only, false)
|
56
69
|
@created_at = data.fetch(:created_at, "")
|
@@ -72,6 +85,9 @@ module ProcessOut
|
|
72
85
|
if data.include? "customer"
|
73
86
|
@customer = data["customer"]
|
74
87
|
end
|
88
|
+
if data.include? "card"
|
89
|
+
@card = data["card"]
|
90
|
+
end
|
75
91
|
if data.include? "metadata"
|
76
92
|
@metadata = data["metadata"]
|
77
93
|
end
|
@@ -9,8 +9,8 @@ module ProcessOut
|
|
9
9
|
|
10
10
|
attr_reader :id
|
11
11
|
attr_reader :project
|
12
|
-
attr_reader :subscription
|
13
12
|
attr_reader :customer
|
13
|
+
attr_reader :subscription
|
14
14
|
attr_reader :token
|
15
15
|
attr_reader :card
|
16
16
|
attr_reader :name
|
@@ -41,24 +41,24 @@ module ProcessOut
|
|
41
41
|
|
42
42
|
end
|
43
43
|
|
44
|
-
def
|
45
|
-
if val.instance_of?
|
46
|
-
@
|
44
|
+
def customer=(val)
|
45
|
+
if val.instance_of? Customer
|
46
|
+
@customer = val
|
47
47
|
else
|
48
|
-
obj =
|
48
|
+
obj = Customer.new(@client)
|
49
49
|
obj.fill_with_data(val)
|
50
|
-
@
|
50
|
+
@customer = obj
|
51
51
|
end
|
52
52
|
|
53
53
|
end
|
54
54
|
|
55
|
-
def
|
56
|
-
if val.instance_of?
|
57
|
-
@
|
55
|
+
def subscription=(val)
|
56
|
+
if val.instance_of? Subscription
|
57
|
+
@subscription = val
|
58
58
|
else
|
59
|
-
obj =
|
59
|
+
obj = Subscription.new(@client)
|
60
60
|
obj.fill_with_data(val)
|
61
|
-
@
|
61
|
+
@subscription = obj
|
62
62
|
end
|
63
63
|
|
64
64
|
end
|
@@ -139,8 +139,8 @@ module ProcessOut
|
|
139
139
|
|
140
140
|
@id = data.fetch(:id, "")
|
141
141
|
@project = data.fetch(:project, nil)
|
142
|
-
@subscription = data.fetch(:subscription, nil)
|
143
142
|
@customer = data.fetch(:customer, nil)
|
143
|
+
@subscription = data.fetch(:subscription, nil)
|
144
144
|
@token = data.fetch(:token, nil)
|
145
145
|
@card = data.fetch(:card, nil)
|
146
146
|
@name = data.fetch(:name, "")
|
@@ -172,12 +172,12 @@ module ProcessOut
|
|
172
172
|
if data.include? "project"
|
173
173
|
@project = data["project"]
|
174
174
|
end
|
175
|
-
if data.include? "subscription"
|
176
|
-
@subscription = data["subscription"]
|
177
|
-
end
|
178
175
|
if data.include? "customer"
|
179
176
|
@customer = data["customer"]
|
180
177
|
end
|
178
|
+
if data.include? "subscription"
|
179
|
+
@subscription = data["subscription"]
|
180
|
+
end
|
181
181
|
if data.include? "token"
|
182
182
|
@token = data["token"]
|
183
183
|
end
|
@@ -224,7 +224,7 @@ module ProcessOut
|
|
224
224
|
# Get the transaction's refunds.
|
225
225
|
# Params:
|
226
226
|
# +options+:: +Hash+ of options
|
227
|
-
def
|
227
|
+
def get_refunds(options = {})
|
228
228
|
request = Request.new(@client)
|
229
229
|
path = "/transactions/" + CGI.escape(@id) + "/refunds"
|
230
230
|
data = {
|
@@ -246,6 +246,29 @@ module ProcessOut
|
|
246
246
|
|
247
247
|
|
248
248
|
|
249
|
+
return_values[0]
|
250
|
+
end
|
251
|
+
|
252
|
+
# Find a transaction's refund by its ID.
|
253
|
+
# Params:
|
254
|
+
# +refund_id+:: ID of the refund
|
255
|
+
# +options+:: +Hash+ of options
|
256
|
+
def find_refund(refund_id, options = {})
|
257
|
+
request = Request.new(@client)
|
258
|
+
path = "/transactions/" + CGI.escape(@id) + "/refunds/" + CGI.escape(refund_id) + ""
|
259
|
+
data = {
|
260
|
+
|
261
|
+
}
|
262
|
+
|
263
|
+
response = Response.new(request.get(path, data, options))
|
264
|
+
return_values = Array.new
|
265
|
+
|
266
|
+
body = response.body
|
267
|
+
body = body["refund"]
|
268
|
+
refund = Refund.new(@client)
|
269
|
+
return_values.push(refund.fill_with_data(body))
|
270
|
+
|
271
|
+
|
249
272
|
return_values[0]
|
250
273
|
end
|
251
274
|
|
data/lib/processout/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: processout
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Manuel HUEZ
|
@@ -68,7 +68,6 @@ files:
|
|
68
68
|
- Rakefile
|
69
69
|
- bin/console
|
70
70
|
- bin/setup
|
71
|
-
- deploy.sh
|
72
71
|
- lib/processout.rb
|
73
72
|
- lib/processout/activity.rb
|
74
73
|
- lib/processout/authorization_request.rb
|
data/deploy.sh
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
#! /bin/sh
|
2
|
-
|
3
|
-
echo " > Moving away generated library"
|
4
|
-
rm -rf ../.tmp
|
5
|
-
mkdir ../.tmp
|
6
|
-
mv {*,.[!.]*} ../.tmp/
|
7
|
-
echo " > Initializing git repository"
|
8
|
-
git init
|
9
|
-
git remote add origin git@github.com:processout/processout-ruby.git
|
10
|
-
echo " > Pulling from repository"
|
11
|
-
git fetch
|
12
|
-
git pull origin master
|
13
|
-
echo " > Removing everything from previous versions"
|
14
|
-
git rm -rf .
|
15
|
-
echo " > Adding back our new library"
|
16
|
-
mv ../.tmp/{*,.[!.]*} .
|
17
|
-
rm -rf ../tmp
|
18
|
-
echo " > Committing new library"
|
19
|
-
git add -A
|
20
|
-
git commit -m "$COMMITMESSAGE"
|
21
|
-
git tag -f "0.3.0"
|
22
|
-
echo " > Publishing the new version to github"
|
23
|
-
git push origin master --tags
|
24
|
-
|
25
|
-
echo " > Publishing to Rubygems"
|
26
|
-
gem build processout.gemspec
|
27
|
-
gem push processout-0.3.0.gem
|
28
|
-
|
29
|
-
|
30
|
-
echo " >> Done!"
|