stripe 1.36.1 → 1.36.2
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/History.txt +4 -0
- data/VERSION +1 -1
- data/lib/stripe/account.rb +25 -18
- data/lib/stripe/api_operations/create.rb +1 -1
- data/lib/stripe/api_operations/delete.rb +1 -1
- data/lib/stripe/api_operations/list.rb +1 -1
- data/lib/stripe/api_operations/update.rb +9 -13
- data/lib/stripe/api_resource.rb +4 -4
- data/lib/stripe/application_fee.rb +1 -1
- data/lib/stripe/application_fee_refund.rb +2 -2
- data/lib/stripe/balance_transaction.rb +1 -1
- data/lib/stripe/bank_account.rb +4 -4
- data/lib/stripe/bitcoin_receiver.rb +4 -4
- data/lib/stripe/bitcoin_transaction.rb +1 -1
- data/lib/stripe/card.rb +4 -4
- data/lib/stripe/charge.rb +6 -6
- data/lib/stripe/country_spec.rb +1 -1
- data/lib/stripe/customer.rb +3 -3
- data/lib/stripe/dispute.rb +1 -1
- data/lib/stripe/file_upload.rb +1 -1
- data/lib/stripe/invoice.rb +2 -2
- data/lib/stripe/list_object.rb +6 -1
- data/lib/stripe/order.rb +1 -1
- data/lib/stripe/product.rb +0 -9
- data/lib/stripe/reversal.rb +2 -2
- data/lib/stripe/singleton_api_resource.rb +3 -3
- data/lib/stripe/stripe_object.rb +128 -63
- data/lib/stripe/subscription.rb +3 -3
- data/lib/stripe/transfer.rb +1 -1
- data/lib/stripe/version.rb +1 -1
- data/test/stripe/account_test.rb +8 -8
- data/test/stripe/api_resource_test.rb +1 -1
- data/test/stripe/country_spec_test.rb +7 -7
- data/test/stripe/customer_card_test.rb +2 -2
- data/test/stripe/list_object_test.rb +35 -12
- data/test/stripe/recipient_card_test.rb +2 -2
- data/test/stripe/stripe_object_test.rb +83 -11
- data/test/test_data.rb +23 -23
- metadata +2 -2
@@ -17,14 +17,14 @@ module Stripe
|
|
17
17
|
assert cards[0].kind_of? Stripe::Card
|
18
18
|
end
|
19
19
|
|
20
|
-
should "recipient cards should have the correct url" do
|
20
|
+
should "recipient cards should have the correct resource url" do
|
21
21
|
c = recipient
|
22
22
|
@mock.expects(:get).once.returns(make_response(make_card(
|
23
23
|
:id => 'test_card',
|
24
24
|
:recipient => 'test_recipient'
|
25
25
|
)))
|
26
26
|
card = c.cards.retrieve('card')
|
27
|
-
assert_equal RECIPIENT_CARD_URL, card.
|
27
|
+
assert_equal RECIPIENT_CARD_URL, card.resource_url
|
28
28
|
end
|
29
29
|
|
30
30
|
should "recipient cards should be deletable" do
|
@@ -121,20 +121,20 @@ module Stripe
|
|
121
121
|
|
122
122
|
should "#serialize_params on an empty object" do
|
123
123
|
obj = Stripe::StripeObject.construct_from({})
|
124
|
-
assert_equal({},
|
124
|
+
assert_equal({}, obj.serialize_params)
|
125
125
|
end
|
126
126
|
|
127
127
|
should "#serialize_params on a new object with a subobject" do
|
128
128
|
obj = Stripe::StripeObject.new
|
129
129
|
obj.metadata = { :foo => "bar" }
|
130
130
|
assert_equal({ :metadata => { :foo => "bar" } },
|
131
|
-
|
131
|
+
obj.serialize_params)
|
132
132
|
end
|
133
133
|
|
134
134
|
should "#serialize_params on a basic object" do
|
135
135
|
obj = Stripe::StripeObject.construct_from({ :foo => nil })
|
136
136
|
obj.update_attributes(:foo => "bar")
|
137
|
-
assert_equal({ :foo => "bar" },
|
137
|
+
assert_equal({ :foo => "bar" }, obj.serialize_params)
|
138
138
|
end
|
139
139
|
|
140
140
|
should "#serialize_params on a more complex object" do
|
@@ -146,7 +146,7 @@ module Stripe
|
|
146
146
|
})
|
147
147
|
obj.foo.bar = "newbar"
|
148
148
|
assert_equal({ :foo => { :bar => "newbar" } },
|
149
|
-
|
149
|
+
obj.serialize_params)
|
150
150
|
end
|
151
151
|
|
152
152
|
should "#serialize_params on an array" do
|
@@ -155,7 +155,7 @@ module Stripe
|
|
155
155
|
})
|
156
156
|
obj.foo = ["new-value"]
|
157
157
|
assert_equal({ :foo => ["new-value"] },
|
158
|
-
|
158
|
+
obj.serialize_params)
|
159
159
|
end
|
160
160
|
|
161
161
|
should "#serialize_params on an array that shortens" do
|
@@ -164,7 +164,7 @@ module Stripe
|
|
164
164
|
})
|
165
165
|
obj.foo = ["new-value"]
|
166
166
|
assert_equal({ :foo => ["new-value"] },
|
167
|
-
|
167
|
+
obj.serialize_params)
|
168
168
|
end
|
169
169
|
|
170
170
|
should "#serialize_params on an array that lengthens" do
|
@@ -173,7 +173,7 @@ module Stripe
|
|
173
173
|
})
|
174
174
|
obj.foo = ["new-value"] * 4
|
175
175
|
assert_equal({ :foo => ["new-value"] * 4 },
|
176
|
-
|
176
|
+
obj.serialize_params)
|
177
177
|
end
|
178
178
|
|
179
179
|
should "#serialize_params on an array of hashes" do
|
@@ -187,12 +187,12 @@ module Stripe
|
|
187
187
|
]
|
188
188
|
obj.foo[0].bar = "baz"
|
189
189
|
assert_equal({ :foo => [{ :bar => "baz" }] },
|
190
|
-
|
190
|
+
obj.serialize_params)
|
191
191
|
end
|
192
192
|
|
193
193
|
should "#serialize_params doesn't include unchanged values" do
|
194
194
|
obj = Stripe::StripeObject.construct_from({ :foo => nil })
|
195
|
-
assert_equal({},
|
195
|
+
assert_equal({}, obj.serialize_params)
|
196
196
|
end
|
197
197
|
|
198
198
|
should "#serialize_params on an array that is unchanged" do
|
@@ -200,7 +200,7 @@ module Stripe
|
|
200
200
|
:foo => ["0-index", "1-index", "2-index"],
|
201
201
|
})
|
202
202
|
obj.foo = ["0-index", "1-index", "2-index"]
|
203
|
-
assert_equal({},
|
203
|
+
assert_equal({}, obj.serialize_params)
|
204
204
|
end
|
205
205
|
|
206
206
|
should "#serialize_params with a StripeObject" do
|
@@ -211,8 +211,80 @@ module Stripe
|
|
211
211
|
obj.metadata =
|
212
212
|
Stripe::StripeObject.construct_from({ :foo => 'bar' })
|
213
213
|
|
214
|
-
serialized =
|
214
|
+
serialized = obj.serialize_params
|
215
215
|
assert_equal({ :foo => "bar" }, serialized[:metadata])
|
216
216
|
end
|
217
|
+
|
218
|
+
should "#serialize_params with a StripeObject that's been replaced" do
|
219
|
+
obj = Stripe::StripeObject.construct_from({
|
220
|
+
:metadata => Stripe::StripeObject.construct_from({ :bar => 'foo' })
|
221
|
+
})
|
222
|
+
|
223
|
+
# Here we replace the object wholesale which means that the client must
|
224
|
+
# be able to blank out the values that were in the old object, but which
|
225
|
+
# are no longer present in the new one.
|
226
|
+
obj.metadata =
|
227
|
+
Stripe::StripeObject.construct_from({ :baz => 'foo' })
|
228
|
+
|
229
|
+
serialized = obj.serialize_params
|
230
|
+
assert_equal({ :bar => "", :baz => 'foo' }, serialized[:metadata])
|
231
|
+
end
|
232
|
+
|
233
|
+
should "#serialize_params with an array of StripeObjects" do
|
234
|
+
obj = Stripe::StripeObject.construct_from({})
|
235
|
+
obj.metadata = [
|
236
|
+
Stripe::StripeObject.construct_from({ :foo => 'bar' })
|
237
|
+
]
|
238
|
+
|
239
|
+
serialized = obj.serialize_params
|
240
|
+
assert_equal([{ :foo => "bar" }], serialized[:metadata])
|
241
|
+
end
|
242
|
+
|
243
|
+
should "#serialize_params and remove embedded APIResources" do
|
244
|
+
obj = Stripe::StripeObject.construct_from({
|
245
|
+
:customer => Customer.construct_from({})
|
246
|
+
})
|
247
|
+
|
248
|
+
serialized = obj.serialize_params
|
249
|
+
assert_equal({}, serialized)
|
250
|
+
end
|
251
|
+
|
252
|
+
should "#serialize_params takes a force option" do
|
253
|
+
obj = Stripe::StripeObject.construct_from({
|
254
|
+
:id => 'id',
|
255
|
+
:metadata => Stripe::StripeObject.construct_from({ :foo => 'bar' })
|
256
|
+
})
|
257
|
+
|
258
|
+
serialized = obj.serialize_params(:force => true)
|
259
|
+
assert_equal({ :id => 'id', :metadata => { :foo => 'bar' } }, serialized)
|
260
|
+
end
|
261
|
+
|
262
|
+
should "#dirty! forces an object and its subobjects to be saved" do
|
263
|
+
obj = Stripe::StripeObject.construct_from({
|
264
|
+
:id => 'id',
|
265
|
+
:metadata => Stripe::StripeObject.construct_from({ :foo => 'bar' })
|
266
|
+
})
|
267
|
+
|
268
|
+
# note that `force` and `dirty!` are for different things, but are
|
269
|
+
# functionally equivalent
|
270
|
+
obj.dirty!
|
271
|
+
|
272
|
+
serialized = obj.serialize_params
|
273
|
+
assert_equal({ :id => 'id', :metadata => { :foo => 'bar' } }, serialized)
|
274
|
+
end
|
275
|
+
|
276
|
+
should "warn that .serialize_params is deprecated" do
|
277
|
+
old_stderr = $stderr
|
278
|
+
$stderr = StringIO.new
|
279
|
+
begin
|
280
|
+
obj = Stripe::StripeObject.construct_from({})
|
281
|
+
Stripe::StripeObject.serialize_params(obj)
|
282
|
+
message = "NOTE: Stripe::StripeObject.serialize_params is " +
|
283
|
+
"deprecated; use #serialize_params instead"
|
284
|
+
assert_match Regexp.new(message), $stderr.string
|
285
|
+
ensure
|
286
|
+
$stderr = old_stderr
|
287
|
+
end
|
288
|
+
end
|
217
289
|
end
|
218
290
|
end
|
data/test/test_data.rb
CHANGED
@@ -56,7 +56,7 @@ module Stripe
|
|
56
56
|
{
|
57
57
|
:data => [make_balance_transaction, make_balance_transaction, make_balance_transaction],
|
58
58
|
:object => "list",
|
59
|
-
:
|
59
|
+
:resource_url => "/v1/balance/history"
|
60
60
|
}
|
61
61
|
end
|
62
62
|
|
@@ -93,7 +93,7 @@ module Stripe
|
|
93
93
|
{
|
94
94
|
:data => [make_application_fee, make_application_fee, make_application_fee],
|
95
95
|
:object => 'list',
|
96
|
-
:
|
96
|
+
:resource_url => '/v1/application_fees'
|
97
97
|
}
|
98
98
|
end
|
99
99
|
|
@@ -101,7 +101,7 @@ module Stripe
|
|
101
101
|
{
|
102
102
|
:data => [make_application_fee_refund, make_application_fee_refund, make_application_fee_refund],
|
103
103
|
:object => 'list',
|
104
|
-
:
|
104
|
+
:resource_url => '/v1/application_fees/' + fee_id + '/refunds'
|
105
105
|
}
|
106
106
|
end
|
107
107
|
|
@@ -126,7 +126,7 @@ module Stripe
|
|
126
126
|
{
|
127
127
|
:data => [make_customer, make_customer, make_customer],
|
128
128
|
:object => 'list',
|
129
|
-
:
|
129
|
+
:resource_url => '/v1/customers'
|
130
130
|
}
|
131
131
|
end
|
132
132
|
|
@@ -160,7 +160,7 @@ module Stripe
|
|
160
160
|
{
|
161
161
|
:data => [make_charge, make_charge, make_charge],
|
162
162
|
:object => 'list',
|
163
|
-
:
|
163
|
+
:resource_url => '/v1/charges'
|
164
164
|
}
|
165
165
|
end
|
166
166
|
|
@@ -184,7 +184,7 @@ module Stripe
|
|
184
184
|
{
|
185
185
|
:data => [make_dispute, make_dispute, make_dispute],
|
186
186
|
:object => 'list',
|
187
|
-
:
|
187
|
+
:resource_url => '/v1/disputes'
|
188
188
|
}
|
189
189
|
end
|
190
190
|
|
@@ -192,7 +192,7 @@ module Stripe
|
|
192
192
|
{
|
193
193
|
:data => [make_card, make_card, make_card],
|
194
194
|
:object => 'list',
|
195
|
-
:
|
195
|
+
:resource_url => '/v1/recipients/' + recipient_id + '/cards'
|
196
196
|
}
|
197
197
|
end
|
198
198
|
|
@@ -200,7 +200,7 @@ module Stripe
|
|
200
200
|
{
|
201
201
|
:data => [make_card, make_card, make_card],
|
202
202
|
:object => 'list',
|
203
|
-
:
|
203
|
+
:resource_url => '/v1/customers/' + customer_id + '/sources'
|
204
204
|
}
|
205
205
|
end
|
206
206
|
|
@@ -235,7 +235,7 @@ module Stripe
|
|
235
235
|
:created => 1403047735,
|
236
236
|
:size => 4908,
|
237
237
|
:purpose => params[:purpose] || "dispute_evidence",
|
238
|
-
:
|
238
|
+
:resource_url => nil,
|
239
239
|
:type => nil,
|
240
240
|
}
|
241
241
|
end
|
@@ -244,7 +244,7 @@ module Stripe
|
|
244
244
|
{
|
245
245
|
:data => [make_file, make_file, make_file],
|
246
246
|
:object => 'list',
|
247
|
-
:
|
247
|
+
:resource_url => '/v1/files'
|
248
248
|
}
|
249
249
|
end
|
250
250
|
|
@@ -287,7 +287,7 @@ module Stripe
|
|
287
287
|
{
|
288
288
|
:data => [make_subscription, make_subscription, make_subscription],
|
289
289
|
:object => 'list',
|
290
|
-
:
|
290
|
+
:resource_url => '/v1/customers/' + customer_id + '/subscriptions'
|
291
291
|
}
|
292
292
|
end
|
293
293
|
|
@@ -297,7 +297,7 @@ module Stripe
|
|
297
297
|
{
|
298
298
|
:data => [make_refund(p), make_refund(p), make_refund(p)],
|
299
299
|
:object => 'list',
|
300
|
-
:
|
300
|
+
:resource_url => charge ? "/v1/charges/#{charge}/refunds" : '/v1/refunds'
|
301
301
|
}
|
302
302
|
end
|
303
303
|
|
@@ -305,7 +305,7 @@ module Stripe
|
|
305
305
|
{
|
306
306
|
:data => [make_reversal, make_reversal, make_reversal],
|
307
307
|
:object => 'list',
|
308
|
-
:
|
308
|
+
:resource_url => '/v1/transfers/' + transfer_id + '/reversals'
|
309
309
|
}
|
310
310
|
end
|
311
311
|
|
@@ -366,7 +366,7 @@ module Stripe
|
|
366
366
|
{
|
367
367
|
:data => [make_invoice],
|
368
368
|
:object => 'list',
|
369
|
-
:
|
369
|
+
:resource_url => '/v1/invoices?customer=test_customer'
|
370
370
|
}
|
371
371
|
end
|
372
372
|
|
@@ -396,7 +396,7 @@ module Stripe
|
|
396
396
|
{
|
397
397
|
:data => [make_recipient, make_recipient, make_recipient],
|
398
398
|
:object => 'list',
|
399
|
-
:
|
399
|
+
:resource_url => '/v1/recipients'
|
400
400
|
}
|
401
401
|
end
|
402
402
|
|
@@ -427,7 +427,7 @@ module Stripe
|
|
427
427
|
{
|
428
428
|
:data => [make_transfer, make_transfer, make_transfer],
|
429
429
|
:object => 'list',
|
430
|
-
:
|
430
|
+
:resource_url => '/v1/transfers'
|
431
431
|
}
|
432
432
|
end
|
433
433
|
|
@@ -466,7 +466,7 @@ module Stripe
|
|
466
466
|
{
|
467
467
|
:data => [make_bitcoin_receiver, make_bitcoin_receiver, make_bitcoin_receiver],
|
468
468
|
:object => 'list',
|
469
|
-
:
|
469
|
+
:resource_url => '/v1/bitcoin/receivers'
|
470
470
|
}
|
471
471
|
end
|
472
472
|
|
@@ -485,7 +485,7 @@ module Stripe
|
|
485
485
|
{
|
486
486
|
:data => [make_bitcoin_transaction, make_bitcoin_transaction, make_bitcoin_transaction],
|
487
487
|
:object => 'list',
|
488
|
-
:
|
488
|
+
:resource_url => "/v1/bitcoin/receivers/btcrcv_test_receiver/transactions"
|
489
489
|
}
|
490
490
|
end
|
491
491
|
|
@@ -567,7 +567,7 @@ module Stripe
|
|
567
567
|
def make_product_array
|
568
568
|
{
|
569
569
|
:object => "list",
|
570
|
-
:
|
570
|
+
:resource_url => "/v1/products",
|
571
571
|
:data => [
|
572
572
|
make_product,
|
573
573
|
make_product,
|
@@ -602,7 +602,7 @@ module Stripe
|
|
602
602
|
def make_sku_array(product_id, params={})
|
603
603
|
{
|
604
604
|
:object => "list",
|
605
|
-
:
|
605
|
+
:resource_url => "/v1/skus",
|
606
606
|
:data => [
|
607
607
|
make_sku(:product => product_id),
|
608
608
|
make_sku(:product => product_id),
|
@@ -656,7 +656,7 @@ module Stripe
|
|
656
656
|
def make_order_array(params={})
|
657
657
|
{
|
658
658
|
:object => "list",
|
659
|
-
:
|
659
|
+
:resource_url => "/v1/orders",
|
660
660
|
:data => [
|
661
661
|
make_order,
|
662
662
|
make_order,
|
@@ -675,7 +675,7 @@ module Stripe
|
|
675
675
|
def country_spec_array
|
676
676
|
{
|
677
677
|
:object => "list",
|
678
|
-
:
|
678
|
+
:resource_url => "/v1/country_specs",
|
679
679
|
:data => [
|
680
680
|
make_country_spec,
|
681
681
|
make_country_spec,
|
@@ -709,7 +709,7 @@ module Stripe
|
|
709
709
|
"tos_acceptance.ip"
|
710
710
|
],
|
711
711
|
:additional => [
|
712
|
-
"legal_entity.personal_id_number",
|
712
|
+
"legal_entity.personal_id_number",
|
713
713
|
"legal_entity.verification.document"
|
714
714
|
]
|
715
715
|
},
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stripe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.36.
|
4
|
+
version: 1.36.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ross Boucher
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-03-
|
12
|
+
date: 2016-03-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rest-client
|