stripe 3.3.2 → 3.4.1

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 (117) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.rubocop.yml +20 -0
  4. data/.rubocop_todo.yml +62 -0
  5. data/.travis.yml +1 -1
  6. data/Gemfile +19 -12
  7. data/History.txt +10 -0
  8. data/README.md +5 -1
  9. data/Rakefile +8 -5
  10. data/VERSION +1 -1
  11. data/bin/stripe-console +2 -2
  12. data/lib/stripe.rb +72 -74
  13. data/lib/stripe/account.rb +15 -17
  14. data/lib/stripe/alipay_account.rb +10 -7
  15. data/lib/stripe/api_operations/create.rb +1 -1
  16. data/lib/stripe/api_operations/delete.rb +1 -1
  17. data/lib/stripe/api_operations/list.rb +2 -2
  18. data/lib/stripe/api_operations/request.rb +5 -12
  19. data/lib/stripe/api_operations/save.rb +6 -6
  20. data/lib/stripe/api_resource.rb +7 -9
  21. data/lib/stripe/apple_pay_domain.rb +2 -2
  22. data/lib/stripe/application_fee.rb +5 -5
  23. data/lib/stripe/application_fee_refund.rb +5 -5
  24. data/lib/stripe/balance.rb +1 -1
  25. data/lib/stripe/balance_transaction.rb +2 -2
  26. data/lib/stripe/bank_account.rb +7 -7
  27. data/lib/stripe/bitcoin_receiver.rb +4 -2
  28. data/lib/stripe/bitcoin_transaction.rb +3 -1
  29. data/lib/stripe/card.rb +5 -5
  30. data/lib/stripe/charge.rb +18 -18
  31. data/lib/stripe/country_spec.rb +2 -2
  32. data/lib/stripe/coupon.rb +1 -1
  33. data/lib/stripe/customer.rb +23 -23
  34. data/lib/stripe/dispute.rb +3 -3
  35. data/lib/stripe/ephemeral_key.rb +4 -4
  36. data/lib/stripe/errors.rb +4 -4
  37. data/lib/stripe/event.rb +1 -1
  38. data/lib/stripe/file_upload.rb +5 -5
  39. data/lib/stripe/invoice.rb +7 -7
  40. data/lib/stripe/invoice_item.rb +1 -1
  41. data/lib/stripe/invoice_line_item.rb +1 -1
  42. data/lib/stripe/list_object.rb +14 -18
  43. data/lib/stripe/login_link.rb +3 -3
  44. data/lib/stripe/oauth.rb +15 -13
  45. data/lib/stripe/order.rb +5 -5
  46. data/lib/stripe/order_return.rb +1 -1
  47. data/lib/stripe/payout.rb +3 -3
  48. data/lib/stripe/plan.rb +1 -1
  49. data/lib/stripe/product.rb +1 -1
  50. data/lib/stripe/recipient.rb +3 -2
  51. data/lib/stripe/recipient_transfer.rb +1 -2
  52. data/lib/stripe/refund.rb +1 -1
  53. data/lib/stripe/reversal.rb +5 -5
  54. data/lib/stripe/singleton_api_resource.rb +3 -3
  55. data/lib/stripe/sku.rb +1 -1
  56. data/lib/stripe/source.rb +13 -10
  57. data/lib/stripe/stripe_client.rb +149 -169
  58. data/lib/stripe/stripe_object.rb +77 -76
  59. data/lib/stripe/subscription.rb +5 -5
  60. data/lib/stripe/subscription_item.rb +2 -2
  61. data/lib/stripe/three_d_secure.rb +1 -1
  62. data/lib/stripe/token.rb +1 -1
  63. data/lib/stripe/transfer.rb +3 -3
  64. data/lib/stripe/util.rb +77 -62
  65. data/lib/stripe/version.rb +1 -1
  66. data/lib/stripe/webhook.rb +14 -10
  67. data/stripe.gemspec +14 -14
  68. data/test/stripe/account_test.rb +69 -81
  69. data/test/stripe/alipay_account_test.rb +19 -1
  70. data/test/stripe/api_operations_test.rb +7 -7
  71. data/test/stripe/api_resource_test.rb +224 -260
  72. data/test/stripe/apple_pay_domain_test.rb +8 -8
  73. data/test/stripe/application_fee_refund_test.rb +8 -8
  74. data/test/stripe/application_fee_test.rb +3 -3
  75. data/test/stripe/balance_test.rb +2 -2
  76. data/test/stripe/bank_account_test.rb +9 -11
  77. data/test/stripe/charge_test.rb +11 -11
  78. data/test/stripe/country_spec_test.rb +4 -4
  79. data/test/stripe/coupon_test.rb +10 -10
  80. data/test/stripe/customer_card_test.rb +11 -15
  81. data/test/stripe/customer_test.rb +26 -27
  82. data/test/stripe/dispute_test.rb +8 -8
  83. data/test/stripe/ephemeral_key_test.rb +14 -14
  84. data/test/stripe/errors_test.rb +2 -2
  85. data/test/stripe/file_upload_test.rb +26 -28
  86. data/test/stripe/invoice_item_test.rb +14 -14
  87. data/test/stripe/invoice_line_item_test.rb +1 -1
  88. data/test/stripe/invoice_test.rb +37 -37
  89. data/test/stripe/list_object_test.rb +60 -76
  90. data/test/stripe/login_link_test.rb +14 -14
  91. data/test/stripe/oauth_test.rb +42 -50
  92. data/test/stripe/order_return_test.rb +5 -5
  93. data/test/stripe/order_test.rb +12 -12
  94. data/test/stripe/payout_test.rb +9 -9
  95. data/test/stripe/plan_test.rb +9 -9
  96. data/test/stripe/product_test.rb +8 -8
  97. data/test/stripe/recipient_test.rb +9 -10
  98. data/test/stripe/refund_test.rb +9 -9
  99. data/test/stripe/reversal_test.rb +10 -10
  100. data/test/stripe/sku_test.rb +8 -8
  101. data/test/stripe/source_test.rb +14 -16
  102. data/test/stripe/stripe_client_test.rb +235 -266
  103. data/test/stripe/stripe_object_test.rb +163 -147
  104. data/test/stripe/stripe_response_test.rb +4 -3
  105. data/test/stripe/subscription_item_test.rb +11 -11
  106. data/test/stripe/subscription_test.rb +14 -14
  107. data/test/stripe/three_d_secure_test.rb +2 -2
  108. data/test/stripe/transfer_test.rb +8 -8
  109. data/test/stripe/util_test.rb +59 -57
  110. data/test/stripe/webhook_test.rb +18 -16
  111. data/test/stripe_test.rb +4 -4
  112. data/test/test_data.rb +26 -26
  113. data/test/test_helper.rb +29 -25
  114. metadata +6 -10
  115. data/test/stripe/bitcoin_receiver_test.rb +0 -67
  116. data/test/stripe/bitcoin_transaction_test.rb +0 -19
  117. data/test/stripe/recipient_card_test.rb +0 -44
@@ -1,14 +1,16 @@
1
- require File.expand_path('../../test_helper', __FILE__)
1
+ require File.expand_path("../../test_helper", __FILE__)
2
2
 
3
3
  module Stripe
4
4
  class WebhookTest < Test::Unit::TestCase
5
- EVENT_PAYLOAD = '''{
6
- "id": "evt_test_webhook",
7
- "object": "event"
8
- }'''
9
- SECRET = 'whsec_test_secret'
5
+ EVENT_PAYLOAD = <<-PAYLOAD.freeze
6
+ {
7
+ "id": "evt_test_webhook",
8
+ "object": "event"
9
+ }
10
+ PAYLOAD
11
+ SECRET = "whsec_test_secret".freeze
10
12
 
11
- def generate_header(opts={})
13
+ def generate_header(opts = {})
12
14
  opts[:timestamp] ||= Time.now.to_i
13
15
  opts[:payload] ||= EVENT_PAYLOAD
14
16
  opts[:secret] ||= SECRET
@@ -21,19 +23,19 @@ module Stripe
21
23
  should "return an Event instance from a valid JSON payload and valid signature header" do
22
24
  header = generate_header
23
25
  event = Stripe::Webhook.construct_event(EVENT_PAYLOAD, header, SECRET)
24
- assert event.kind_of?(Stripe::Event)
26
+ assert event.is_a?(Stripe::Event)
25
27
  end
26
28
 
27
29
  should "raise a JSON::ParserError from an invalid JSON payload" do
28
30
  assert_raises JSON::ParserError do
29
- payload = 'this is not valid JSON'
31
+ payload = "this is not valid JSON"
30
32
  header = generate_header(payload: payload)
31
33
  Stripe::Webhook.construct_event(payload, header, SECRET)
32
34
  end
33
35
  end
34
36
 
35
37
  should "raise a SignatureVerificationError from a valid JSON payload and an invalid signature header" do
36
- header = 'bad_header'
38
+ header = "bad_header"
37
39
  assert_raises Stripe::SignatureVerificationError do
38
40
  Stripe::Webhook.construct_event(EVENT_PAYLOAD, header, SECRET)
39
41
  end
@@ -44,23 +46,23 @@ module Stripe
44
46
  should "raise a SignatureVerificationError when the header does not have the expected format" do
45
47
  header = 'i\'m not even a real signature header'
46
48
  e = assert_raises(Stripe::SignatureVerificationError) do
47
- Stripe::Webhook::Signature.verify_header(EVENT_PAYLOAD, header, 'secret')
49
+ Stripe::Webhook::Signature.verify_header(EVENT_PAYLOAD, header, "secret")
48
50
  end
49
51
  assert_match("Unable to extract timestamp and signatures from header", e.message)
50
52
  end
51
53
 
52
54
  should "raise a SignatureVerificationError when there are no signatures with the expected scheme" do
53
- header = generate_header(scheme: 'v0')
55
+ header = generate_header(scheme: "v0")
54
56
  e = assert_raises(Stripe::SignatureVerificationError) do
55
- Stripe::Webhook::Signature.verify_header(EVENT_PAYLOAD, header, 'secret')
57
+ Stripe::Webhook::Signature.verify_header(EVENT_PAYLOAD, header, "secret")
56
58
  end
57
59
  assert_match("No signatures found with expected scheme", e.message)
58
60
  end
59
61
 
60
62
  should "raise a SignatureVerificationError when there are no valid signatures for the payload" do
61
- header = generate_header(signature: 'bad_signature')
63
+ header = generate_header(signature: "bad_signature")
62
64
  e = assert_raises(Stripe::SignatureVerificationError) do
63
- Stripe::Webhook::Signature.verify_header(EVENT_PAYLOAD, header, 'secret')
65
+ Stripe::Webhook::Signature.verify_header(EVENT_PAYLOAD, header, "secret")
64
66
  end
65
67
  assert_match("No signatures found matching the expected signature for payload", e.message)
66
68
  end
@@ -84,7 +86,7 @@ module Stripe
84
86
  end
85
87
 
86
88
  should "return true when the header contains a valid signature and the timestamp is off but no tolerance is provided" do
87
- header = generate_header(timestamp: 12345)
89
+ header = generate_header(timestamp: 12_345)
88
90
  assert(Stripe::Webhook::Signature.verify_header(EVENT_PAYLOAD, header, SECRET))
89
91
  end
90
92
  end
data/test/stripe_test.rb CHANGED
@@ -1,4 +1,4 @@
1
- require File.expand_path('../test_helper', __FILE__)
1
+ require File.expand_path("../test_helper", __FILE__)
2
2
 
3
3
  class StripeTest < Test::Unit::TestCase
4
4
  should "warn that #refresh_from is deprecated" do
@@ -6,8 +6,8 @@ class StripeTest < Test::Unit::TestCase
6
6
  $stderr = StringIO.new
7
7
  begin
8
8
  Stripe.uri_encode({})
9
- message = "NOTE: Stripe.uri_encode is deprecated; use " +
10
- "Stripe::Util#encode_parameters instead"
9
+ message = "NOTE: Stripe.uri_encode is deprecated; use " \
10
+ "Stripe::Util#encode_parameters instead"
11
11
  assert_match Regexp.new(message), $stderr.string
12
12
  ensure
13
13
  $stderr = old_stderr
@@ -25,7 +25,7 @@ class StripeTest < Test::Unit::TestCase
25
25
  assert_equal({
26
26
  name: "MyAwesomePlugin",
27
27
  url: "https://myawesomeplugin.info",
28
- version: "1.2.34"
28
+ version: "1.2.34",
29
29
  }, Stripe.app_info)
30
30
  ensure
31
31
  Stripe.app_info = old
data/test/test_data.rb CHANGED
@@ -2,57 +2,57 @@ module Stripe
2
2
  module TestData
3
3
  def make_error(type, message)
4
4
  {
5
- :error => {
6
- :type => type,
7
- :message => message,
8
- }
5
+ error: {
6
+ type: type,
7
+ message: message,
8
+ },
9
9
  }
10
10
  end
11
11
 
12
12
  def make_invalid_api_key_error
13
13
  {
14
- :error => {
15
- :type => "invalid_request_error",
16
- :message => "Invalid API Key provided: invalid"
17
- }
14
+ error: {
15
+ type: "invalid_request_error",
16
+ message: "Invalid API Key provided: invalid",
17
+ },
18
18
  }
19
19
  end
20
20
 
21
21
  def make_invalid_exp_year_error
22
22
  {
23
- :error => {
24
- :code => "invalid_expiry_year",
25
- :param => "exp_year",
26
- :type => "card_error",
27
- :message => "Your card's expiration year is invalid"
28
- }
23
+ error: {
24
+ code: "invalid_expiry_year",
25
+ param: "exp_year",
26
+ type: "card_error",
27
+ message: "Your card's expiration year is invalid",
28
+ },
29
29
  }
30
30
  end
31
31
 
32
32
  def make_missing_id_error
33
33
  {
34
- :error => {
35
- :param => "id",
36
- :type => "invalid_request_error",
37
- :message => "Missing id"
38
- }
34
+ error: {
35
+ param: "id",
36
+ type: "invalid_request_error",
37
+ message: "Missing id",
38
+ },
39
39
  }
40
40
  end
41
41
 
42
42
  def make_rate_limit_error
43
43
  {
44
- :error => {
45
- :type => "invalid_request_error",
46
- :message => "Too many requests in a period of time."
47
- }
44
+ error: {
45
+ type: "invalid_request_error",
46
+ message: "Too many requests in a period of time.",
47
+ },
48
48
  }
49
49
  end
50
50
 
51
51
  def make_api_error
52
52
  {
53
- :error => {
54
- :type => "api_error"
55
- }
53
+ error: {
54
+ type: "api_error",
55
+ },
56
56
  }
57
57
  end
58
58
  end
data/test/test_helper.rb CHANGED
@@ -1,17 +1,17 @@
1
- require 'stripe'
2
- require 'test/unit'
3
- require 'mocha/setup'
4
- require 'stringio'
5
- require 'shoulda/context'
1
+ require "stripe"
2
+ require "test/unit"
3
+ require "mocha/setup"
4
+ require "stringio"
5
+ require "shoulda/context"
6
6
  require "timecop"
7
- require 'webmock/test_unit'
7
+ require "webmock/test_unit"
8
8
 
9
9
  PROJECT_ROOT = File.expand_path("../../", __FILE__)
10
10
 
11
- require File.expand_path('../test_data', __FILE__)
11
+ require File.expand_path("../test_data", __FILE__)
12
12
 
13
- MOCK_MINIMUM_VERSION = "0.1.12"
14
- MOCK_PORT = ENV["STRIPE_MOCK_PORT"] || 12111
13
+ MOCK_MINIMUM_VERSION = "0.2.0".freeze
14
+ MOCK_PORT = ENV["STRIPE_MOCK_PORT"] || 12_111
15
15
 
16
16
  # Disable all real network connections except those that are outgoing to
17
17
  # stripe-mock.
@@ -22,9 +22,9 @@ WebMock.disable_net_connect!(allow: "localhost:#{MOCK_PORT}")
22
22
  # they should fix the problem.
23
23
  begin
24
24
  resp = Faraday.get("http://localhost:#{MOCK_PORT}/")
25
- version = resp.headers['Stripe-Mock-Version']
25
+ version = resp.headers["Stripe-Mock-Version"]
26
26
  if version != "master" &&
27
- Gem::Version.new(version) < Gem::Version.new(MOCK_MINIMUM_VERSION)
27
+ Gem::Version.new(version) < Gem::Version.new(MOCK_MINIMUM_VERSION)
28
28
  abort("Your version of stripe-mock (#{version}) is too old. The minimum " \
29
29
  "version to run this test suite is #{MOCK_MINIMUM_VERSION}. Please " \
30
30
  "see its repository for upgrade instructions.")
@@ -34,23 +34,27 @@ rescue Faraday::ConnectionFailed
34
34
  "it running? Please see README for setup instructions.")
35
35
  end
36
36
 
37
- class Test::Unit::TestCase
38
- include Stripe::TestData
39
- include Mocha
37
+ module Test
38
+ module Unit
39
+ class TestCase
40
+ include Stripe::TestData
41
+ include Mocha
40
42
 
41
- setup do
42
- Stripe.api_key = "sk_test_123"
43
- Stripe.api_base = "http://localhost:#{MOCK_PORT}"
44
- stub_connect
45
- end
43
+ setup do
44
+ Stripe.api_key = "sk_test_123"
45
+ Stripe.api_base = "http://localhost:#{MOCK_PORT}"
46
+ stub_connect
47
+ end
46
48
 
47
- teardown do
48
- Stripe.api_key = nil
49
- end
49
+ teardown do
50
+ Stripe.api_key = nil
51
+ end
50
52
 
51
- private
53
+ private
52
54
 
53
- def stub_connect
54
- stub_request(:any, /^#{Stripe.connect_base}/).to_return(:body => "{}")
55
+ def stub_connect
56
+ stub_request(:any, /^#{Stripe.connect_base}/).to_return(body: "{}")
57
+ end
58
+ end
55
59
  end
56
60
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stripe
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.2
4
+ version: 3.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stripe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-20 00:00:00.000000000 Z
11
+ date: 2017-10-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.9'
19
+ version: '0.10'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.9'
26
+ version: '0.10'
27
27
  description: Stripe is the easiest way to accept payments online. See https://stripe.com
28
28
  for details.
29
29
  email: support@stripe.com
@@ -35,6 +35,8 @@ files:
35
35
  - ".gitattributes"
36
36
  - ".github/ISSUE_TEMPLATE.md"
37
37
  - ".gitignore"
38
+ - ".rubocop.yml"
39
+ - ".rubocop_todo.yml"
38
40
  - ".travis.yml"
39
41
  - CONTRIBUTORS
40
42
  - Gemfile
@@ -112,8 +114,6 @@ files:
112
114
  - test/stripe/application_fee_test.rb
113
115
  - test/stripe/balance_test.rb
114
116
  - test/stripe/bank_account_test.rb
115
- - test/stripe/bitcoin_receiver_test.rb
116
- - test/stripe/bitcoin_transaction_test.rb
117
117
  - test/stripe/charge_test.rb
118
118
  - test/stripe/country_spec_test.rb
119
119
  - test/stripe/coupon_test.rb
@@ -134,7 +134,6 @@ files:
134
134
  - test/stripe/payout_test.rb
135
135
  - test/stripe/plan_test.rb
136
136
  - test/stripe/product_test.rb
137
- - test/stripe/recipient_card_test.rb
138
137
  - test/stripe/recipient_test.rb
139
138
  - test/stripe/refund_test.rb
140
139
  - test/stripe/reversal_test.rb
@@ -187,8 +186,6 @@ test_files:
187
186
  - test/stripe/application_fee_test.rb
188
187
  - test/stripe/balance_test.rb
189
188
  - test/stripe/bank_account_test.rb
190
- - test/stripe/bitcoin_receiver_test.rb
191
- - test/stripe/bitcoin_transaction_test.rb
192
189
  - test/stripe/charge_test.rb
193
190
  - test/stripe/country_spec_test.rb
194
191
  - test/stripe/coupon_test.rb
@@ -209,7 +206,6 @@ test_files:
209
206
  - test/stripe/payout_test.rb
210
207
  - test/stripe/plan_test.rb
211
208
  - test/stripe/product_test.rb
212
- - test/stripe/recipient_card_test.rb
213
209
  - test/stripe/recipient_test.rb
214
210
  - test/stripe/refund_test.rb
215
211
  - test/stripe/reversal_test.rb
@@ -1,67 +0,0 @@
1
- require File.expand_path('../../test_helper', __FILE__)
2
-
3
- module Stripe
4
- class BitcoinReceiverTest < Test::Unit::TestCase
5
- should "be listable" do
6
- receivers = Stripe::BitcoinReceiver.list
7
- assert_requested :get, "#{Stripe.api_base}/v1/bitcoin/receivers"
8
- assert receivers.data.kind_of?(Array)
9
- assert receivers.first.kind_of?(Stripe::BitcoinReceiver)
10
- end
11
-
12
- should "be retrievable" do
13
- receiver = Stripe::BitcoinReceiver.retrieve("btcrcv_123")
14
- assert_requested :get,
15
- "#{Stripe.api_base}/v1/bitcoin/receivers/btcrcv_123"
16
- assert receiver.kind_of?(Stripe::BitcoinReceiver)
17
- end
18
-
19
- should "be creatable" do
20
- receiver = Stripe::BitcoinReceiver.create(amount: 100, currency: "USD")
21
- assert_requested :post, "#{Stripe.api_base}/v1/bitcoin/receivers"
22
- assert receiver.kind_of?(Stripe::BitcoinReceiver)
23
- end
24
-
25
- should "be saveable" do
26
- receiver = Stripe::BitcoinReceiver.retrieve("btcrcv_123")
27
- receiver.metadata['key'] = 'value'
28
- receiver.save
29
- assert_requested :post,
30
- "#{Stripe.api_base}/v1/bitcoin/receivers/#{receiver.id}"
31
- end
32
-
33
- should "be updateable" do
34
- receiver = Stripe::BitcoinReceiver.update("btcrcv_123", metadata: { key: 'value' })
35
- assert_requested :post,
36
- "#{Stripe.api_base}/v1/bitcoin/receivers/btcrcv_123"
37
- assert receiver.kind_of?(Stripe::BitcoinReceiver)
38
- end
39
-
40
- should "be deletable" do
41
- receiver = Stripe::BitcoinReceiver.retrieve("btcrcv_123")
42
- receiver = receiver.delete
43
- assert_requested :delete,
44
- "#{Stripe.api_base}/v1/bitcoin/receivers/#{receiver.id}"
45
- assert receiver.kind_of?(Stripe::BitcoinReceiver)
46
- end
47
-
48
- context "#resource_url" do
49
- should "return a customer URL" do
50
- receiver = Stripe::BitcoinReceiver.construct_from(
51
- customer: "cus_123",
52
- id: "btcrcv_123",
53
- )
54
- assert_equal "/v1/customers/cus_123/sources/btcrcv_123",
55
- receiver.resource_url
56
- end
57
-
58
- should "return an absolute URL" do
59
- receiver = Stripe::BitcoinReceiver.construct_from(
60
- id: "btcrcv_123",
61
- )
62
- assert_equal "/v1/bitcoin/receivers/btcrcv_123",
63
- receiver.resource_url
64
- end
65
- end
66
- end
67
- end
@@ -1,19 +0,0 @@
1
- require File.expand_path('../../test_helper', __FILE__)
2
-
3
- module Stripe
4
- class BitcoinTransactionTest < Test::Unit::TestCase
5
- should "be listable" do
6
- transactions = Stripe::BitcoinTransaction.list
7
- assert_requested :get, "#{Stripe.api_base}/v1/bitcoin/transactions"
8
- assert transactions.data.kind_of?(Array)
9
- assert transactions.first.kind_of?(Stripe::BitcoinTransaction)
10
- end
11
-
12
- should "be retrievable" do
13
- transaction = Stripe::BitcoinTransaction.retrieve("btctxn_123")
14
- assert_requested :get,
15
- "#{Stripe.api_base}/v1/bitcoin/transactions/btctxn_123"
16
- assert transaction.kind_of?(Stripe::BitcoinTransaction)
17
- end
18
- end
19
- end
@@ -1,44 +0,0 @@
1
- require File.expand_path('../../test_helper', __FILE__)
2
-
3
- module Stripe
4
- class RecipientCardTest < Test::Unit::TestCase
5
- setup do
6
- @recipient = Stripe::Recipient.retrieve("rp_123")
7
- end
8
-
9
- should "be listable" do
10
- cards = @recipient.cards.list
11
- assert cards.data.kind_of?(Array)
12
- assert cards.data[0].kind_of?(Stripe::Card)
13
- end
14
-
15
- should "be creatable" do
16
- card = @recipient.cards.create(
17
- card: "tok_123"
18
- )
19
- assert_requested :post, "#{Stripe.api_base}/v1/recipients/#{@recipient.id}/cards"
20
- assert card.kind_of?(Stripe::Card)
21
- end
22
-
23
- should "be deletable" do
24
- card = Stripe::Card.construct_from({
25
- id: "card_123",
26
- recipient: @recipient.id
27
- })
28
- card = card.delete
29
- assert_requested :delete, "#{Stripe.api_base}/v1/recipients/#{@recipient.id}/cards/card_123"
30
- assert card.kind_of?(Stripe::Card)
31
- end
32
-
33
- should "be saveable" do
34
- card = Stripe::Card.construct_from({
35
- id: "card_123",
36
- metadata: {},
37
- recipient: @recipient.id
38
- })
39
- card.metadata['key'] = 'value'
40
- card.save
41
- assert_requested :post, "#{Stripe.api_base}/v1/recipients/#{@recipient.id}/cards/card_123"
42
- end
43
- end
44
- end