stripe 1.31.0 → 1.58.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.
Files changed (103) hide show
  1. checksums.yaml +4 -4
  2. data/.github/ISSUE_TEMPLATE.md +5 -0
  3. data/.travis.yml +2 -12
  4. data/Gemfile +29 -4
  5. data/History.txt +168 -0
  6. data/README.md +134 -0
  7. data/Rakefile +10 -0
  8. data/VERSION +1 -1
  9. data/bin/stripe-console +12 -5
  10. data/lib/data/ca-certificates.crt +3868 -5114
  11. data/lib/stripe/account.rb +41 -21
  12. data/lib/stripe/alipay_account.rb +20 -0
  13. data/lib/stripe/api_operations/create.rb +1 -1
  14. data/lib/stripe/api_operations/delete.rb +1 -1
  15. data/lib/stripe/api_operations/list.rb +1 -2
  16. data/lib/stripe/api_operations/save.rb +87 -0
  17. data/lib/stripe/api_resource.rb +37 -4
  18. data/lib/stripe/apple_pay_domain.rb +12 -0
  19. data/lib/stripe/application_fee.rb +8 -8
  20. data/lib/stripe/application_fee_refund.rb +7 -3
  21. data/lib/stripe/balance_transaction.rb +1 -1
  22. data/lib/stripe/bank_account.rb +9 -5
  23. data/lib/stripe/bitcoin_receiver.rb +6 -6
  24. data/lib/stripe/bitcoin_transaction.rb +1 -1
  25. data/lib/stripe/card.rb +9 -5
  26. data/lib/stripe/charge.rb +30 -12
  27. data/lib/stripe/country_spec.rb +9 -0
  28. data/lib/stripe/coupon.rb +1 -1
  29. data/lib/stripe/customer.rb +6 -4
  30. data/lib/stripe/dispute.rb +2 -2
  31. data/lib/stripe/errors.rb +82 -0
  32. data/lib/stripe/file_upload.rb +1 -1
  33. data/lib/stripe/invoice.rb +3 -3
  34. data/lib/stripe/invoice_item.rb +1 -1
  35. data/lib/stripe/list_object.rb +7 -6
  36. data/lib/stripe/order.rb +10 -2
  37. data/lib/stripe/order_return.rb +9 -0
  38. data/lib/stripe/plan.rb +1 -1
  39. data/lib/stripe/product.rb +2 -10
  40. data/lib/stripe/recipient.rb +1 -1
  41. data/lib/stripe/refund.rb +1 -1
  42. data/lib/stripe/reversal.rb +7 -3
  43. data/lib/stripe/singleton_api_resource.rb +3 -3
  44. data/lib/stripe/sku.rb +2 -2
  45. data/lib/stripe/source.rb +11 -0
  46. data/lib/stripe/stripe_object.rb +167 -91
  47. data/lib/stripe/subscription.rb +15 -9
  48. data/lib/stripe/subscription_item.rb +12 -0
  49. data/lib/stripe/three_d_secure.rb +9 -0
  50. data/lib/stripe/transfer.rb +3 -4
  51. data/lib/stripe/util.rb +100 -28
  52. data/lib/stripe/version.rb +1 -1
  53. data/lib/stripe.rb +283 -140
  54. data/stripe.gemspec +5 -18
  55. data/test/stripe/account_test.rb +55 -9
  56. data/test/stripe/alipay_account_test.rb +11 -0
  57. data/test/stripe/api_operations_test.rb +31 -0
  58. data/test/stripe/api_resource_test.rb +204 -10
  59. data/test/stripe/apple_pay_domain_test.rb +34 -0
  60. data/test/stripe/application_fee_test.rb +8 -5
  61. data/test/stripe/bitcoin_receiver_test.rb +2 -2
  62. data/test/stripe/charge_refund_test.rb +12 -0
  63. data/test/stripe/charge_test.rb +32 -4
  64. data/test/stripe/country_spec_test.rb +43 -0
  65. data/test/stripe/coupon_test.rb +9 -1
  66. data/test/stripe/customer_card_test.rb +2 -2
  67. data/test/stripe/customer_test.rb +24 -1
  68. data/test/stripe/dispute_test.rb +8 -0
  69. data/test/stripe/errors_test.rb +18 -0
  70. data/test/stripe/invoice_item_test.rb +19 -0
  71. data/test/stripe/invoice_test.rb +27 -1
  72. data/test/stripe/list_object_test.rb +36 -15
  73. data/test/stripe/order_return_test.rb +25 -0
  74. data/test/stripe/order_test.rb +21 -1
  75. data/test/stripe/plan_test.rb +31 -0
  76. data/test/stripe/product_test.rb +17 -7
  77. data/test/stripe/recipient_card_test.rb +2 -2
  78. data/test/stripe/recipient_test.rb +21 -0
  79. data/test/stripe/refund_test.rb +10 -1
  80. data/test/stripe/sku_test.rb +15 -6
  81. data/test/stripe/source_test.rb +83 -0
  82. data/test/stripe/stripe_object_test.rb +180 -11
  83. data/test/stripe/subscription_item_test.rb +76 -0
  84. data/test/stripe/subscription_test.rb +161 -37
  85. data/test/stripe/three_d_secure_test.rb +22 -0
  86. data/test/stripe/transfer_test.rb +8 -0
  87. data/test/stripe/util_test.rb +48 -16
  88. data/test/stripe_test.rb +58 -0
  89. data/test/test_data.rb +337 -27
  90. data/test/test_helper.rb +7 -3
  91. metadata +47 -133
  92. data/README.rdoc +0 -68
  93. data/gemfiles/default-with-activesupport.gemfile +0 -10
  94. data/gemfiles/json.gemfile +0 -12
  95. data/gemfiles/yajl.gemfile +0 -12
  96. data/lib/stripe/api_operations/update.rb +0 -58
  97. data/lib/stripe/errors/api_connection_error.rb +0 -4
  98. data/lib/stripe/errors/api_error.rb +0 -4
  99. data/lib/stripe/errors/authentication_error.rb +0 -4
  100. data/lib/stripe/errors/card_error.rb +0 -12
  101. data/lib/stripe/errors/invalid_request_error.rb +0 -11
  102. data/lib/stripe/errors/rate_limit_error.rb +0 -4
  103. data/lib/stripe/errors/stripe_error.rb +0 -26
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
- :url => "/v1/balance/history"
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
- :url => '/v1/application_fees'
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
- :url => '/v1/application_fees/' + fee_id + '/refunds'
104
+ :resource_url => '/v1/application_fees/' + fee_id + '/refunds'
105
105
  }
106
106
  end
107
107
 
@@ -118,7 +118,7 @@ module Stripe
118
118
  :created => 1304114758,
119
119
  :sources => make_customer_card_array(id),
120
120
  :metadata => {},
121
- :subscriptions => make_subscription_array(id)
121
+ :subscriptions => make_customer_subscription_array(id)
122
122
  }.merge(params)
123
123
  end
124
124
 
@@ -126,7 +126,7 @@ module Stripe
126
126
  {
127
127
  :data => [make_customer, make_customer, make_customer],
128
128
  :object => 'list',
129
- :url => '/v1/customers'
129
+ :resource_url => '/v1/customers'
130
130
  }
131
131
  end
132
132
 
@@ -152,7 +152,13 @@ module Stripe
152
152
  :object => "charge",
153
153
  :created => 1304114826,
154
154
  :refunds => make_refund_array(id),
155
- :metadata => {}
155
+ :metadata => {},
156
+ :outcome => {
157
+ type: 'authorized',
158
+ reason: nil,
159
+ seller_message: 'Payment complete.',
160
+ network_status: 'approved_by_network',
161
+ },
156
162
  }.merge(params)
157
163
  end
158
164
 
@@ -160,11 +166,10 @@ module Stripe
160
166
  {
161
167
  :data => [make_charge, make_charge, make_charge],
162
168
  :object => 'list',
163
- :url => '/v1/charges'
169
+ :resource_url => '/v1/charges'
164
170
  }
165
171
  end
166
172
 
167
-
168
173
  def make_dispute(params={})
169
174
  id = params[:id] || 'dp_test_dispute'
170
175
  {
@@ -185,7 +190,7 @@ module Stripe
185
190
  {
186
191
  :data => [make_dispute, make_dispute, make_dispute],
187
192
  :object => 'list',
188
- :url => '/v1/disputes'
193
+ :resource_url => '/v1/disputes'
189
194
  }
190
195
  end
191
196
 
@@ -193,7 +198,7 @@ module Stripe
193
198
  {
194
199
  :data => [make_card, make_card, make_card],
195
200
  :object => 'list',
196
- :url => '/v1/recipients/' + recipient_id + '/cards'
201
+ :resource_url => '/v1/recipients/' + recipient_id + '/cards'
197
202
  }
198
203
  end
199
204
 
@@ -201,7 +206,7 @@ module Stripe
201
206
  {
202
207
  :data => [make_card, make_card, make_card],
203
208
  :object => 'list',
204
- :url => '/v1/customers/' + customer_id + '/sources'
209
+ :resource_url => '/v1/customers/' + customer_id + '/sources'
205
210
  }
206
211
  end
207
212
 
@@ -236,7 +241,7 @@ module Stripe
236
241
  :created => 1403047735,
237
242
  :size => 4908,
238
243
  :purpose => params[:purpose] || "dispute_evidence",
239
- :url => nil,
244
+ :resource_url => nil,
240
245
  :type => nil,
241
246
  }
242
247
  end
@@ -245,7 +250,7 @@ module Stripe
245
250
  {
246
251
  :data => [make_file, make_file, make_file],
247
252
  :object => 'list',
248
- :url => '/v1/files'
253
+ :resource_url => '/v1/files'
249
254
  }
250
255
  end
251
256
 
@@ -272,6 +277,24 @@ module Stripe
272
277
  }.merge(params)
273
278
  end
274
279
 
280
+ def make_subscription_item(params = {})
281
+ plan = params.delete(:plan) || 'gold'
282
+ {
283
+ :id => "si_test_subscription_item",
284
+ :object => "subscription_item",
285
+ :created => 1473875521,
286
+ :plan => {
287
+ :id => plan,
288
+ :object => "plan",
289
+ :amount => 1000,
290
+ :created => 1468349629,
291
+ :currency => "usd",
292
+ :interval => "month",
293
+ },
294
+ :quantity => 1
295
+ }.merge(params)
296
+ end
297
+
275
298
  def make_refund(params = {})
276
299
  {
277
300
  :object => 'refund',
@@ -284,11 +307,27 @@ module Stripe
284
307
  }.merge(params)
285
308
  end
286
309
 
287
- def make_subscription_array(customer_id)
310
+ def make_subscription_array
311
+ {
312
+ :data => [make_subscription, make_subscription, make_subscription],
313
+ :object => 'list',
314
+ :resource_url => '/v1/subscriptions'
315
+ }
316
+ end
317
+
318
+ def make_subscription_item_array
319
+ {
320
+ :data => [make_subscription_item, make_subscription_item, make_subscription_item],
321
+ :object => 'list',
322
+ :resource_url => '/v1/subscription_items'
323
+ }
324
+ end
325
+
326
+ def make_customer_subscription_array(customer_id)
288
327
  {
289
328
  :data => [make_subscription, make_subscription, make_subscription],
290
329
  :object => 'list',
291
- :url => '/v1/customers/' + customer_id + '/subscriptions'
330
+ :resource_url => '/v1/customers/' + customer_id + '/subscriptions'
292
331
  }
293
332
  end
294
333
 
@@ -298,7 +337,7 @@ module Stripe
298
337
  {
299
338
  :data => [make_refund(p), make_refund(p), make_refund(p)],
300
339
  :object => 'list',
301
- :url => charge ? "/v1/charges/#{charge}/refunds" : '/v1/refunds'
340
+ :resource_url => charge ? "/v1/charges/#{charge}/refunds" : '/v1/refunds'
302
341
  }
303
342
  end
304
343
 
@@ -306,11 +345,11 @@ module Stripe
306
345
  {
307
346
  :data => [make_reversal, make_reversal, make_reversal],
308
347
  :object => 'list',
309
- :url => '/v1/transfers/' + transfer_id + '/reversals'
348
+ :resource_url => '/v1/transfers/' + transfer_id + '/reversals'
310
349
  }
311
350
  end
312
351
 
313
- def make_invoice
352
+ def make_invoice(params={})
314
353
  {
315
354
  :id => 'in_test_invoice',
316
355
  :object => 'invoice',
@@ -348,7 +387,7 @@ module Stripe
348
387
  :discount => nil,
349
388
  :ending_balance => nil,
350
389
  :next_payment_attempt => 1349825350,
351
- }
390
+ }.merge(params)
352
391
  end
353
392
 
354
393
  def make_paid_invoice
@@ -363,11 +402,22 @@ module Stripe
363
402
  })
364
403
  end
365
404
 
405
+ def make_invoice_item(params={})
406
+ {
407
+ id: "ii_test_invoice_item",
408
+ object: "invoiceitem",
409
+ date: 1466982411,
410
+ invoice: "in_test_invoice",
411
+ livemode: false,
412
+ metadata: {},
413
+ }.merge(params)
414
+ end
415
+
366
416
  def make_invoice_customer_array
367
417
  {
368
418
  :data => [make_invoice],
369
419
  :object => 'list',
370
- :url => '/v1/invoices?customer=test_customer'
420
+ :resource_url => '/v1/invoices?customer=test_customer'
371
421
  }
372
422
  end
373
423
 
@@ -397,7 +447,7 @@ module Stripe
397
447
  {
398
448
  :data => [make_recipient, make_recipient, make_recipient],
399
449
  :object => 'list',
400
- :url => '/v1/recipients'
450
+ :resource_url => '/v1/recipients'
401
451
  }
402
452
  end
403
453
 
@@ -428,7 +478,7 @@ module Stripe
428
478
  {
429
479
  :data => [make_transfer, make_transfer, make_transfer],
430
480
  :object => 'list',
431
- :url => '/v1/transfers'
481
+ :resource_url => '/v1/transfers'
432
482
  }
433
483
  end
434
484
 
@@ -458,6 +508,7 @@ module Stripe
458
508
  :description => 'some details',
459
509
  :metadata => {},
460
510
  :object => 'bitcoin_receiver',
511
+ :customer => nil,
461
512
  :transactions => make_bitcoin_transaction_array
462
513
  }.merge(params)
463
514
  end
@@ -466,7 +517,7 @@ module Stripe
466
517
  {
467
518
  :data => [make_bitcoin_receiver, make_bitcoin_receiver, make_bitcoin_receiver],
468
519
  :object => 'list',
469
- :url => '/v1/bitcoin/receivers'
520
+ :resource_url => '/v1/bitcoin/receivers'
470
521
  }
471
522
  end
472
523
 
@@ -485,7 +536,7 @@ module Stripe
485
536
  {
486
537
  :data => [make_bitcoin_transaction, make_bitcoin_transaction, make_bitcoin_transaction],
487
538
  :object => 'list',
488
- :url => "/v1/bitcoin/receivers/btcrcv_test_receiver/transactions"
539
+ :resource_url => "/v1/bitcoin/receivers/btcrcv_test_receiver/transactions"
489
540
  }
490
541
  end
491
542
 
@@ -567,7 +618,7 @@ module Stripe
567
618
  def make_product_array
568
619
  {
569
620
  :object => "list",
570
- :url => "/v1/products",
621
+ :resource_url => "/v1/products",
571
622
  :data => [
572
623
  make_product,
573
624
  make_product,
@@ -602,7 +653,7 @@ module Stripe
602
653
  def make_sku_array(product_id, params={})
603
654
  {
604
655
  :object => "list",
605
- :url => "/v1/skus",
656
+ :resource_url => "/v1/skus",
606
657
  :data => [
607
658
  make_sku(:product => product_id),
608
659
  make_sku(:product => product_id),
@@ -656,7 +707,7 @@ module Stripe
656
707
  def make_order_array(params={})
657
708
  {
658
709
  :object => "list",
659
- :url => "/v1/orders",
710
+ :resource_url => "/v1/orders",
660
711
  :data => [
661
712
  make_order,
662
713
  make_order,
@@ -671,5 +722,264 @@ module Stripe
671
722
  :charge => make_charge,
672
723
  }).merge(params)
673
724
  end
725
+
726
+ def make_partially_returned_order(params={})
727
+ make_paid_order.merge({
728
+ :returns => make_order_return_array,
729
+ }).merge(params)
730
+ end
731
+
732
+ def make_order_return(params={})
733
+ {
734
+ :id => "orret_18CI1jDAu10Yox5R5kGPgbLN",
735
+ :object => "order_return",
736
+ :amount => 1220,
737
+ :created => 1463529303,
738
+ :currency => "usd",
739
+ :items => [
740
+ {
741
+ :object => "order_item",
742
+ :amount => 200,
743
+ :currency => "usd",
744
+ :description => "Just a SKU",
745
+ :parent => "sku_80NAUPJ9dpYtck",
746
+ :quantity => 2,
747
+ :type => "sku"
748
+ },
749
+ {
750
+ :object => "order_item",
751
+ :amount => 20,
752
+ :currency => "usd",
753
+ :description => "Fair enough",
754
+ :parent => nil,
755
+ :quantity => nil,
756
+ :type => "tax"
757
+ },
758
+ ],
759
+ :livemode => false,
760
+ :order => "or_189jaGDAu10Yox5R0F6LoH6K",
761
+ :refund => nil,
762
+ }.merge(params)
763
+ end
764
+
765
+ def make_order_return_array
766
+ {
767
+ :object => "list",
768
+ :resource_url => "/v1/order_returns",
769
+ :data => [
770
+ make_order_return,
771
+ make_order_return,
772
+ make_order_return,
773
+ ]
774
+ }
775
+ end
776
+
777
+ def country_spec_array
778
+ {
779
+ :object => "list",
780
+ :resource_url => "/v1/country_specs",
781
+ :data => [
782
+ make_country_spec,
783
+ make_country_spec,
784
+ make_country_spec,
785
+ ]
786
+ }
787
+ end
788
+
789
+ def make_country_spec(params={})
790
+ {
791
+ :id => "US",
792
+ :object => "country_spec",
793
+ :supported_bank_account_currencies => {
794
+ :usd => ["US"]
795
+ },
796
+ :supported_payment_currencies => [
797
+ "usd", "aed", "afn", "all"
798
+ ],
799
+ :supported_payment_methods => [
800
+ "alipay",
801
+ "card",
802
+ "stripe"
803
+ ],
804
+ :verification_fields =>
805
+ {
806
+ :individual => {
807
+ :minimum => [
808
+ "external_account",
809
+ "legal_entity.address.city",
810
+ "tos_acceptance.date",
811
+ "tos_acceptance.ip"
812
+ ],
813
+ :additional => [
814
+ "legal_entity.personal_id_number",
815
+ "legal_entity.verification.document"
816
+ ]
817
+ },
818
+ :company => {
819
+ :minimum => [
820
+ "external_account",
821
+ "legal_entity.address.city",
822
+ "legal_entity.address.line1",
823
+ "tos_acceptance.ip"
824
+ ],
825
+ :additional => [
826
+ "legal_entity.personal_id_number",
827
+ "legal_entity.verification.document"
828
+ ]
829
+ }
830
+ }
831
+ }.merge(params)
832
+ end
833
+
834
+ def make_plan(params={})
835
+ {
836
+ id: "silver",
837
+ object: "plan",
838
+ amount: 1000,
839
+ created: 1463962497,
840
+ currency: "usd",
841
+ interval: "year",
842
+ interval_count: 1,
843
+ livemode: false,
844
+ metadata: {},
845
+ name: "Silver",
846
+ statement_descriptor: nil,
847
+ trial_period_days: nil,
848
+ }.merge(params)
849
+ end
850
+
851
+ def make_plan_array
852
+ {
853
+ :object => "list",
854
+ :resource_url => "/v1/plans",
855
+ :data => [
856
+ make_plan,
857
+ make_plan,
858
+ make_plan,
859
+ ]
860
+ }
861
+ end
862
+
863
+ def make_three_d_secure(params={})
864
+ {
865
+ :id => 'tdsrc_test',
866
+ :object => 'three_d_secure',
867
+ :amount => 1500,
868
+ :authenticate => true,
869
+ :card => make_card,
870
+ :created => 1456908210,
871
+ :currency => 'usd',
872
+ :livemode => false,
873
+ :redirect_url => nil,
874
+ :status => 'succeeded',
875
+ }.merge(params)
876
+ end
877
+
878
+ def make_apple_pay_domain(params={})
879
+ {
880
+ :id => "apwc_test_domain",
881
+ :object => "apple_pay_domain",
882
+ :domain_name => "test.com",
883
+ :livemode => false
884
+ }.merge(params)
885
+ end
886
+
887
+ def make_apple_pay_domain_array
888
+ {
889
+ :object => "list",
890
+ :resource_url => "/v1/apple_pay/domains",
891
+ :data => [
892
+ make_apple_pay_domain,
893
+ make_apple_pay_domain,
894
+ make_apple_pay_domain
895
+ ]
896
+ }
897
+ end
898
+
899
+ def make_source_card(params={})
900
+ id = params[:id] || 'src_test_card'
901
+ {
902
+ :id => id,
903
+ :object => 'source',
904
+ :type => 'card',
905
+ :amount => nil,
906
+ :card => {
907
+ :address_line1_check => nil,
908
+ :address_zip_check => nil,
909
+ :brand => 'Visa',
910
+ :country => 'US',
911
+ :cvc_check => 'unchecked',
912
+ :description => nil,
913
+ :dynamic_last4 => nil,
914
+ :exp_month => 1,
915
+ :exp_year => 2020,
916
+ :fingerprint => 'NrVafqTONZfbLkQK',
917
+ :funding => 'credit',
918
+ :google_reference => nil,
919
+ :iin => nil,
920
+ :issuer => nil,
921
+ :last4 => '4242',
922
+ :three_d_secure => 'optional',
923
+ :tokenization_method => 'nil',
924
+ },
925
+ :client_secret => 'src_client_secret_test',
926
+ :created => 1484841032,
927
+ :currency => nil,
928
+ :flow => 'none',
929
+ :livemode => false,
930
+ :metadata => {},
931
+ :owner => {
932
+ :address => nil,
933
+ :email => nil,
934
+ :name => nil,
935
+ :phone => nil,
936
+ :verified_address => nil,
937
+ :verified_email => nil,
938
+ :verified_name => nil,
939
+ :verified_phone => nil,
940
+ },
941
+ :status => 'chargeable',
942
+ :usage => 'reusable',
943
+ }.merge(params)
944
+ end
945
+
946
+ def make_source_ach_debit(params={})
947
+ id = params[:id] || 'src_test_ach_debit'
948
+ {
949
+ :id => id,
950
+ :object => 'source',
951
+ :type => 'ach_debit',
952
+ :ach_debit => {
953
+ :country => 'US',
954
+ :fingerprint => 'yY5BWKwnW98uydOa',
955
+ :last4 => '6789',
956
+ :routing_number => '110000000',
957
+ :type => 'individual',
958
+ },
959
+ :amount => nil,
960
+ :client_secret => 'src_client_secret_test',
961
+ :created => 1484842122,
962
+ :currency => 'usd',
963
+ :flow => 'verification',
964
+ :livemode => false,
965
+ :metadata => {},
966
+ :owner => {
967
+ :address => nil,
968
+ :email => nil,
969
+ :name => 'Jenny Rosen',
970
+ :phone => nil,
971
+ :verified_address => nil,
972
+ :verified_email => nil,
973
+ :verified_name => nil,
974
+ :verified_phone => nil,
975
+ },
976
+ :status => 'pending',
977
+ :usage => 'reusable',
978
+ :verification => {
979
+ :attempts_remaining => 10,
980
+ :status => 'pending',
981
+ },
982
+ }.merge(params)
983
+ end
674
984
  end
675
985
  end
data/test/test_helper.rb CHANGED
@@ -2,7 +2,7 @@ require 'stripe'
2
2
  require 'test/unit'
3
3
  require 'mocha/setup'
4
4
  require 'stringio'
5
- require 'shoulda'
5
+ require 'shoulda/context'
6
6
  require File.expand_path('../test_data', __FILE__)
7
7
 
8
8
  # monkeypatch request methods
@@ -13,6 +13,10 @@ module Stripe
13
13
  @mock_rest_client = mock_client
14
14
  end
15
15
 
16
+ class << self
17
+ remove_method :execute_request
18
+ end
19
+
16
20
  def self.execute_request(opts)
17
21
  get_params = (opts[:headers] || {})[:params]
18
22
  post_params = opts[:payload]
@@ -31,11 +35,11 @@ class Test::Unit::TestCase
31
35
  setup do
32
36
  @mock = mock
33
37
  Stripe.mock_rest_client = @mock
34
- Stripe.api_key="foo"
38
+ Stripe.api_key = "foo"
35
39
  end
36
40
 
37
41
  teardown do
38
42
  Stripe.mock_rest_client = nil
39
- Stripe.api_key=nil
43
+ Stripe.api_key = nil
40
44
  end
41
45
  end