stripe 5.43.0 → 5.46.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: b9a53a5c91bca32fad7bf4d30c6d3ad682025e9dbfa49194f9287699b4ddc985
4
- data.tar.gz: c45fea791b7f752d632934c53f2733ac66979d8ad169b42557daf23e00c23154
3
+ metadata.gz: dc0fdc03553a1cb2d1d67ebe31538b25abd248d7f48ba0c6377bb8a9ff097a89
4
+ data.tar.gz: 31e2871a1f52b97e1994c3a4a4eb62068361167cb8c1d5a731244380247d2905
5
5
  SHA512:
6
- metadata.gz: 1cde2b2558c66f2fb4ce6f9eedc0d29219510a4b4a546f080e2f91945ec17b74975533db641c2cbfde697c71cd1ab865da46d1dedfaeb19142630f08f8e17c88
7
- data.tar.gz: 9d5eb1160fb1ef369ff3913a73a722490832d5ee265a08cbf14762a7f1c9aabdc3b3129728115b1b78cd6949fb38777ffa0c9a7ef63f48a9f98a05100492d384
6
+ metadata.gz: 568b6acfdd6d7824cba36b8cf7c5ca6c85a11f2c0f9081df12175045e917a321b937c81ce98ebe43f455fc49e3d95d315c8da77ff6f7427d87197c4fbf08d80e
7
+ data.tar.gz: af1ed8b0d8d5f0782a7e953a6f56834f1fe7fb91eef2eeb82178e3dff784d5781cbee9fa53ac0c6ba0301124a7672cee39659716ac5c4a881e4a51a45cfec754
data/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # Changelog
2
2
 
3
+ ## 5.46.0 - 2022-03-23
4
+ * [#1039](https://github.com/stripe/stripe-ruby/pull/1039) API Updates
5
+ * Add support for `cancel` method on resource `Refund`
6
+ * [#992](https://github.com/stripe/stripe-ruby/pull/992) Add support for Search API
7
+
8
+ ## 5.45.0 - 2022-03-01
9
+ * [#1035](https://github.com/stripe/stripe-ruby/pull/1035) API Updates
10
+ * Add support for new resource `TestHelpers.TestClock`
11
+
12
+ ## 5.44.0 - 2022-02-16
13
+ * [#1032](https://github.com/stripe/stripe-ruby/pull/1032) API Updates
14
+ * Add support for `verify_microdeposits` method on resources `PaymentIntent` and `SetupIntent`
15
+
3
16
  ## 5.43.0 - 2022-01-20
4
17
  * [#1031](https://github.com/stripe/stripe-ruby/pull/1031) API Updates
5
18
  * Add support for new resource `PaymentLink`
data/VERSION CHANGED
@@ -1 +1 @@
1
- 5.43.0
1
+ 5.46.0
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Stripe
4
+ module APIOperations
5
+ module Search
6
+ def _search(search_url, filters = {}, opts = {})
7
+ opts = Util.normalize_opts(opts)
8
+
9
+ resp, opts = execute_resource_request(:get, search_url, filters, opts)
10
+ obj = SearchResultObject.construct_from(resp.data, opts)
11
+
12
+ # set filters so that we can fetch the same limit and query
13
+ # when accessing the next page
14
+ obj.filters = filters.dup
15
+ obj
16
+ end
17
+ end
18
+ end
19
+ end
@@ -9,6 +9,7 @@ module Stripe
9
9
  {
10
10
  # data structures
11
11
  ListObject::OBJECT_NAME => ListObject,
12
+ SearchResultObject::OBJECT_NAME => SearchResultObject,
12
13
 
13
14
  # business objects
14
15
  Account::OBJECT_NAME => Account,
@@ -94,6 +95,7 @@ module Stripe
94
95
  Terminal::ConnectionToken::OBJECT_NAME => Terminal::ConnectionToken,
95
96
  Terminal::Location::OBJECT_NAME => Terminal::Location,
96
97
  Terminal::Reader::OBJECT_NAME => Terminal::Reader,
98
+ TestHelpers::TestClock::OBJECT_NAME => TestHelpers::TestClock,
97
99
  ThreeDSecure::OBJECT_NAME => ThreeDSecure,
98
100
  Token::OBJECT_NAME => Token,
99
101
  Topup::OBJECT_NAME => Topup,
@@ -12,6 +12,7 @@ module Stripe
12
12
  custom_method :cancel, http_verb: :post
13
13
  custom_method :capture, http_verb: :post
14
14
  custom_method :confirm, http_verb: :post
15
+ custom_method :verify_microdeposits, http_verb: :post
15
16
 
16
17
  def cancel(params = {}, opts = {})
17
18
  request_stripe_object(
@@ -39,5 +40,14 @@ module Stripe
39
40
  opts: opts
40
41
  )
41
42
  end
43
+
44
+ def verify_microdeposits(params = {}, opts = {})
45
+ request_stripe_object(
46
+ method: :post,
47
+ path: resource_url + "/verify_microdeposits",
48
+ params: params,
49
+ opts: opts
50
+ )
51
+ end
42
52
  end
43
53
  end
@@ -8,5 +8,16 @@ module Stripe
8
8
  include Stripe::APIOperations::Save
9
9
 
10
10
  OBJECT_NAME = "refund"
11
+
12
+ custom_method :cancel, http_verb: :post
13
+
14
+ def cancel(params = {}, opts = {})
15
+ request_stripe_object(
16
+ method: :post,
17
+ path: resource_url + "/cancel",
18
+ params: params,
19
+ opts: opts
20
+ )
21
+ end
11
22
  end
12
23
  end
@@ -11,6 +11,7 @@ module Stripe
11
11
 
12
12
  custom_method :cancel, http_verb: :post
13
13
  custom_method :confirm, http_verb: :post
14
+ custom_method :verify_microdeposits, http_verb: :post
14
15
 
15
16
  def cancel(params = {}, opts = {})
16
17
  request_stripe_object(
@@ -29,5 +30,14 @@ module Stripe
29
30
  opts: opts
30
31
  )
31
32
  end
33
+
34
+ def verify_microdeposits(params = {}, opts = {})
35
+ request_stripe_object(
36
+ method: :post,
37
+ path: resource_url + "/verify_microdeposits",
38
+ params: params,
39
+ opts: opts
40
+ )
41
+ end
32
42
  end
33
43
  end
@@ -0,0 +1,25 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ module TestHelpers
6
+ class TestClock < APIResource
7
+ extend Stripe::APIOperations::Create
8
+ include Stripe::APIOperations::Delete
9
+ extend Stripe::APIOperations::List
10
+
11
+ OBJECT_NAME = "test_helpers.test_clock"
12
+
13
+ custom_method :advance, http_verb: :post
14
+
15
+ def advance(params = {}, opts = {})
16
+ request_stripe_object(
17
+ method: :post,
18
+ path: resource_url + "/advance",
19
+ params: params,
20
+ opts: opts
21
+ )
22
+ end
23
+ end
24
+ end
25
+ end
@@ -83,6 +83,7 @@ require "stripe/resources/tax_rate"
83
83
  require "stripe/resources/terminal/connection_token"
84
84
  require "stripe/resources/terminal/location"
85
85
  require "stripe/resources/terminal/reader"
86
+ require "stripe/resources/test_helpers/test_clock"
86
87
  require "stripe/resources/three_d_secure"
87
88
  require "stripe/resources/token"
88
89
  require "stripe/resources/topup"
@@ -0,0 +1,86 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Stripe
4
+ class SearchResultObject < StripeObject
5
+ include Enumerable
6
+ include Stripe::APIOperations::Search
7
+ include Stripe::APIOperations::Request
8
+
9
+ OBJECT_NAME = "search_result"
10
+
11
+ # This accessor allows a `SearchResultObject` to inherit various filters
12
+ # that were given to a predecessor. This allows for things like consistent
13
+ # limits, expansions, and predicates as a user pages through resources.
14
+ attr_accessor :filters
15
+
16
+ # An empty search result object. This is returned from +next+ when we know
17
+ # that there isn't a next page in order to replicate the behavior of the API
18
+ # when it attempts to return a page beyond the last.
19
+ def self.empty_search_result(opts = {})
20
+ SearchResultObject.construct_from({ data: [] }, opts)
21
+ end
22
+
23
+ def initialize(*args)
24
+ super
25
+ self.filters = {}
26
+ end
27
+
28
+ def [](key)
29
+ case key
30
+ when String, Symbol
31
+ super
32
+ else
33
+ raise ArgumentError,
34
+ "You tried to access the #{key.inspect} index, but " \
35
+ "SearchResultObject types only support String keys. " \
36
+ "(HINT: Search calls return an object with a 'data' (which is " \
37
+ "the data array). You likely want to call #data[#{key.inspect}])"
38
+ end
39
+ end
40
+
41
+ # Iterates through each resource in the page represented by the current
42
+ # `SearchListObject`.
43
+ #
44
+ # Note that this method makes no effort to fetch a new page when it gets to
45
+ # the end of the current page's resources. See also +auto_paging_each+.
46
+ def each(&blk)
47
+ data.each(&blk)
48
+ end
49
+
50
+ # Returns true if the page object contains no elements.
51
+ def empty?
52
+ data.empty?
53
+ end
54
+
55
+ # Iterates through each resource in all pages, making additional fetches to
56
+ # the API as necessary.
57
+ #
58
+ # Note that this method will make as many API calls as necessary to fetch
59
+ # all resources. For more granular control, please see +each+ and
60
+ # +next_search_result_page+.
61
+ def auto_paging_each(&blk)
62
+ return enum_for(:auto_paging_each) unless block_given?
63
+
64
+ page = self
65
+
66
+ loop do
67
+ page.each(&blk)
68
+ page = page.next_search_result_page
69
+
70
+ break if page.empty?
71
+ end
72
+ end
73
+
74
+ # Fetches the next page in the resource list (if there is one).
75
+ #
76
+ # This method will try to respect the limit of the current page. If none
77
+ # was given, the default limit will be fetched again.
78
+ def next_search_result_page(params = {}, opts = {})
79
+ return self.class.empty_search_result(opts) unless has_more
80
+
81
+ params = filters.merge(page: next_page).merge(params)
82
+
83
+ _search(url, params, opts)
84
+ end
85
+ end
86
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Stripe
4
- VERSION = "5.43.0"
4
+ VERSION = "5.46.0"
5
5
  end
data/lib/stripe.rb CHANGED
@@ -24,6 +24,7 @@ require "stripe/api_operations/list"
24
24
  require "stripe/api_operations/nested_resource"
25
25
  require "stripe/api_operations/request"
26
26
  require "stripe/api_operations/save"
27
+ require "stripe/api_operations/search"
27
28
 
28
29
  # API resource support classes
29
30
  require "stripe/errors"
@@ -35,6 +36,7 @@ require "stripe/stripe_client"
35
36
  require "stripe/stripe_object"
36
37
  require "stripe/stripe_response"
37
38
  require "stripe/list_object"
39
+ require "stripe/search_result_object"
38
40
  require "stripe/error_object"
39
41
  require "stripe/api_resource"
40
42
  require "stripe/singleton_api_resource"
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: 5.43.0
4
+ version: 5.46.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stripe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-20 00:00:00.000000000 Z
11
+ date: 2022-03-23 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Stripe is the easiest way to accept payments online. See https://stripe.com
14
14
  for details.
@@ -36,6 +36,7 @@ files:
36
36
  - lib/stripe/api_operations/nested_resource.rb
37
37
  - lib/stripe/api_operations/request.rb
38
38
  - lib/stripe/api_operations/save.rb
39
+ - lib/stripe/api_operations/search.rb
39
40
  - lib/stripe/api_resource.rb
40
41
  - lib/stripe/connection_manager.rb
41
42
  - lib/stripe/error_object.rb
@@ -128,6 +129,7 @@ files:
128
129
  - lib/stripe/resources/terminal/connection_token.rb
129
130
  - lib/stripe/resources/terminal/location.rb
130
131
  - lib/stripe/resources/terminal/reader.rb
132
+ - lib/stripe/resources/test_helpers/test_clock.rb
131
133
  - lib/stripe/resources/three_d_secure.rb
132
134
  - lib/stripe/resources/token.rb
133
135
  - lib/stripe/resources/topup.rb
@@ -135,6 +137,7 @@ files:
135
137
  - lib/stripe/resources/usage_record.rb
136
138
  - lib/stripe/resources/usage_record_summary.rb
137
139
  - lib/stripe/resources/webhook_endpoint.rb
140
+ - lib/stripe/search_result_object.rb
138
141
  - lib/stripe/singleton_api_resource.rb
139
142
  - lib/stripe/stripe_client.rb
140
143
  - lib/stripe/stripe_configuration.rb