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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '09e89e66eefe70d037c72679ce4a786c88d04303'
|
4
|
+
data.tar.gz: 3e02f2b6e5659fe95c447bc0d10c37275d2222cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '077212811648bc7cc2d0041a49c844ba2c0d9c0766843d37de186734297f33310a431baa5fa04daaf8175c5dac38076d4bd11d77e1e5aac43a5a50b510a23c7c'
|
7
|
+
data.tar.gz: 2d0547d44498dc773cf548dbb6009364868a411bfea37b0983571f1940ec28931ad04dcd20e2358cac0f4c2e53bae564dcdd8540d8877e7b79cd7c0924a5a9c9
|
data/deploy.sh
CHANGED
@@ -18,13 +18,13 @@ rm -rf ../tmp
|
|
18
18
|
echo " > Committing new library"
|
19
19
|
git add -A
|
20
20
|
git commit -m "$COMMITMESSAGE"
|
21
|
-
git tag -f "0.
|
21
|
+
git tag -f "0.3.0"
|
22
22
|
echo " > Publishing the new version to github"
|
23
23
|
git push origin master --tags
|
24
24
|
|
25
25
|
echo " > Publishing to Rubygems"
|
26
26
|
gem build processout.gemspec
|
27
|
-
gem push processout-0.
|
27
|
+
gem push processout-0.3.0.gem
|
28
28
|
|
29
29
|
|
30
30
|
echo " >> Done!"
|
data/lib/processout.rb
CHANGED
@@ -31,98 +31,98 @@ module ProcessOut
|
|
31
31
|
end
|
32
32
|
|
33
33
|
# Create a new Activity instance
|
34
|
-
def
|
35
|
-
Activity.new(self)
|
34
|
+
def activity(data = {})
|
35
|
+
obj = Activity.new(self, data)
|
36
36
|
end
|
37
37
|
|
38
38
|
# Create a new AuthorizationRequest instance
|
39
|
-
def
|
40
|
-
AuthorizationRequest.new(self)
|
39
|
+
def authorization_request(data = {})
|
40
|
+
obj = AuthorizationRequest.new(self, data)
|
41
41
|
end
|
42
42
|
|
43
43
|
# Create a new Card instance
|
44
|
-
def
|
45
|
-
Card.new(self)
|
44
|
+
def card(data = {})
|
45
|
+
obj = Card.new(self, data)
|
46
46
|
end
|
47
47
|
|
48
48
|
# Create a new Coupon instance
|
49
|
-
def
|
50
|
-
Coupon.new(self)
|
49
|
+
def coupon(data = {})
|
50
|
+
obj = Coupon.new(self, data)
|
51
51
|
end
|
52
52
|
|
53
53
|
# Create a new Customer instance
|
54
|
-
def
|
55
|
-
Customer.new(self)
|
54
|
+
def customer(data = {})
|
55
|
+
obj = Customer.new(self, data)
|
56
56
|
end
|
57
57
|
|
58
58
|
# Create a new Token instance
|
59
|
-
def
|
60
|
-
Token.new(self)
|
59
|
+
def token(data = {})
|
60
|
+
obj = Token.new(self, data)
|
61
61
|
end
|
62
62
|
|
63
63
|
# Create a new Discount instance
|
64
|
-
def
|
65
|
-
Discount.new(self)
|
64
|
+
def discount(data = {})
|
65
|
+
obj = Discount.new(self, data)
|
66
66
|
end
|
67
67
|
|
68
68
|
# Create a new Event instance
|
69
|
-
def
|
70
|
-
Event.new(self)
|
69
|
+
def event(data = {})
|
70
|
+
obj = Event.new(self, data)
|
71
71
|
end
|
72
72
|
|
73
73
|
# Create a new Gateway instance
|
74
|
-
def
|
75
|
-
Gateway.new(self)
|
74
|
+
def gateway(data = {})
|
75
|
+
obj = Gateway.new(self, data)
|
76
76
|
end
|
77
77
|
|
78
78
|
# Create a new GatewayConfiguration instance
|
79
|
-
def
|
80
|
-
GatewayConfiguration.new(self)
|
79
|
+
def gateway_configuration(data = {})
|
80
|
+
obj = GatewayConfiguration.new(self, data)
|
81
81
|
end
|
82
82
|
|
83
83
|
# Create a new Invoice instance
|
84
|
-
def
|
85
|
-
Invoice.new(self)
|
84
|
+
def invoice(data = {})
|
85
|
+
obj = Invoice.new(self, data)
|
86
86
|
end
|
87
87
|
|
88
88
|
# Create a new CustomerAction instance
|
89
|
-
def
|
90
|
-
CustomerAction.new(self)
|
89
|
+
def customer_action(data = {})
|
90
|
+
obj = CustomerAction.new(self, data)
|
91
91
|
end
|
92
92
|
|
93
93
|
# Create a new Plan instance
|
94
|
-
def
|
95
|
-
Plan.new(self)
|
94
|
+
def plan(data = {})
|
95
|
+
obj = Plan.new(self, data)
|
96
96
|
end
|
97
97
|
|
98
98
|
# Create a new Product instance
|
99
|
-
def
|
100
|
-
Product.new(self)
|
99
|
+
def product(data = {})
|
100
|
+
obj = Product.new(self, data)
|
101
101
|
end
|
102
102
|
|
103
103
|
# Create a new Project instance
|
104
|
-
def
|
105
|
-
Project.new(self)
|
104
|
+
def project(data = {})
|
105
|
+
obj = Project.new(self, data)
|
106
106
|
end
|
107
107
|
|
108
108
|
# Create a new Refund instance
|
109
|
-
def
|
110
|
-
Refund.new(self)
|
109
|
+
def refund(data = {})
|
110
|
+
obj = Refund.new(self, data)
|
111
111
|
end
|
112
112
|
|
113
113
|
# Create a new Subscription instance
|
114
|
-
def
|
115
|
-
Subscription.new(self)
|
114
|
+
def subscription(data = {})
|
115
|
+
obj = Subscription.new(self, data)
|
116
116
|
end
|
117
117
|
|
118
118
|
# Create a new Transaction instance
|
119
|
-
def
|
120
|
-
Transaction.new(self)
|
119
|
+
def transaction(data = {})
|
120
|
+
obj = Transaction.new(self, data)
|
121
121
|
end
|
122
122
|
|
123
123
|
# Create a new Webhook instance
|
124
|
-
def
|
125
|
-
Webhook.new(self)
|
124
|
+
def webhook(data = {})
|
125
|
+
obj = Webhook.new(self, data)
|
126
126
|
end
|
127
127
|
|
128
128
|
|
data/lib/processout/activity.rb
CHANGED
@@ -50,18 +50,24 @@ module ProcessOut
|
|
50
50
|
# Initializes the Activity object
|
51
51
|
# Params:
|
52
52
|
# +client+:: +ProcessOut+ client instance
|
53
|
-
|
53
|
+
# +data+:: data that can be used to fill the object
|
54
|
+
def initialize(client, data = {})
|
54
55
|
@client = client
|
55
56
|
|
56
|
-
@id = ""
|
57
|
-
@project = nil
|
58
|
-
@title = ""
|
59
|
-
@content = ""
|
60
|
-
@level = 0
|
61
|
-
@created_at = ""
|
57
|
+
@id = data.fetch(:id, "")
|
58
|
+
@project = data.fetch(:project, nil)
|
59
|
+
@title = data.fetch(:title, "")
|
60
|
+
@content = data.fetch(:content, "")
|
61
|
+
@level = data.fetch(:level, 0)
|
62
|
+
@created_at = data.fetch(:created_at, "")
|
62
63
|
|
63
64
|
end
|
64
65
|
|
66
|
+
# Create a new Activity using the current client
|
67
|
+
def new(data = {})
|
68
|
+
Activity.new(@client, data)
|
69
|
+
end
|
70
|
+
|
65
71
|
# Fills the object with data coming from the API
|
66
72
|
# Params:
|
67
73
|
# +data+:: +Hash+ of data coming from the API
|
@@ -91,7 +97,7 @@ module ProcessOut
|
|
91
97
|
# Get all the project activities.
|
92
98
|
# Params:
|
93
99
|
# +options+:: +Hash+ of options
|
94
|
-
def all(options =
|
100
|
+
def all(options = {})
|
95
101
|
request = Request.new(@client)
|
96
102
|
path = "/activities"
|
97
103
|
data = {
|
@@ -104,7 +110,7 @@ module ProcessOut
|
|
104
110
|
a = Array.new
|
105
111
|
body = response.body
|
106
112
|
for v in body['activities']
|
107
|
-
tmp = Activity(@client)
|
113
|
+
tmp = Activity.new(@client)
|
108
114
|
tmp.fill_with_data(v)
|
109
115
|
a.push(tmp)
|
110
116
|
end
|
@@ -120,7 +126,7 @@ module ProcessOut
|
|
120
126
|
# Params:
|
121
127
|
# +activity_id+:: ID of the activity
|
122
128
|
# +options+:: +Hash+ of options
|
123
|
-
def find(activity_id, options =
|
129
|
+
def find(activity_id, options = {})
|
124
130
|
request = Request.new(@client)
|
125
131
|
path = "/activities/" + CGI.escape(activity_id) + ""
|
126
132
|
data = {
|
@@ -99,25 +99,31 @@ module ProcessOut
|
|
99
99
|
# Initializes the AuthorizationRequest object
|
100
100
|
# Params:
|
101
101
|
# +client+:: +ProcessOut+ client instance
|
102
|
-
|
102
|
+
# +data+:: data that can be used to fill the object
|
103
|
+
def initialize(client, data = {})
|
103
104
|
@client = client
|
104
105
|
|
105
|
-
@id = ""
|
106
|
-
@project = nil
|
107
|
-
@customer = nil
|
108
|
-
@token = nil
|
109
|
-
@url = ""
|
110
|
-
@authorized = false
|
111
|
-
@name = ""
|
112
|
-
@currency = ""
|
113
|
-
@return_url = ""
|
114
|
-
@cancel_url = ""
|
115
|
-
@custom = ""
|
116
|
-
@sandbox = false
|
117
|
-
@created_at = ""
|
106
|
+
@id = data.fetch(:id, "")
|
107
|
+
@project = data.fetch(:project, nil)
|
108
|
+
@customer = data.fetch(:customer, nil)
|
109
|
+
@token = data.fetch(:token, nil)
|
110
|
+
@url = data.fetch(:url, "")
|
111
|
+
@authorized = data.fetch(:authorized, false)
|
112
|
+
@name = data.fetch(:name, "")
|
113
|
+
@currency = data.fetch(:currency, "")
|
114
|
+
@return_url = data.fetch(:return_url, "")
|
115
|
+
@cancel_url = data.fetch(:cancel_url, "")
|
116
|
+
@custom = data.fetch(:custom, "")
|
117
|
+
@sandbox = data.fetch(:sandbox, false)
|
118
|
+
@created_at = data.fetch(:created_at, "")
|
118
119
|
|
119
120
|
end
|
120
121
|
|
122
|
+
# Create a new AuthorizationRequest using the current client
|
123
|
+
def new(data = {})
|
124
|
+
AuthorizationRequest.new(@client, data)
|
125
|
+
end
|
126
|
+
|
121
127
|
# Fills the object with data coming from the API
|
122
128
|
# Params:
|
123
129
|
# +data+:: +Hash+ of data coming from the API
|
@@ -168,7 +174,7 @@ module ProcessOut
|
|
168
174
|
# Get the customer linked to the authorization request.
|
169
175
|
# Params:
|
170
176
|
# +options+:: +Hash+ of options
|
171
|
-
def customer(options =
|
177
|
+
def customer(options = {})
|
172
178
|
request = Request.new(@client)
|
173
179
|
path = "/authorization-requests/" + CGI.escape(@id) + "/customers"
|
174
180
|
data = {
|
@@ -180,7 +186,7 @@ module ProcessOut
|
|
180
186
|
|
181
187
|
body = response.body
|
182
188
|
body = body["customer"]
|
183
|
-
customer = Customer(
|
189
|
+
customer = Customer.new(@client)
|
184
190
|
return_values.push(customer.fill_with_data(body))
|
185
191
|
|
186
192
|
|
@@ -191,7 +197,7 @@ module ProcessOut
|
|
191
197
|
# Params:
|
192
198
|
# +customer_id+:: ID of the customer
|
193
199
|
# +options+:: +Hash+ of options
|
194
|
-
def create(customer_id, options =
|
200
|
+
def create(customer_id, options = {})
|
195
201
|
request = Request.new(@client)
|
196
202
|
path = "/authorization-requests"
|
197
203
|
data = {
|
@@ -221,7 +227,7 @@ module ProcessOut
|
|
221
227
|
# Params:
|
222
228
|
# +authorization_request_id+:: ID of the authorization request
|
223
229
|
# +options+:: +Hash+ of options
|
224
|
-
def find(authorization_request_id, options =
|
230
|
+
def find(authorization_request_id, options = {})
|
225
231
|
request = Request.new(@client)
|
226
232
|
path = "/authorization-requests/" + CGI.escape(authorization_request_id) + ""
|
227
233
|
data = {
|
data/lib/processout/card.rb
CHANGED
@@ -85,25 +85,31 @@ module ProcessOut
|
|
85
85
|
# Initializes the Card object
|
86
86
|
# Params:
|
87
87
|
# +client+:: +ProcessOut+ client instance
|
88
|
-
|
88
|
+
# +data+:: data that can be used to fill the object
|
89
|
+
def initialize(client, data = {})
|
89
90
|
@client = client
|
90
91
|
|
91
|
-
@id = ""
|
92
|
-
@project = nil
|
93
|
-
@brand = ""
|
94
|
-
@type = ""
|
95
|
-
@bank_name = ""
|
96
|
-
@level = ""
|
97
|
-
@iin = ""
|
98
|
-
@last_4_digits = ""
|
99
|
-
@exp_month = 0
|
100
|
-
@exp_year = 0
|
101
|
-
@metadata = Hash.new
|
102
|
-
@sandbox = false
|
103
|
-
@created_at = ""
|
92
|
+
@id = data.fetch(:id, "")
|
93
|
+
@project = data.fetch(:project, nil)
|
94
|
+
@brand = data.fetch(:brand, "")
|
95
|
+
@type = data.fetch(:type, "")
|
96
|
+
@bank_name = data.fetch(:bank_name, "")
|
97
|
+
@level = data.fetch(:level, "")
|
98
|
+
@iin = data.fetch(:iin, "")
|
99
|
+
@last_4_digits = data.fetch(:last_4_digits, "")
|
100
|
+
@exp_month = data.fetch(:exp_month, 0)
|
101
|
+
@exp_year = data.fetch(:exp_year, 0)
|
102
|
+
@metadata = data.fetch(:metadata, Hash.new)
|
103
|
+
@sandbox = data.fetch(:sandbox, false)
|
104
|
+
@created_at = data.fetch(:created_at, "")
|
104
105
|
|
105
106
|
end
|
106
107
|
|
108
|
+
# Create a new Card using the current client
|
109
|
+
def new(data = {})
|
110
|
+
Card.new(@client, data)
|
111
|
+
end
|
112
|
+
|
107
113
|
# Fills the object with data coming from the API
|
108
114
|
# Params:
|
109
115
|
# +data+:: +Hash+ of data coming from the API
|
data/lib/processout/coupon.rb
CHANGED
@@ -85,25 +85,31 @@ module ProcessOut
|
|
85
85
|
# Initializes the Coupon object
|
86
86
|
# Params:
|
87
87
|
# +client+:: +ProcessOut+ client instance
|
88
|
-
|
88
|
+
# +data+:: data that can be used to fill the object
|
89
|
+
def initialize(client, data = {})
|
89
90
|
@client = client
|
90
91
|
|
91
|
-
@id = ""
|
92
|
-
@project = nil
|
93
|
-
@name = ""
|
94
|
-
@amount_off = ""
|
95
|
-
@percent_off = 0
|
96
|
-
@currency = ""
|
97
|
-
@max_redemptions = 0
|
98
|
-
@expires_at = ""
|
99
|
-
@metadata = Hash.new
|
100
|
-
@iteration_count = 0
|
101
|
-
@redeemed_number = 0
|
102
|
-
@sandbox = false
|
103
|
-
@created_at = ""
|
92
|
+
@id = data.fetch(:id, "")
|
93
|
+
@project = data.fetch(:project, nil)
|
94
|
+
@name = data.fetch(:name, "")
|
95
|
+
@amount_off = data.fetch(:amount_off, "")
|
96
|
+
@percent_off = data.fetch(:percent_off, 0)
|
97
|
+
@currency = data.fetch(:currency, "")
|
98
|
+
@max_redemptions = data.fetch(:max_redemptions, 0)
|
99
|
+
@expires_at = data.fetch(:expires_at, "")
|
100
|
+
@metadata = data.fetch(:metadata, Hash.new)
|
101
|
+
@iteration_count = data.fetch(:iteration_count, 0)
|
102
|
+
@redeemed_number = data.fetch(:redeemed_number, 0)
|
103
|
+
@sandbox = data.fetch(:sandbox, false)
|
104
|
+
@created_at = data.fetch(:created_at, "")
|
104
105
|
|
105
106
|
end
|
106
107
|
|
108
|
+
# Create a new Coupon using the current client
|
109
|
+
def new(data = {})
|
110
|
+
Coupon.new(@client, data)
|
111
|
+
end
|
112
|
+
|
107
113
|
# Fills the object with data coming from the API
|
108
114
|
# Params:
|
109
115
|
# +data+:: +Hash+ of data coming from the API
|
@@ -154,7 +160,7 @@ module ProcessOut
|
|
154
160
|
# Get all the coupons.
|
155
161
|
# Params:
|
156
162
|
# +options+:: +Hash+ of options
|
157
|
-
def all(options =
|
163
|
+
def all(options = {})
|
158
164
|
request = Request.new(@client)
|
159
165
|
path = "/coupons"
|
160
166
|
data = {
|
@@ -167,7 +173,7 @@ module ProcessOut
|
|
167
173
|
a = Array.new
|
168
174
|
body = response.body
|
169
175
|
for v in body['coupons']
|
170
|
-
tmp = Coupon(@client)
|
176
|
+
tmp = Coupon.new(@client)
|
171
177
|
tmp.fill_with_data(v)
|
172
178
|
a.push(tmp)
|
173
179
|
end
|
@@ -182,7 +188,7 @@ module ProcessOut
|
|
182
188
|
# Create a new coupon.
|
183
189
|
# Params:
|
184
190
|
# +options+:: +Hash+ of options
|
185
|
-
def create(options =
|
191
|
+
def create(options = {})
|
186
192
|
request = Request.new(@client)
|
187
193
|
path = "/coupons"
|
188
194
|
data = {
|
@@ -214,7 +220,7 @@ module ProcessOut
|
|
214
220
|
# Params:
|
215
221
|
# +coupon_id+:: ID of the coupon
|
216
222
|
# +options+:: +Hash+ of options
|
217
|
-
def find(coupon_id, options =
|
223
|
+
def find(coupon_id, options = {})
|
218
224
|
request = Request.new(@client)
|
219
225
|
path = "/coupons/" + CGI.escape(coupon_id) + ""
|
220
226
|
data = {
|
@@ -239,7 +245,7 @@ module ProcessOut
|
|
239
245
|
# Save the updated coupon attributes.
|
240
246
|
# Params:
|
241
247
|
# +options+:: +Hash+ of options
|
242
|
-
def save(options =
|
248
|
+
def save(options = {})
|
243
249
|
request = Request.new(@client)
|
244
250
|
path = "/coupons/" + CGI.escape(@id) + ""
|
245
251
|
data = {
|
@@ -263,7 +269,7 @@ module ProcessOut
|
|
263
269
|
# Delete the coupon.
|
264
270
|
# Params:
|
265
271
|
# +options+:: +Hash+ of options
|
266
|
-
def delete(options =
|
272
|
+
def delete(options = {})
|
267
273
|
request = Request.new(@client)
|
268
274
|
path = "/coupons/" + CGI.escape(@id) + ""
|
269
275
|
data = {
|