stripe 4.14.0 → 4.15.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 790e0608c4ddd64ef2fe1c9c479bf5aea4860001f710f01bec506d5abb5c6d00
4
- data.tar.gz: dcda60f272c74dda8e2681c2ca023e6355a52efcac58f69b773a4881eeedf541
3
+ metadata.gz: bb8e5adf0ff8d1cdc28daf3a61fbe21cb05102a645aed78fb48208a6e5df51df
4
+ data.tar.gz: 6710503e82fad61bef4c71405cc022f6e6784f0e6735d1ec36417848a41dd4ae
5
5
  SHA512:
6
- metadata.gz: 31001e18ef97dd7c17f882398a14cd983ff33e08e5f30a3d22331863bd3a67ec7946968a1465c46d64e564b619625b9c3fe59e4ec1b9076307ccba2fe5c49d98
7
- data.tar.gz: 493304d4c23cb7ea517419a5ebe70aa23da0610ede0c5364a2dccac1c8c425d36f50c6d923db494e71a54edb4c3eeb872819b844fe90921bde47c75b631fea46
6
+ metadata.gz: cf9f9a61f78dc87ca85965762765ac30bea67308dd5627656574c215a5ec4a75ee23b35087bde24376b50a50d5487dc4be9953093e5bc8e66590dabb43d8ff77
7
+ data.tar.gz: 560c3fb2162504c46a955ebe84ff0b062c6815ae89d1940dabeb7e70b8a84d0ae00c841ae6f7f416b4dafceca6c56745beab8d70bcfd3a57307e0726b731381e
data/.travis.yml CHANGED
@@ -17,7 +17,7 @@ sudo: false
17
17
  env:
18
18
  global:
19
19
  # If changing this number, please also change it in `test/test_helper.rb`.
20
- - STRIPE_MOCK_VERSION=0.52.0
20
+ - STRIPE_MOCK_VERSION=0.54.0
21
21
 
22
22
  cache:
23
23
  directories:
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.15.0 - 2019-04-22
4
+ * [#762](https://github.com/stripe/stripe-ruby/pull/762) Add support for the `TaxId` resource and APIs
5
+
3
6
  ## 4.14.0 - 2019-04-18
4
7
  * [#758](https://github.com/stripe/stripe-ruby/pull/758) Add support for the `CreditNote` resource and APIs
5
8
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 4.14.0
1
+ 4.15.0
@@ -16,6 +16,9 @@ module Stripe
16
16
  nested_resource_class_methods :source,
17
17
  operations: %i[create retrieve update delete list]
18
18
 
19
+ nested_resource_class_methods :tax_id,
20
+ operations: %i[create retrieve delete list]
21
+
19
22
  # The API request for deleting a card or bank account and for detaching a
20
23
  # source object are the same.
21
24
  class << self
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Stripe
4
+ class TaxId < APIResource
5
+ extend Stripe::APIOperations::List
6
+ include Stripe::APIOperations::Delete
7
+
8
+ OBJECT_NAME = "tax_id".freeze
9
+
10
+ def resource_url
11
+ if !respond_to?(:customer) || customer.nil?
12
+ raise NotImplementedError,
13
+ "Tax Ids cannot be accessed without a customer ID."
14
+ end
15
+ "#{Customer.resource_url}/#{CGI.escape(customer)}/tax_ids/#{CGI.escape(id)}"
16
+ end
17
+
18
+ def self.retrieve(_id, _opts = {})
19
+ raise NotImplementedError, "Tax Ids cannot be retrieved without a customer ID. Retrieve a tax id using Customer.retrieve_tax_id('tax_id')"
20
+ end
21
+ end
22
+ end
data/lib/stripe/util.rb CHANGED
@@ -107,6 +107,7 @@ module Stripe
107
107
  SubscriptionItem::OBJECT_NAME => SubscriptionItem,
108
108
  SubscriptionSchedule::OBJECT_NAME => SubscriptionSchedule,
109
109
  SubscriptionScheduleRevision::OBJECT_NAME => SubscriptionScheduleRevision,
110
+ TaxId::OBJECT_NAME => TaxId,
110
111
  Terminal::ConnectionToken::OBJECT_NAME => Terminal::ConnectionToken,
111
112
  Terminal::Location::OBJECT_NAME => Terminal::Location,
112
113
  Terminal::Reader::OBJECT_NAME => Terminal::Reader,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Stripe
4
- VERSION = "4.14.0".freeze
4
+ VERSION = "4.15.0".freeze
5
5
  end
data/lib/stripe.rb CHANGED
@@ -97,6 +97,7 @@ require "stripe/subscription"
97
97
  require "stripe/subscription_item"
98
98
  require "stripe/subscription_schedule"
99
99
  require "stripe/subscription_schedule_revision"
100
+ require "stripe/tax_id"
100
101
  require "stripe/terminal/connection_token"
101
102
  require "stripe/terminal/location"
102
103
  require "stripe/terminal/reader"
@@ -180,5 +180,47 @@ module Stripe
180
180
  assert_equal true, c.source.save_with_parent
181
181
  end
182
182
  end
183
+
184
+ context "#create_tax_id" do
185
+ should "create a tax id" do
186
+ Stripe::Customer.create_tax_id(
187
+ "cus_123",
188
+ type: "eu_vat",
189
+ value: "11111"
190
+ )
191
+ assert_requested :post, "#{Stripe.api_base}/v1/customers/cus_123/tax_ids"
192
+ end
193
+ end
194
+
195
+ context "#retrieve_tax_id" do
196
+ should "retrieve a tax id" do
197
+ Stripe::Customer.retrieve_tax_id(
198
+ "cus_123",
199
+ "txi_123"
200
+ )
201
+ assert_requested :get, "#{Stripe.api_base}/v1/customers/cus_123/tax_ids/txi_123"
202
+ end
203
+ end
204
+
205
+ context "#delete_tax_id" do
206
+ should "delete a tax id" do
207
+ Stripe::Customer.delete_tax_id(
208
+ "cus_123",
209
+ "txi_123"
210
+ )
211
+ assert_requested :delete, "#{Stripe.api_base}/v1/customers/cus_123/tax_ids/txi_123"
212
+ end
213
+ end
214
+
215
+ context "#list_tax_ids" do
216
+ should "list the customer's tax ids" do
217
+ sources = Stripe::Customer.list_tax_ids(
218
+ "cus_123"
219
+ )
220
+ assert_requested :get, "#{Stripe.api_base}/v1/customers/cus_123/tax_ids"
221
+ assert sources.is_a?(Stripe::ListObject)
222
+ assert sources.data.is_a?(Array)
223
+ end
224
+ end
183
225
  end
184
226
  end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require ::File.expand_path("../../test_helper", __FILE__)
4
+
5
+ module Stripe
6
+ class TaxIdTest < Test::Unit::TestCase
7
+ context "#resource_url" do
8
+ should "return a resource URL" do
9
+ tax_id = Stripe::TaxId.construct_from(
10
+ id: "txi_123",
11
+ customer: "cus_123"
12
+ )
13
+ assert_equal "/v1/customers/cus_123/tax_ids/txi_123",
14
+ tax_id.resource_url
15
+ end
16
+
17
+ should "raise without a customer" do
18
+ tax_id = Stripe::TaxId.construct_from(id: "txi_123")
19
+ assert_raises NotImplementedError do
20
+ tax_id.resource_url
21
+ end
22
+ end
23
+ end
24
+
25
+ should "raise on #retrieve" do
26
+ assert_raises NotImplementedError do
27
+ Stripe::TaxId.retrieve("txi_123")
28
+ end
29
+ end
30
+ end
31
+ end
data/test/test_helper.rb CHANGED
@@ -17,7 +17,7 @@ require ::File.expand_path("../test_data", __FILE__)
17
17
  require ::File.expand_path("../stripe_mock", __FILE__)
18
18
 
19
19
  # If changing this number, please also change it in `.travis.yml`.
20
- MOCK_MINIMUM_VERSION = "0.52.0".freeze
20
+ MOCK_MINIMUM_VERSION = "0.54.0".freeze
21
21
  MOCK_PORT = Stripe::StripeMock.start
22
22
 
23
23
  # Disable all real network connections except those that are outgoing to
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: 4.14.0
4
+ version: 4.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stripe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-18 00:00:00.000000000 Z
11
+ date: 2019-04-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -138,6 +138,7 @@ files:
138
138
  - lib/stripe/subscription_item.rb
139
139
  - lib/stripe/subscription_schedule.rb
140
140
  - lib/stripe/subscription_schedule_revision.rb
141
+ - lib/stripe/tax_id.rb
141
142
  - lib/stripe/terminal/connection_token.rb
142
143
  - lib/stripe/terminal/location.rb
143
144
  - lib/stripe/terminal/reader.rb
@@ -217,6 +218,7 @@ files:
217
218
  - test/stripe/subscription_schedule_revision_test.rb
218
219
  - test/stripe/subscription_schedule_test.rb
219
220
  - test/stripe/subscription_test.rb
221
+ - test/stripe/tax_id_test.rb
220
222
  - test/stripe/terminal/connection_token_test.rb
221
223
  - test/stripe/terminal/location_test.rb
222
224
  - test/stripe/terminal/reader_test.rb
@@ -321,6 +323,7 @@ test_files:
321
323
  - test/stripe/subscription_schedule_revision_test.rb
322
324
  - test/stripe/subscription_schedule_test.rb
323
325
  - test/stripe/subscription_test.rb
326
+ - test/stripe/tax_id_test.rb
324
327
  - test/stripe/terminal/connection_token_test.rb
325
328
  - test/stripe/terminal/location_test.rb
326
329
  - test/stripe/terminal/reader_test.rb