stripe 8.1.0.pre.beta.4 → 8.2.0.pre.beta.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
2
  SHA256:
3
- metadata.gz: 9f3aaefa63af0a824e48de98bd70480843c2567ec4f928226332edc0f23e0d0a
4
- data.tar.gz: 16f667361a1b30a975fb513eaef27bf7929db7793b48ab2594fa25cb1b71e7b5
3
+ metadata.gz: 86e0c712e8155324601cf71b098b91c252c22473bbbf3a671195c815ba815cfe
4
+ data.tar.gz: 97ce27efffe0ffa8f75daf0cf13a18ac3700ed7633df03245c5028be46b5421a
5
5
  SHA512:
6
- metadata.gz: '0294d06cac175e6a48a06bf5b689fbaf4492ecd8b77064d9d53b3a4760dee1b8d8da23964215a9941deff6d3ac93699887847a35a4483d7abcd78434ec9ac705'
7
- data.tar.gz: 8d1279f7662f535097bc41917e73a3c601604e41b52ce3872c5bddd9f98de60e33873bfd17ab8b4c969414c95bdb0e238b4c41f26881f4f38c7ed7d12e30b190
6
+ metadata.gz: 1e5b084e781ede95c6e2ae09151f1bb06129dea7415738a28e615ee38cf4d95139ee96ac78b57d09b27eb1f274f02c03f75ecc252402af59d774673977e79454
7
+ data.tar.gz: a603298931ad90e6d0511e538b0d01434b9b89355d5ff3491f62ee9f0dbff3b4cb4ec4c4be94762b2447dc069976dc8ac60618627afe1899a42930aa64ca45fc
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 8.2.0-beta.1 - 2023-01-12
4
+ * [#1167](https://github.com/stripe/stripe-ruby/pull/1167) API Updates for beta branch
5
+ * Updated stable APIs to the latest version
6
+ * Change `quote.draft_quote` implementation to from calling `POST /v1/quotes/{quote}/draft` to `POST /v1/quotes/{quote}/mark_draft`
7
+ * Add support for `Tax::Register` resource
8
+
9
+ ## 8.1.0 - 2023-01-12
10
+ * [#1162](https://github.com/stripe/stripe-ruby/pull/1162) Improve request events instrumentation
11
+
3
12
  ## 8.1.0-beta.4 - 2023-01-05
4
13
  * [#1164](https://github.com/stripe/stripe-ruby/pull/1164) API Updates for beta branch
5
14
  * Updated stable APIs to the latest version
data/OPENAPI_VERSION CHANGED
@@ -1 +1 @@
1
- v217
1
+ v218
data/VERSION CHANGED
@@ -1 +1 @@
1
- 8.1.0-beta.4
1
+ 8.2.0-beta.1
@@ -33,6 +33,10 @@ module Stripe
33
33
  attr_reader :num_retries
34
34
  attr_reader :path
35
35
  attr_reader :request_id
36
+ attr_reader :response_header
37
+ attr_reader :response_body
38
+ attr_reader :request_header
39
+ attr_reader :request_body
36
40
 
37
41
  # Arbitrary user-provided data in the form of a Ruby hash that's passed
38
42
  # from subscribers on `request_begin` to subscribers on `request_end`.
@@ -40,19 +44,53 @@ module Stripe
40
44
  # in `request_end`.
41
45
  attr_reader :user_data
42
46
 
43
- def initialize(duration:, http_status:, method:, num_retries:, path:,
44
- request_id:, user_data: nil)
45
- @duration = duration
46
- @http_status = http_status
47
- @method = method
47
+ def initialize(request_context:, response_context:,
48
+ num_retries:, user_data: nil)
49
+ @duration = request_context.duration
50
+ @http_status = response_context.http_status
51
+ @method = request_context.method
48
52
  @num_retries = num_retries
49
- @path = path
50
- @request_id = request_id
53
+ @path = request_context.path
54
+ @request_id = request_context.request_id
51
55
  @user_data = user_data
56
+ @response_header = response_context.header
57
+ @response_body = response_context.body
58
+ @request_header = request_context.header
59
+ @request_body = request_context.body
52
60
  freeze
53
61
  end
54
62
  end
55
63
 
64
+ class RequestContext
65
+ attr_reader :duration
66
+ attr_reader :method
67
+ attr_reader :path
68
+ attr_reader :request_id
69
+ attr_reader :body
70
+ attr_reader :header
71
+
72
+ def initialize(duration:, context:, header:)
73
+ @duration = duration
74
+ @method = context.method
75
+ @path = context.path
76
+ @request_id = context.request_id
77
+ @body = context.body
78
+ @header = header
79
+ end
80
+ end
81
+
82
+ class ResponseContext
83
+ attr_reader :http_status
84
+ attr_reader :body
85
+ attr_reader :header
86
+
87
+ def initialize(http_status:, response:)
88
+ @http_status = http_status
89
+ @header = response ? response.to_hash : nil
90
+ @body = response ? response.body : nil
91
+ end
92
+ end
93
+
56
94
  # This class was renamed for consistency. This alias is here for backwards
57
95
  # compatibility.
58
96
  RequestEvent = RequestEndEvent
@@ -98,6 +98,7 @@ module Stripe
98
98
  SubscriptionItem::OBJECT_NAME => SubscriptionItem,
99
99
  SubscriptionSchedule::OBJECT_NAME => SubscriptionSchedule,
100
100
  Tax::Calculation::OBJECT_NAME => Tax::Calculation,
101
+ Tax::Registration::OBJECT_NAME => Tax::Registration,
101
102
  Tax::Transaction::OBJECT_NAME => Tax::Transaction,
102
103
  TaxCode::OBJECT_NAME => TaxCode,
103
104
  TaxId::OBJECT_NAME => TaxId,
@@ -32,7 +32,7 @@ module Stripe
32
32
  def draft_quote(params = {}, opts = {})
33
33
  request_stripe_object(
34
34
  method: :post,
35
- path: format("/v1/quotes/%<quote>s/draft", { quote: CGI.escape(self["id"]) }),
35
+ path: format("/v1/quotes/%<quote>s/mark_draft", { quote: CGI.escape(self["id"]) }),
36
36
  params: params,
37
37
  opts: opts
38
38
  )
@@ -140,7 +140,7 @@ module Stripe
140
140
  def self.draft_quote(quote, params = {}, opts = {})
141
141
  request_stripe_object(
142
142
  method: :post,
143
- path: format("/v1/quotes/%<quote>s/draft", { quote: CGI.escape(quote) }),
143
+ path: format("/v1/quotes/%<quote>s/mark_draft", { quote: CGI.escape(quote) }),
144
144
  params: params,
145
145
  opts: opts
146
146
  )
@@ -0,0 +1,17 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ module Tax
6
+ # A Tax `Registration` lets us know that your business is registered to collect tax on payments within a region, enabling you to [automatically collect tax](https://stripe.com/docs/tax).
7
+ #
8
+ # Stripe will not register on your behalf with the relevant authorities when you create a Tax `Registration` object. For more information on how to register to collect tax, see [our guide](https://stripe.com/docs/tax/registering).
9
+ class Registration < APIResource
10
+ extend Stripe::APIOperations::Create
11
+ extend Stripe::APIOperations::List
12
+ include Stripe::APIOperations::Save
13
+
14
+ OBJECT_NAME = "tax.registration"
15
+ end
16
+ end
17
+ end
@@ -85,6 +85,7 @@ require "stripe/resources/subscription"
85
85
  require "stripe/resources/subscription_item"
86
86
  require "stripe/resources/subscription_schedule"
87
87
  require "stripe/resources/tax/calculation"
88
+ require "stripe/resources/tax/registration"
88
89
  require "stripe/resources/tax/transaction"
89
90
  require "stripe/resources/tax_code"
90
91
  require "stripe/resources/tax_id"
@@ -494,15 +494,16 @@ module Stripe
494
494
  end
495
495
  end
496
496
 
497
- http_resp = execute_request_with_rescues(method, api_base, context) do
498
- self.class
499
- .default_connection_manager(config)
500
- .execute_request(method, url,
501
- body: body,
502
- headers: headers,
503
- query: query,
504
- &response_block)
505
- end
497
+ http_resp =
498
+ execute_request_with_rescues(method, api_base, headers, context) do
499
+ self.class
500
+ .default_connection_manager(config)
501
+ .execute_request(method, url,
502
+ body: body,
503
+ headers: headers,
504
+ query: query,
505
+ &response_block)
506
+ end
506
507
 
507
508
  [http_resp, api_key]
508
509
  end
@@ -564,7 +565,7 @@ module Stripe
564
565
  http_status >= 400
565
566
  end
566
567
 
567
- private def execute_request_with_rescues(method, api_base, context)
568
+ private def execute_request_with_rescues(method, api_base, headers, context)
568
569
  num_retries = 0
569
570
 
570
571
  begin
@@ -587,7 +588,7 @@ module Stripe
587
588
 
588
589
  log_response(context, request_start, http_status, resp.body, resp)
589
590
  notify_request_end(context, request_duration, http_status,
590
- num_retries, user_data)
591
+ num_retries, user_data, resp, headers)
591
592
 
592
593
  if config.enable_telemetry? && context.request_id
593
594
  request_duration_ms = (request_duration * 1000).to_i
@@ -614,7 +615,7 @@ module Stripe
614
615
  log_response_error(error_context, request_start, e)
615
616
  end
616
617
  notify_request_end(context, request_duration, http_status, num_retries,
617
- user_data)
618
+ user_data, resp, headers)
618
619
 
619
620
  if self.class.should_retry?(e,
620
621
  method: method,
@@ -657,17 +658,24 @@ module Stripe
657
658
  end
658
659
 
659
660
  private def notify_request_end(context, duration, http_status, num_retries,
660
- user_data)
661
+ user_data, resp, headers)
661
662
  return if !Instrumentation.any_subscribers?(:request_end) &&
662
663
  !Instrumentation.any_subscribers?(:request)
663
664
 
664
- event = Instrumentation::RequestEndEvent.new(
665
+ request_context = Stripe::Instrumentation::RequestContext.new(
665
666
  duration: duration,
667
+ context: context,
668
+ header: headers
669
+ )
670
+ response_context = Stripe::Instrumentation::ResponseContext.new(
666
671
  http_status: http_status,
667
- method: context.method,
672
+ response: resp
673
+ )
674
+
675
+ event = Instrumentation::RequestEndEvent.new(
676
+ request_context: request_context,
677
+ response_context: response_context,
668
678
  num_retries: num_retries,
669
- path: context.path,
670
- request_id: context.request_id,
671
679
  user_data: user_data || {}
672
680
  )
673
681
  Stripe::Instrumentation.notify(:request_end, event)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Stripe
4
- VERSION = "8.1.0-beta.4"
4
+ VERSION = "8.2.0-beta.1"
5
5
  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: 8.1.0.pre.beta.4
4
+ version: 8.2.0.pre.beta.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stripe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-05 00:00:00.000000000 Z
11
+ date: 2023-01-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.
@@ -137,6 +137,7 @@ files:
137
137
  - lib/stripe/resources/subscription_item.rb
138
138
  - lib/stripe/resources/subscription_schedule.rb
139
139
  - lib/stripe/resources/tax/calculation.rb
140
+ - lib/stripe/resources/tax/registration.rb
140
141
  - lib/stripe/resources/tax/transaction.rb
141
142
  - lib/stripe/resources/tax_code.rb
142
143
  - lib/stripe/resources/tax_id.rb