stripe 3.17.0 → 3.17.1

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
- SHA1:
3
- metadata.gz: bac1f6ddcfa0fad7db03e5929bb02fa20a8d55a1
4
- data.tar.gz: 7623d4070e7d9e4260d9213638fa7750e0fef6b3
2
+ SHA256:
3
+ metadata.gz: acbfb1122ba314433628312929afc3560c5cf758d16665433d119b845e32001d
4
+ data.tar.gz: 14444a0da91da5fadbbd74ce3ec492ab03d5724de25c2a0d26f955fda6208fdb
5
5
  SHA512:
6
- metadata.gz: 8d79721ac5dceccd1cd8769b1cdb104142750e0f3ddc9d965584e4731a2bd382a8cb5c17d2b3751da8699a0bc39a3fd00ba7589829d0cc4aec7aa8d481fd653e
7
- data.tar.gz: 5df86bf3c52ee058ce0e00515264c166f14a935382fafdaab578d9545f9affcd63af20d3fa99f96534d6fc488d52aef76da06628db733b317565cdb00c2fe0bb
6
+ metadata.gz: 3413e4af564775f3fedab1418387361a68903b3f883b240395cf8deb70fed1c562e82f5c32e8dec94fb9b90053aafb798d6287c32083cf16a959dfdc097774eb
7
+ data.tar.gz: 5e6505abae65f4d3e014b71820efbe96509df473e5957f26b3be933cca89e5da06cf7884a05a961884a263863c68c88e52c5c83ca29f12e5d13dd6a0f55c8dcd
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2018-06-28 10:59:56 -0400 using RuboCop version 0.50.0.
3
+ # on 2018-07-19 14:22:24 +0200 using RuboCop version 0.50.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
@@ -24,7 +24,7 @@ Metrics/ClassLength:
24
24
  Metrics/CyclomaticComplexity:
25
25
  Max: 15
26
26
 
27
- # Offense count: 269
27
+ # Offense count: 278
28
28
  # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
29
29
  # URISchemes: http, https
30
30
  Metrics/LineLength:
@@ -38,7 +38,7 @@ Metrics/MethodLength:
38
38
  # Offense count: 1
39
39
  # Configuration parameters: CountComments.
40
40
  Metrics/ModuleLength:
41
- Max: 350
41
+ Max: 308
42
42
 
43
43
  # Offense count: 6
44
44
  # Configuration parameters: CountKeywordArgs.
@@ -55,6 +55,6 @@ Style/ClassVars:
55
55
  - 'lib/stripe/stripe_object.rb'
56
56
  - 'test/stripe/api_resource_test.rb'
57
57
 
58
- # Offense count: 55
58
+ # Offense count: 56
59
59
  Style/Documentation:
60
60
  Enabled: false
@@ -1,11 +1,12 @@
1
1
  language: ruby
2
2
 
3
3
  rvm:
4
- - 2.0.0
4
+ - 2.0
5
5
  - 2.1
6
6
  - 2.2
7
- - 2.3.0
8
- - 2.4.0
7
+ - 2.3
8
+ - 2.4
9
+ - 2.5
9
10
  - jruby-9.0.5.0
10
11
 
11
12
  notifications:
@@ -17,7 +18,7 @@ sudo: false
17
18
  env:
18
19
  global:
19
20
  # If changing this number, please also change it in `test/test_helper.rb`.
20
- - STRIPE_MOCK_VERSION=0.16.0
21
+ - STRIPE_MOCK_VERSION=0.19.0
21
22
 
22
23
  cache:
23
24
  directories:
@@ -1,5 +1,8 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.17.1 - 2018-07-19
4
+ * [#663](https://github.com/stripe/stripe-ruby/pull/663) Internal improvements to `ApiResource.class_url`
5
+
3
6
  ## 3.17.0 - 2018-06-28
4
7
  * [#658](https://github.com/stripe/stripe-ruby/pull/658) Add support for `partner_id` from `Stripe.set_app_info`
5
8
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.17.0
1
+ 3.17.1
@@ -19,7 +19,9 @@ module Stripe
19
19
  if self == APIResource
20
20
  raise NotImplementedError, "APIResource is an abstract class. You should perform actions on its subclasses (Charge, Customer, etc.)"
21
21
  end
22
- "/v1/#{CGI.escape(class_name.downcase)}s"
22
+ # Namespaces are separated in object names with periods (.) and in URLs
23
+ # with forward slashes (/), so replace the former with the latter.
24
+ "/v1/#{self::OBJECT_NAME.downcase.tr('.', '/')}s"
23
25
  end
24
26
 
25
27
  # A metaprogramming call that specifies that a field of a resource can be
@@ -9,10 +9,6 @@ module Stripe
9
9
 
10
10
  nested_resource_class_methods :refund, operations: %i[create retrieve update list]
11
11
 
12
- def self.resource_url
13
- "/v1/application_fees"
14
- end
15
-
16
12
  # If you don't need access to an updated fee object after the refund, it's
17
13
  # more performant to just call `fee.refunds.create` directly.
18
14
  def refund(params = {}, opts = {})
@@ -5,9 +5,5 @@ module Stripe
5
5
  extend Stripe::APIOperations::List
6
6
 
7
7
  OBJECT_NAME = "country_spec".freeze
8
-
9
- def self.resource_url
10
- "/v1/country_specs"
11
- end
12
8
  end
13
9
  end
@@ -7,10 +7,6 @@ module Stripe
7
7
 
8
8
  OBJECT_NAME = "ephemeral_key".freeze
9
9
 
10
- def self.resource_url
11
- "/v1/ephemeral_keys"
12
- end
13
-
14
10
  def self.create(params = {}, opts = {})
15
11
  opts = Util.normalize_opts(opts)
16
12
  raise ArgumentError, "stripe_version must be specified to create an ephemeral key" unless opts[:stripe_version]
@@ -5,9 +5,5 @@ module Stripe
5
5
  extend Stripe::APIOperations::List
6
6
 
7
7
  OBJECT_NAME = "exchange_rate".freeze
8
-
9
- def self.resource_url
10
- "/v1/exchange_rates"
11
- end
12
8
  end
13
9
  end
@@ -5,9 +5,5 @@ module Stripe
5
5
  extend Stripe::APIOperations::List
6
6
 
7
7
  OBJECT_NAME = "issuer_fraud_record".freeze
8
-
9
- def self.resource_url
10
- "/v1/issuer_fraud_records"
11
- end
12
8
  end
13
9
  end
@@ -5,9 +5,5 @@ module Stripe
5
5
  extend Stripe::APIOperations::List
6
6
 
7
7
  OBJECT_NAME = "order_return".freeze
8
-
9
- def self.resource_url
10
- "/v1/order_returns"
11
- end
12
8
  end
13
9
  end
@@ -9,10 +9,6 @@ module Stripe
9
9
 
10
10
  OBJECT_NAME = "payment_intent".freeze
11
11
 
12
- def self.resource_url
13
- "/v1/payment_intents"
14
- end
15
-
16
12
  def cancel
17
13
  resp, api_key = request(:post, resource_url + "/cancel")
18
14
  initialize_from(resp.data, api_key)
@@ -6,7 +6,9 @@ module Stripe
6
6
  if self == SingletonAPIResource
7
7
  raise NotImplementedError, "SingletonAPIResource is an abstract class. You should perform actions on its subclasses (Account, etc.)"
8
8
  end
9
- "/v1/#{CGI.escape(class_name.downcase)}"
9
+ # Namespaces are separated in object names with periods (.) and in URLs
10
+ # with forward slashes (/), so replace the former with the latter.
11
+ "/v1/#{self::OBJECT_NAME.downcase.tr('.', '/')}"
10
12
  end
11
13
 
12
14
  def resource_url
@@ -8,9 +8,5 @@ module Stripe
8
8
  include Stripe::APIOperations::Save
9
9
 
10
10
  OBJECT_NAME = "subscription_item".freeze
11
-
12
- def self.resource_url
13
- "/v1/subscription_items"
14
- end
15
11
  end
16
12
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Stripe
4
- VERSION = "3.17.0".freeze
4
+ VERSION = "3.17.1".freeze
5
5
  end
@@ -8,6 +8,8 @@ module Stripe
8
8
  class UpdateableResource < APIResource
9
9
  include Stripe::APIOperations::Save
10
10
 
11
+ OBJECT_NAME = "updateableresource".freeze
12
+
11
13
  def self.protected_fields
12
14
  [:protected]
13
15
  end
@@ -33,6 +35,7 @@ module Stripe
33
35
  context ".nested_resource_class_methods" do
34
36
  class MainResource < APIResource
35
37
  extend Stripe::APIOperations::NestedResource
38
+ OBJECT_NAME = "mainresource".freeze
36
39
  nested_resource_class_methods :nested,
37
40
  operations: %i[create retrieve update delete list]
38
41
  end
@@ -7,9 +7,6 @@ module Stripe
7
7
 
8
8
  class PaymentIntentTest < Test::Unit::TestCase
9
9
  should "be listable" do
10
- stub_request(:get, "#{Stripe.api_base}/v1/payment_intents")
11
- .to_return(body: JSON.generate(object: "list", data: [{ id: "pi_123", object: "payment_intent" }]))
12
-
13
10
  payment_intents = Stripe::PaymentIntent.list
14
11
  assert_requested :get, "#{Stripe.api_base}/v1/payment_intents"
15
12
  assert payment_intents.data.is_a?(Array)
@@ -17,27 +14,22 @@ module Stripe
17
14
  end
18
15
 
19
16
  should "be retrievable" do
20
- stub_request(:get, "#{Stripe.api_base}/v1/payment_intents/pi_123")
21
- .to_return(body: JSON.generate(id: "pi_123", object: "payment_intent"))
22
-
23
17
  payment_intent = Stripe::PaymentIntent.retrieve("pi_123")
24
18
  assert_requested :get, "#{Stripe.api_base}/v1/payment_intents/pi_123"
25
19
  assert payment_intent.is_a?(Stripe::PaymentIntent)
26
20
  end
27
21
 
28
22
  should "be creatable" do
29
- stub_request(:post, "#{Stripe.api_base}/v1/payment_intents")
30
- .to_return(body: JSON.generate(id: "pi_123", object: "payment_intent"))
31
-
32
- payment_intent = Stripe::PaymentIntent.create
23
+ payment_intent = Stripe::PaymentIntent.create(
24
+ allowed_source_types: ["card"],
25
+ amount: 1234,
26
+ currency: "usd"
27
+ )
33
28
  assert_requested :post, "#{Stripe.api_base}/v1/payment_intents"
34
29
  assert payment_intent.is_a?(Stripe::PaymentIntent)
35
30
  end
36
31
 
37
32
  should "be saveable" do
38
- stub_request(:post, "#{Stripe.api_base}/v1/payment_intents/pi_123")
39
- .to_return(body: JSON.generate(id: "pi_123", object: "payment_intent"))
40
-
41
33
  payment_intent = Stripe::PaymentIntent.construct_from(id: "pi_123", object: "payment_intent", metadata: {})
42
34
  payment_intent.metadata["key"] = "value"
43
35
  payment_intent.save
@@ -45,9 +37,6 @@ module Stripe
45
37
  end
46
38
 
47
39
  should "be updateable" do
48
- stub_request(:post, "#{Stripe.api_base}/v1/payment_intents/pi_123")
49
- .to_return(body: JSON.generate(id: "pi_123", object: "payment_intent"))
50
-
51
40
  payment_intent = Stripe::PaymentIntent.update("pi_123", metadata: { foo: "bar" })
52
41
 
53
42
  assert_requested :post, "#{Stripe.api_base}/v1/payment_intents/pi_123"
@@ -56,9 +45,6 @@ module Stripe
56
45
 
57
46
  context "#cancel" do
58
47
  should "cancel a payment_intent" do
59
- stub_request(:post, "#{Stripe.api_base}/v1/payment_intents/pi_123/cancel")
60
- .to_return(body: JSON.generate(id: "pi_123", object: "payment_intent"))
61
-
62
48
  payment_intent = Stripe::PaymentIntent.construct_from(id: "pi_123", object: "payment_intent")
63
49
  payment_intent = payment_intent.cancel
64
50
 
@@ -69,9 +55,6 @@ module Stripe
69
55
 
70
56
  context "#capture" do
71
57
  should "capture a payment_intent" do
72
- stub_request(:post, "#{Stripe.api_base}/v1/payment_intents/pi_123/capture")
73
- .to_return(body: JSON.generate(id: "pi_123", object: "payment_intent"))
74
-
75
58
  payment_intent = Stripe::PaymentIntent.construct_from(id: "pi_123", object: "payment_intent")
76
59
  payment_intent = payment_intent.capture
77
60
 
@@ -82,9 +65,6 @@ module Stripe
82
65
 
83
66
  context "#confirm" do
84
67
  should "confirm a payment_intent" do
85
- stub_request(:post, "#{Stripe.api_base}/v1/payment_intents/pi_123/confirm")
86
- .to_return(body: JSON.generate(id: "pi_123", object: "payment_intent"))
87
-
88
68
  payment_intent = Stripe::PaymentIntent.construct_from(id: "pi_123", object: "payment_intent")
89
69
  payment_intent = payment_intent.confirm
90
70
 
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.17.0
4
+ version: 3.17.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stripe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-28 00:00:00.000000000 Z
11
+ date: 2018-07-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -190,7 +190,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
190
190
  version: '0'
191
191
  requirements: []
192
192
  rubyforge_project:
193
- rubygems_version: 2.6.14
193
+ rubygems_version: 2.7.7
194
194
  signing_key:
195
195
  specification_version: 4
196
196
  summary: Ruby bindings for the Stripe API