stripe 12.1.0 → 12.2.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: 9aca4084cfbcc4eec52a2f5b1756be4ac140769e46520bd644967473468898fc
4
- data.tar.gz: b6b4350bc34d08ba00eb6791e53ec5a570345c86930149032305dd58bce9374c
3
+ metadata.gz: d5b680d02ee6c86570824cdf25eaedd693fcbc05e7bfc7eaa1de4a6227cf4551
4
+ data.tar.gz: dc04e16e292c368e7ab2415e7712d7288c02578ede0f231969ff581cf21a5566
5
5
  SHA512:
6
- metadata.gz: 5a59e650d1e896c9d3f4c549518a0837f0593f05be7c18373ad51125849edbaec032295742bf79f7727efc568edc26464307b9e285831cdd61e3ef6e9df62e14
7
- data.tar.gz: 3d0c0ab2d096538c0db2ed09f2ebb263f299fbffa524d0713c7a6026c328fc7647116270f4badcb83ea3264d64a885a78093329f30d3d2bec82bdc07fa05ace3
6
+ metadata.gz: 7a8aba64e9c064032bbe59ae18577d2ab95abc0e74eece8e780e857907637f3721e19b9b99d651349565ebd711522f7d77e06b2886787fdcdf1ce68bdd92a3a6
7
+ data.tar.gz: 2413df53d571c2de879f089ea97c8e0cc775f39b3f1a7b378576d4977474b5812efc62fe6111d92ec13ea3fd80703676d1e912cb18cf2316f8f2e2a34a4bf15f
data/CHANGELOG.md CHANGED
@@ -1,4 +1,12 @@
1
1
  # Changelog
2
+ ## 12.2.0 - 2024-07-12
3
+ * [#1430](https://github.com/stripe/stripe-ruby/pull/1430) Update generated code
4
+
5
+ * [#1433](https://github.com/stripe/stripe-ruby/pull/1433) Add usage to raw_request call
6
+ * [#1431](https://github.com/stripe/stripe-ruby/pull/1431) Add `raw_request`
7
+
8
+ - Adds the ability to make raw requests to the Stripe API, by providing an HTTP method and url. This is an alternative to using `Stripe::APIResource.request(...)` to make custom requests, which is discouraged and will be broken in a future major version.
9
+
2
10
  ## 12.1.0 - 2024-07-05
3
11
  * [#1425](https://github.com/stripe/stripe-ruby/pull/1425) Update generated code
4
12
  * Add support for `add_lines`, `remove_lines`, and `update_lines` methods on resource `Invoice`
data/OPENAPI_VERSION CHANGED
@@ -1 +1 @@
1
- v1111
1
+ v1126
data/README.md CHANGED
@@ -338,6 +338,23 @@ If your beta feature requires a `Stripe-Version` header to be sent, set the `Str
338
338
  Stripe.add_beta_version("feature_beta", "v3")
339
339
  ```
340
340
 
341
+ ### Custom requests
342
+
343
+ If you:
344
+
345
+ - would like to send a request to an undocumented API (for example you are in a private beta)
346
+ - prefer to bypass the method definitions in the library and specify your request details directly,
347
+ - used the method `Stripe::APIResource.request(...)` to specify your own requests, which will soon be broken
348
+
349
+ you can now use the `raw_request` method on `Stripe`.
350
+
351
+ ```ruby
352
+ resp = Stripe.raw_request(:post, "/v1/beta_endpoint", {param: 123}, {stripe_version: "2022-11-15; feature_beta=v3"})
353
+
354
+ # (Optional) resp is a StripeResponse. You can use `Stripe.deserialize` to get a StripeObject.
355
+ deserialized_resp = Stripe.deserialize(resp.http_body)
356
+ ```
357
+
341
358
  ## Support
342
359
 
343
360
  New features and bug fixes are released on the latest major version of the Stripe Ruby library. If you are on an older major version, we recommend that you upgrade to the latest in order to use the new features and bug fixes including those for security vulnerabilities. Older major versions of the package will continue to be available for use, but will not be receiving any updates.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 12.1.0
1
+ 12.2.0
@@ -16,7 +16,7 @@ module Stripe
16
16
  # Create sessions on-demand when customers intend to manage their subscriptions
17
17
  # and billing details.
18
18
  #
19
- # Learn more in the [integration guide](https://stripe.com/docs/billing/subscriptions/integrating-customer-portal).
19
+ # Related guide: [Customer management](https://stripe.com/customer-management)
20
20
  class Session < APIResource
21
21
  extend Stripe::APIOperations::Create
22
22
 
@@ -13,7 +13,7 @@ module Stripe
13
13
  # API. To configure and create VerificationReports, use the
14
14
  # [VerificationSession](https://stripe.com/docs/api/identity/verification_sessions) API.
15
15
  #
16
- # Related guides: [Accessing verification results](https://stripe.com/docs/identity/verification-sessions#results).
16
+ # Related guide: [Accessing verification results](https://stripe.com/docs/identity/verification-sessions#results).
17
17
  class VerificationReport < APIResource
18
18
  extend Stripe::APIOperations::List
19
19
 
@@ -5,7 +5,7 @@ module Stripe
5
5
  # A payment method domain represents a web domain that you have registered with Stripe.
6
6
  # Stripe Elements use registered payment method domains to control where certain payment methods are shown.
7
7
  #
8
- # Related guides: [Payment method domains](https://stripe.com/docs/payments/payment-methods/pmd-registration).
8
+ # Related guide: [Payment method domains](https://stripe.com/docs/payments/payment-methods/pmd-registration).
9
9
  class PaymentMethodDomain < APIResource
10
10
  extend Stripe::APIOperations::Create
11
11
  extend Stripe::APIOperations::List
@@ -115,7 +115,7 @@ module Stripe
115
115
 
116
116
  # Updates an existing subscription to match the specified parameters.
117
117
  # When changing prices or quantities, we optionally prorate the price we charge next month to make up for any price changes.
118
- # To preview how the proration is calculated, use the [upcoming invoice](https://stripe.com/docs/api/invoices/upcoming) endpoint.
118
+ # To preview how the proration is calculated, use the [create preview](https://stripe.com/docs/api/invoices/create_preview) endpoint.
119
119
  #
120
120
  # By default, we prorate subscription changes. For example, if a customer signs up on May 1 for a 100 price, they'll be billed 100 immediately. If on May 15 they switch to a 200 price, then on June 1 they'll be billed 250 (200 for a renewal of her subscription, plus a 50 prorating adjustment for half of the previous month's 100 difference). Similarly, a downgrade generates a credit that is applied to the next invoice. We also prorate when you make quantity changes.
121
121
  #
@@ -123,11 +123,11 @@ module Stripe
123
123
  #
124
124
  #
125
125
  # The billing interval is changed (for example, from monthly to yearly).
126
- # The subscription moves from free to paid, or paid to free.
126
+ # The subscription moves from free to paid.
127
127
  # A trial starts or ends.
128
128
  #
129
129
  #
130
- # In these cases, we apply a credit for the unused time on the previous price, immediately charge the customer using the new price, and reset the billing date.
130
+ # In these cases, we apply a credit for the unused time on the previous price, immediately charge the customer using the new price, and reset the billing date. Learn about how [Stripe immediately attempts payment for subscription changes](https://stripe.com/billing/subscriptions/upgrade-downgrade#immediate-payment).
131
131
  #
132
132
  # If you want to charge for an upgrade immediately, pass proration_behavior as always_invoice to create prorations, automatically invoice the customer for those proration adjustments, and attempt to collect payment. If you pass create_prorations, the prorations are created but not automatically invoiced. If you want to bill the customer for the prorations before the subscription's renewal date, you need to manually [invoice the customer](https://stripe.com/docs/api/invoices/create).
133
133
  #
@@ -462,6 +462,7 @@ module Stripe
462
462
 
463
463
  headers = request_headers(api_key, method)
464
464
  .update(Util.normalize_headers(headers))
465
+
465
466
  url = api_url(path, api_base)
466
467
 
467
468
  # Merge given query parameters with any already encoded in the path.
@@ -879,6 +880,7 @@ module Stripe
879
880
  end
880
881
 
881
882
  headers["Stripe-Version"] = config.api_version if config.api_version
883
+
882
884
  headers["Stripe-Account"] = config.stripe_account if config.stripe_account
883
885
 
884
886
  user_agent = @system_profiler.user_agent
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Stripe
4
- VERSION = "12.1.0"
4
+ VERSION = "12.2.0"
5
5
  end
data/lib/stripe.rb CHANGED
@@ -117,6 +117,31 @@ module Stripe
117
117
  version: version,
118
118
  }
119
119
  end
120
+
121
+ class RawRequest
122
+ include Stripe::APIOperations::Request
123
+
124
+ def initialize
125
+ @opts = {}
126
+ end
127
+
128
+ def execute(method, url, params = {}, opts = {}, usage = [])
129
+ resp, = execute_resource_request(method, url, params, opts, usage)
130
+
131
+ resp
132
+ end
133
+ end
134
+
135
+ # Sends a request to Stripe REST API
136
+ def self.raw_request(method, url, params = {}, opts = {})
137
+ req = RawRequest.new
138
+ req.execute(method, url, params, opts, ["raw_request"])
139
+ end
140
+
141
+ def self.deserialize(data)
142
+ data = JSON.parse(data) if data.is_a?(String)
143
+ Util.convert_to_stripe_object(data, {})
144
+ end
120
145
  end
121
146
 
122
147
  Stripe.log_level = ENV["STRIPE_LOG"] unless ENV["STRIPE_LOG"].nil?
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: 12.1.0
4
+ version: 12.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stripe
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-07-05 00:00:00.000000000 Z
11
+ date: 2024-07-12 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.