stripe 3.6.0 → 3.7.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fce7c416687a674cc3e18f9bce163fc7d0b33ade
4
- data.tar.gz: c0029ea90f92b4efb77a3364d2aa515c3340ed36
3
+ metadata.gz: 6459fe4e17f22379c48abcbfa329299988905193
4
+ data.tar.gz: dd77754bb1759b1d44517f0028e2eba9f45c0b63
5
5
  SHA512:
6
- metadata.gz: 54bc6830f3379c2ed2391ec15fe640af867f2aaf2dfd317b926a059d19aa8539c71387c852a30fdd0724e36d885b01bb43740fed307b7b5cd4a56cf105ceaad0
7
- data.tar.gz: ea69c31f24db48ed9a7d37ce133805be8004fa82a92c9deddf6aaad6127fa4d4326d12892f40fe73d60f16ca404e31646a2d896f36f6dae0edd94a8064f325b9
6
+ metadata.gz: bb6cf5b6f13f6147049609a1e5c3c1d34a93529611bd9aa0e5a3568eec1532d9f991f91b4d9c51b0e1ad833b88cebe3bbcd00d1d341b812517f93a9f86cf0b02
7
+ data.tar.gz: 0a4f934af55f2b2167672e37f5b8fc792002fc31dee67f952c94b50d79a26634f7b1f01f4a10810f5f0f1d07e4367189910b987318b992e115c90455ed3a490b
@@ -1,16 +1,16 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2017-10-12 18:19:29 +0200 using RuboCop version 0.50.0.
3
+ # on 2017-10-26 15:43:11 +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
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- # Offense count: 18
9
+ # Offense count: 19
10
10
  Metrics/AbcSize:
11
11
  Max: 49
12
12
 
13
- # Offense count: 24
13
+ # Offense count: 27
14
14
  # Configuration parameters: CountComments, ExcludedMethods.
15
15
  Metrics/BlockLength:
16
16
  Max: 455
@@ -20,17 +20,17 @@ Metrics/BlockLength:
20
20
  Metrics/ClassLength:
21
21
  Max: 583
22
22
 
23
- # Offense count: 8
23
+ # Offense count: 10
24
24
  Metrics/CyclomaticComplexity:
25
25
  Max: 13
26
26
 
27
- # Offense count: 215
27
+ # Offense count: 257
28
28
  # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
29
29
  # URISchemes: http, https
30
30
  Metrics/LineLength:
31
31
  Max: 310
32
32
 
33
- # Offense count: 31
33
+ # Offense count: 32
34
34
  # Configuration parameters: CountComments.
35
35
  Metrics/MethodLength:
36
36
  Max: 47
@@ -38,14 +38,14 @@ Metrics/MethodLength:
38
38
  # Offense count: 1
39
39
  # Configuration parameters: CountComments.
40
40
  Metrics/ModuleLength:
41
- Max: 302
41
+ Max: 303
42
42
 
43
43
  # Offense count: 5
44
44
  # Configuration parameters: CountKeywordArgs.
45
45
  Metrics/ParameterLists:
46
46
  Max: 7
47
47
 
48
- # Offense count: 4
48
+ # Offense count: 5
49
49
  Metrics/PerceivedComplexity:
50
50
  Max: 15
51
51
 
@@ -1,30 +1,33 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.7.0 - 2017-10-26
4
+ * [#603](https://github.com/stripe/stripe-ruby/pull/603) Support for listing source transactions
5
+
3
6
  ## 3.6.0 - 2017-10-17
4
- * [#597](https://github.com/stripe/stripe-ruby#597) Add static methods to manipulate resources from parent
7
+ * [#597](https://github.com/stripe/stripe-ruby/pull/597) Add static methods to manipulate resources from parent
5
8
  * `Account` gains methods for external accounts and login links (e.g. `.create_account`, `create_login_link`)
6
9
  * `ApplicationFee` gains methods for refunds
7
10
  * `Customer` gains methods for sources
8
11
  * `Transfer` gains methods for reversals
9
12
 
10
13
  ## 3.5.3 - 2017-10-16
11
- * [#594](https://github.com/stripe/stripe-ruby#594) Make sure that `StripeObject`'s `#deep_copy` maintains original class
12
- * [#595](https://github.com/stripe/stripe-ruby#595) Allow `Object#method` to be called on `StripeObject` even if it conflicts with an accessor
13
- * [#596](https://github.com/stripe/stripe-ruby#596) Encode arrays as integer-indexed hashes where appropriate
14
- * [#598](https://github.com/stripe/stripe-ruby#598) Don't persist `idempotency_key` opt between requests
14
+ * [#594](https://github.com/stripe/stripe-ruby/pull/594) Make sure that `StripeObject`'s `#deep_copy` maintains original class
15
+ * [#595](https://github.com/stripe/stripe-ruby/pull/595) Allow `Object#method` to be called on `StripeObject` even if it conflicts with an accessor
16
+ * [#596](https://github.com/stripe/stripe-ruby/pull/596) Encode arrays as integer-indexed hashes where appropriate
17
+ * [#598](https://github.com/stripe/stripe-ruby/pull/598) Don't persist `idempotency_key` opt between requests
15
18
 
16
19
  ## 3.5.2 - 2017-10-13
17
- * [#592](https://github.com/stripe/stripe-ruby#592) Bring back `Marshal.dump/load` support with custom marshal encoder/decoder
20
+ * [#592](https://github.com/stripe/stripe-ruby/pull/592) Bring back `Marshal.dump/load` support with custom marshal encoder/decoder
18
21
 
19
22
  ## 3.5.1 - 2017-10-12
20
- * [#591](https://github.com/stripe/stripe-ruby#591) Use thread-local `StripeClient` instances for thread safety
23
+ * [#591](https://github.com/stripe/stripe-ruby/pull/591) Use thread-local `StripeClient` instances for thread safety
21
24
 
22
25
  ## 3.5.0 - 2017-10-11
23
- * [#589](https://github.com/stripe/stripe-ruby#589) Rename source `delete` to `detach` (and deprecate the former)
26
+ * [#589](https://github.com/stripe/stripe-ruby/pull/589) Rename source `delete` to `detach` (and deprecate the former)
24
27
 
25
28
  ## 3.4.1 - 2017-10-05
26
- * [#586](https://github.com/stripe/stripe-ruby#586) Log query strings as well as form bodies with STRIPE_LOG
27
- * [#588](https://github.com/stripe/stripe-ruby#588) Require minimum Faraday 0.10 for bug fix in parameter encoding
29
+ * [#586](https://github.com/stripe/stripe-ruby/pull/586) Log query strings as well as form bodies with STRIPE_LOG
30
+ * [#588](https://github.com/stripe/stripe-ruby/pull/588) Require minimum Faraday 0.10 for bug fix in parameter encoding
28
31
 
29
32
  ## 3.4.0 - 2017-09-20
30
33
  * Mark legacy Bitcoin API as deprecated, and remove corresponding tests
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.6.0
1
+ 3.7.0
@@ -68,6 +68,7 @@ require "stripe/refund"
68
68
  require "stripe/reversal"
69
69
  require "stripe/sku"
70
70
  require "stripe/source"
71
+ require "stripe/source_transaction"
71
72
  require "stripe/subscription"
72
73
  require "stripe/subscription_item"
73
74
  require "stripe/three_d_secure"
@@ -10,7 +10,8 @@ module Stripe
10
10
  OBJECT_NAME = "account".freeze
11
11
 
12
12
  save_nested_resource :external_account
13
- nested_resource_class_methods :external_account
13
+ nested_resource_class_methods :external_account,
14
+ operations: %i[create retrieve update delete list]
14
15
  nested_resource_class_methods :login_link, operations: %i[create]
15
16
 
16
17
  # This method is deprecated. Please use `#external_account=` instead.
@@ -2,7 +2,7 @@ module Stripe
2
2
  module APIOperations
3
3
  # Adds methods to help manipulate a subresource from its parent resource so
4
4
  # that it's possible to do so from a static context (i.e. without a
5
- # pre-existing collection of subresources on the parent).
5
+ # pre-existing collection of subresources on the parent).
6
6
  #
7
7
  # For examle, a transfer gains the static methods for reversals so that the
8
8
  # methods `.create_reversal`, `.retrieve_reversal`, `.update_reversal`,
@@ -10,7 +10,7 @@ module Stripe
10
10
  module NestedResource
11
11
  def nested_resource_class_methods(resource, path: nil, operations: nil)
12
12
  path ||= "#{resource}s"
13
- operations ||= %i[create retrieve update delete list]
13
+ raise ArgumentError, "operations array required" if operations.nil?
14
14
 
15
15
  resource_url_method = :"#{resource}s_url"
16
16
  define_singleton_method(resource_url_method) do |id, nested_id = nil|
@@ -9,7 +9,8 @@ module Stripe
9
9
  OBJECT_NAME = "customer".freeze
10
10
 
11
11
  save_nested_resource :source
12
- nested_resource_class_methods :source
12
+ nested_resource_class_methods :source,
13
+ operations: %i[create retrieve update delete list]
13
14
 
14
15
  # The API request for deleting a card or bank account and for detaching a
15
16
  # source object are the same.
@@ -23,6 +23,11 @@ module Stripe
23
23
  extend Gem::Deprecate
24
24
  deprecate :delete, "#detach", 2017, 10
25
25
 
26
+ def source_transactions(params = {}, opts = {})
27
+ resp, opts = request(:get, resource_url + "/source_transactions", params, Util.normalize_opts(opts))
28
+ Util.convert_to_stripe_object(resp.data, opts)
29
+ end
30
+
26
31
  def verify(params = {}, opts = {})
27
32
  resp, opts = request(:post, resource_url + "/verify", params, Util.normalize_opts(opts))
28
33
  initialize_from(resp.data, opts)
@@ -0,0 +1,5 @@
1
+ module Stripe
2
+ class SourceTransaction < StripeObject
3
+ OBJECT_NAME = "source_transaction".freeze
4
+ end
5
+ end
@@ -77,6 +77,7 @@ module Stripe
77
77
  Reversal::OBJECT_NAME => Reversal,
78
78
  SKU::OBJECT_NAME => SKU,
79
79
  Source::OBJECT_NAME => Source,
80
+ SourceTransaction::OBJECT_NAME => SourceTransaction,
80
81
  Subscription::OBJECT_NAME => Subscription,
81
82
  SubscriptionItem::OBJECT_NAME => SubscriptionItem,
82
83
  ThreeDSecure::OBJECT_NAME => ThreeDSecure,
@@ -1,3 +1,3 @@
1
1
  module Stripe
2
- VERSION = "3.6.0".freeze
2
+ VERSION = "3.7.0".freeze
3
3
  end
@@ -31,7 +31,8 @@ module Stripe
31
31
  context ".nested_resource_class_methods" do
32
32
  class MainResource < APIResource
33
33
  extend Stripe::APIOperations::NestedResource
34
- nested_resource_class_methods :nested
34
+ nested_resource_class_methods :nested,
35
+ operations: %i[create retrieve update delete list]
35
36
  end
36
37
 
37
38
  should "define a create method" do
@@ -0,0 +1,28 @@
1
+ require File.expand_path("../../test_helper", __FILE__)
2
+
3
+ module Stripe
4
+ class SourceTransactionTest < Test::Unit::TestCase
5
+ setup do
6
+ @source = Stripe::Source.retrieve("src_123")
7
+ end
8
+
9
+ should "be listable" do
10
+ # TODO: remove the stub once stripe-mock supports /v1/sources/src_.../source_transactions
11
+ stub_request(:get, "#{Stripe.api_base}/v1/sources/#{@source.id}/source_transactions")
12
+ .to_return(body: JSON.generate(
13
+ object: "list",
14
+ data: [
15
+ {
16
+ object: "source_transaction",
17
+ },
18
+ ]
19
+ ))
20
+
21
+ transactions = @source.source_transactions
22
+
23
+ assert_requested :get, "#{Stripe.api_base}/v1/sources/#{@source.id}/source_transactions"
24
+ assert transactions.data.is_a?(Array)
25
+ assert transactions.first.is_a?(Stripe::SourceTransaction)
26
+ end
27
+ end
28
+ 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.6.0
4
+ version: 3.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stripe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-18 00:00:00.000000000 Z
11
+ date: 2017-10-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -94,6 +94,7 @@ files:
94
94
  - lib/stripe/singleton_api_resource.rb
95
95
  - lib/stripe/sku.rb
96
96
  - lib/stripe/source.rb
97
+ - lib/stripe/source_transaction.rb
97
98
  - lib/stripe/stripe_client.rb
98
99
  - lib/stripe/stripe_object.rb
99
100
  - lib/stripe/stripe_response.rb
@@ -145,6 +146,7 @@ files:
145
146
  - test/stripe/reversal_test.rb
146
147
  - test/stripe/sku_test.rb
147
148
  - test/stripe/source_test.rb
149
+ - test/stripe/source_transaction_test.rb
148
150
  - test/stripe/stripe_client_test.rb
149
151
  - test/stripe/stripe_object_test.rb
150
152
  - test/stripe/stripe_response_test.rb
@@ -222,6 +224,7 @@ test_files:
222
224
  - test/stripe/reversal_test.rb
223
225
  - test/stripe/sku_test.rb
224
226
  - test/stripe/source_test.rb
227
+ - test/stripe/source_transaction_test.rb
225
228
  - test/stripe/stripe_client_test.rb
226
229
  - test/stripe/stripe_object_test.rb
227
230
  - test/stripe/stripe_response_test.rb