stripe 10.1.0 → 10.2.0.pre.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +241 -40
  3. data/OPENAPI_VERSION +1 -1
  4. data/README.md +11 -0
  5. data/VERSION +1 -1
  6. data/lib/stripe/api_operations/request.rb +2 -0
  7. data/lib/stripe/api_version.rb +1 -0
  8. data/lib/stripe/object_types.rb +21 -0
  9. data/lib/stripe/request_signing_authenticator.rb +83 -0
  10. data/lib/stripe/resources/account_notice.rb +14 -0
  11. data/lib/stripe/resources/capital/financing_offer.rb +32 -0
  12. data/lib/stripe/resources/capital/financing_summary.rb +12 -0
  13. data/lib/stripe/resources/capital/financing_transaction.rb +13 -0
  14. data/lib/stripe/resources/confirmation_token.rb +11 -0
  15. data/lib/stripe/resources/customer_session.rb +12 -0
  16. data/lib/stripe/resources/financial_connections/account.rb +39 -0
  17. data/lib/stripe/resources/financial_connections/account_inferred_balance.rb +13 -0
  18. data/lib/stripe/resources/financial_connections/transaction.rb +13 -0
  19. data/lib/stripe/resources/gift_cards/card.rb +25 -0
  20. data/lib/stripe/resources/gift_cards/transaction.rb +56 -0
  21. data/lib/stripe/resources/invoice.rb +21 -0
  22. data/lib/stripe/resources/invoice_payment.rb +11 -0
  23. data/lib/stripe/resources/issuing/credit_underwriting_record.rb +69 -0
  24. data/lib/stripe/resources/issuing/personalization_design.rb +77 -0
  25. data/lib/stripe/resources/issuing/physical_bundle.rb +13 -0
  26. data/lib/stripe/resources/margin.rb +14 -0
  27. data/lib/stripe/resources/order.rb +89 -0
  28. data/lib/stripe/resources/quote.rb +94 -0
  29. data/lib/stripe/resources/quote_phase.rb +29 -0
  30. data/lib/stripe/resources/quote_preview_invoice.rb +42 -0
  31. data/lib/stripe/resources/quote_preview_subscription_schedule.rb +10 -0
  32. data/lib/stripe/resources/subscription_schedule.rb +18 -0
  33. data/lib/stripe/resources/tax/form.rb +39 -0
  34. data/lib/stripe/resources/terminal/reader.rb +54 -0
  35. data/lib/stripe/resources.rb +20 -0
  36. data/lib/stripe/stripe_client.rb +60 -26
  37. data/lib/stripe/stripe_configuration.rb +2 -0
  38. data/lib/stripe/util.rb +8 -1
  39. data/lib/stripe/version.rb +1 -1
  40. data/lib/stripe.rb +46 -0
  41. metadata +24 -3
data/lib/stripe/util.rb CHANGED
@@ -7,6 +7,7 @@ module Stripe
7
7
  # Options that a user is allowed to specify.
8
8
  OPTS_USER_SPECIFIED = Set[
9
9
  :api_key,
10
+ :authenticator,
10
11
  :idempotency_key,
11
12
  :stripe_account,
12
13
  :stripe_version
@@ -281,7 +282,13 @@ module Stripe
281
282
  when String
282
283
  { api_key: opts }
283
284
  when Hash
284
- check_api_key!(opts.fetch(:api_key)) if opts.key?(:api_key)
285
+ # If the user is using request signing for authentication,
286
+ # no need to check the api_key per request.
287
+ if !(opts.key?(:client) &&
288
+ opts.fetch(:client).config.authenticator) &&
289
+ opts.key?(:api_key)
290
+ check_api_key!(opts.fetch(:api_key))
291
+ end
285
292
  # Explicitly use dup here instead of clone to avoid preserving freeze
286
293
  # state on input params.
287
294
  opts.dup
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Stripe
4
- VERSION = "10.1.0"
4
+ VERSION = "10.2.0-beta.1"
5
5
  end
data/lib/stripe.rb CHANGED
@@ -13,6 +13,7 @@ require "set"
13
13
  require "socket"
14
14
  require "uri"
15
15
  require "forwardable"
16
+ require "base64"
16
17
 
17
18
  # Version
18
19
  require "stripe/api_version"
@@ -44,6 +45,7 @@ require "stripe/api_resource_test_helpers"
44
45
  require "stripe/singleton_api_resource"
45
46
  require "stripe/webhook"
46
47
  require "stripe/stripe_configuration"
48
+ require "stripe/request_signing_authenticator"
47
49
 
48
50
  # Named API resources
49
51
  require "stripe/resources"
@@ -70,6 +72,7 @@ module Stripe
70
72
 
71
73
  # User configurable options
72
74
  def_delegators :@config, :api_key, :api_key=
75
+ def_delegators :@config, :authenticator, :authenticator=
73
76
  def_delegators :@config, :api_version, :api_version=
74
77
  def_delegators :@config, :stripe_account, :stripe_account=
75
78
  def_delegators :@config, :api_base, :api_base=
@@ -116,6 +119,49 @@ module Stripe
116
119
  version: version,
117
120
  }
118
121
  end
122
+
123
+ class Preview
124
+ def self._get_default_opts(opts)
125
+ { api_mode: :preview }.merge(opts)
126
+ end
127
+
128
+ def self.get(url, opts = {})
129
+ Stripe.raw_request(:get, url, {}, _get_default_opts(opts))
130
+ end
131
+
132
+ def self.post(url, params = {}, opts = {})
133
+ Stripe.raw_request(:post, url, params, _get_default_opts(opts))
134
+ end
135
+
136
+ def self.delete(url, opts = {})
137
+ Stripe.raw_request(:delete, url, {}, _get_default_opts(opts))
138
+ end
139
+ end
140
+
141
+ class RawRequest
142
+ include Stripe::APIOperations::Request
143
+
144
+ def initialize
145
+ @opts = {}
146
+ end
147
+
148
+ def execute(method, url, params = {}, opts = {})
149
+ resp, = execute_resource_request(method, url, params, opts)
150
+
151
+ resp
152
+ end
153
+ end
154
+
155
+ # Sends a request to Stripe REST API
156
+ def self.raw_request(method, url, params = {}, opts = {})
157
+ req = RawRequest.new
158
+ req.execute(method, url, params, opts)
159
+ end
160
+
161
+ def self.deserialize(data)
162
+ data = JSON.parse(data) if data.is_a?(String)
163
+ Util.convert_to_stripe_object(data, {})
164
+ end
119
165
  end
120
166
 
121
167
  Stripe.log_level = ENV["STRIPE_LOG"] unless ENV["STRIPE_LOG"].nil?
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stripe
3
3
  version: !ruby/object:Gem::Version
4
- version: 10.1.0
4
+ version: 10.2.0.pre.beta.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stripe
@@ -50,9 +50,11 @@ files:
50
50
  - lib/stripe/multipart_encoder.rb
51
51
  - lib/stripe/oauth.rb
52
52
  - lib/stripe/object_types.rb
53
+ - lib/stripe/request_signing_authenticator.rb
53
54
  - lib/stripe/resources.rb
54
55
  - lib/stripe/resources/account.rb
55
56
  - lib/stripe/resources/account_link.rb
57
+ - lib/stripe/resources/account_notice.rb
56
58
  - lib/stripe/resources/account_session.rb
57
59
  - lib/stripe/resources/alipay_account.rb
58
60
  - lib/stripe/resources/apple_pay_domain.rb
@@ -65,10 +67,14 @@ files:
65
67
  - lib/stripe/resources/billing_portal/configuration.rb
66
68
  - lib/stripe/resources/billing_portal/session.rb
67
69
  - lib/stripe/resources/capability.rb
70
+ - lib/stripe/resources/capital/financing_offer.rb
71
+ - lib/stripe/resources/capital/financing_summary.rb
72
+ - lib/stripe/resources/capital/financing_transaction.rb
68
73
  - lib/stripe/resources/card.rb
69
74
  - lib/stripe/resources/cash_balance.rb
70
75
  - lib/stripe/resources/charge.rb
71
76
  - lib/stripe/resources/checkout/session.rb
77
+ - lib/stripe/resources/confirmation_token.rb
72
78
  - lib/stripe/resources/country_spec.rb
73
79
  - lib/stripe/resources/coupon.rb
74
80
  - lib/stripe/resources/credit_note.rb
@@ -76,6 +82,7 @@ files:
76
82
  - lib/stripe/resources/customer.rb
77
83
  - lib/stripe/resources/customer_balance_transaction.rb
78
84
  - lib/stripe/resources/customer_cash_balance_transaction.rb
85
+ - lib/stripe/resources/customer_session.rb
79
86
  - lib/stripe/resources/discount.rb
80
87
  - lib/stripe/resources/dispute.rb
81
88
  - lib/stripe/resources/ephemeral_key.rb
@@ -84,24 +91,34 @@ files:
84
91
  - lib/stripe/resources/file.rb
85
92
  - lib/stripe/resources/file_link.rb
86
93
  - lib/stripe/resources/financial_connections/account.rb
94
+ - lib/stripe/resources/financial_connections/account_inferred_balance.rb
87
95
  - lib/stripe/resources/financial_connections/account_owner.rb
88
96
  - lib/stripe/resources/financial_connections/account_ownership.rb
89
97
  - lib/stripe/resources/financial_connections/session.rb
98
+ - lib/stripe/resources/financial_connections/transaction.rb
90
99
  - lib/stripe/resources/funding_instructions.rb
100
+ - lib/stripe/resources/gift_cards/card.rb
101
+ - lib/stripe/resources/gift_cards/transaction.rb
91
102
  - lib/stripe/resources/identity/verification_report.rb
92
103
  - lib/stripe/resources/identity/verification_session.rb
93
104
  - lib/stripe/resources/invoice.rb
94
105
  - lib/stripe/resources/invoice_item.rb
95
106
  - lib/stripe/resources/invoice_line_item.rb
107
+ - lib/stripe/resources/invoice_payment.rb
96
108
  - lib/stripe/resources/issuing/authorization.rb
97
109
  - lib/stripe/resources/issuing/card.rb
98
110
  - lib/stripe/resources/issuing/cardholder.rb
111
+ - lib/stripe/resources/issuing/credit_underwriting_record.rb
99
112
  - lib/stripe/resources/issuing/dispute.rb
113
+ - lib/stripe/resources/issuing/personalization_design.rb
114
+ - lib/stripe/resources/issuing/physical_bundle.rb
100
115
  - lib/stripe/resources/issuing/token.rb
101
116
  - lib/stripe/resources/issuing/transaction.rb
102
117
  - lib/stripe/resources/line_item.rb
103
118
  - lib/stripe/resources/login_link.rb
104
119
  - lib/stripe/resources/mandate.rb
120
+ - lib/stripe/resources/margin.rb
121
+ - lib/stripe/resources/order.rb
105
122
  - lib/stripe/resources/payment_intent.rb
106
123
  - lib/stripe/resources/payment_link.rb
107
124
  - lib/stripe/resources/payment_method.rb
@@ -114,6 +131,9 @@ files:
114
131
  - lib/stripe/resources/product.rb
115
132
  - lib/stripe/resources/promotion_code.rb
116
133
  - lib/stripe/resources/quote.rb
134
+ - lib/stripe/resources/quote_phase.rb
135
+ - lib/stripe/resources/quote_preview_invoice.rb
136
+ - lib/stripe/resources/quote_preview_subscription_schedule.rb
117
137
  - lib/stripe/resources/radar/early_fraud_warning.rb
118
138
  - lib/stripe/resources/radar/value_list.rb
119
139
  - lib/stripe/resources/radar/value_list_item.rb
@@ -134,6 +154,7 @@ files:
134
154
  - lib/stripe/resources/subscription_schedule.rb
135
155
  - lib/stripe/resources/tax/calculation.rb
136
156
  - lib/stripe/resources/tax/calculation_line_item.rb
157
+ - lib/stripe/resources/tax/form.rb
137
158
  - lib/stripe/resources/tax/registration.rb
138
159
  - lib/stripe/resources/tax/settings.rb
139
160
  - lib/stripe/resources/tax/transaction.rb
@@ -194,9 +215,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
194
215
  version: 2.3.0
195
216
  required_rubygems_version: !ruby/object:Gem::Requirement
196
217
  requirements:
197
- - - ">="
218
+ - - ">"
198
219
  - !ruby/object:Gem::Version
199
- version: '0'
220
+ version: 1.3.1
200
221
  requirements: []
201
222
  rubygems_version: 3.3.26
202
223
  signing_key: