stripe 13.3.0 → 13.3.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: 27bb8a5706977140a50f81fac944b42ef01fe1cc7b80dbfbc428643b3a7ba1c8
4
- data.tar.gz: d49111aa0e5969390b73bf380777b00b7757c990a1c5aecffc9c97ecf1ba553c
3
+ metadata.gz: c97bccf154ea39c4a6d56dcd0995620cf07cf6be683e21bcf598ee6b8f6fc67e
4
+ data.tar.gz: 2a98f32b4fc6ad9db84f876bb1ddb0e2a27810f03c773e8afce5e7bd51b8ab02
5
5
  SHA512:
6
- metadata.gz: 548a8056bdc32ee1c823cbde4e4c19bba300f09341c1813e87e2664e4c953646084e80f6a0b1dca4a509d8002fe3c0c0981a0b8391faea107a070403d4e9ed9c
7
- data.tar.gz: 6cc235dd96aa68fa236f6ffa7b008f3ff35ddfd8a90ef6c3eb58f1d55e14083989772f2849892aecb01935f3fd0acb7dc145d72dd60c8ceeeac2beff79e1817a
6
+ metadata.gz: 98ac690df3e6371f51355808b7bf46425fb5225ede914572f805d377839e1861cc2781f89babada1b8358647ce5a26f0c1443e8acef1629b9aa4c5a17911b6e3
7
+ data.tar.gz: ab2535408216d5b6a8bc289d30d8ce7302e22540f393d83337a1357e02c863af632010a9868302d90ed0f41925883a49f199e53bd28baa767c37eb708d34d821
data/CHANGELOG.md CHANGED
@@ -1,4 +1,12 @@
1
1
  # Changelog
2
+ ## 13.3.1 - 2025-01-13
3
+ * [#1512](https://github.com/stripe/stripe-ruby/pull/1512) Import global configuration for options not available on StripeClient options
4
+ * Fixes bug where `StripeClient` was not falling back to global options for options that are not available to be set per-client
5
+ * [#1516](https://github.com/stripe/stripe-ruby/pull/1516) ThinEvent reason and livemode
6
+ - Add `livemode` and optional `reason` fields to ThinEvent
7
+ * [#1518](https://github.com/stripe/stripe-ruby/pull/1518) Pin ubuntu version in Test action
8
+ * [#1508](https://github.com/stripe/stripe-ruby/pull/1508) Added pull request template
9
+
2
10
  ## 13.3.0 - 2024-12-18
3
11
  * [#1500](https://github.com/stripe/stripe-ruby/pull/1500) This release changes the pinned API version to `2024-12-18.acacia`.
4
12
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 13.3.0
1
+ 13.3.1
@@ -10,6 +10,10 @@ module Stripe
10
10
 
11
11
  # attr_readers: The end of the section generated from our OpenAPI spec
12
12
 
13
+ # For internal use only. Does not provide a stable API and may be broken
14
+ # with future non-major changes.
15
+ CLIENT_OPTIONS = Set.new(%i[api_key stripe_account stripe_context api_version api_base uploads_base connect_base meter_events_base client_id])
16
+
13
17
  # Initializes a new StripeClient
14
18
  def initialize(api_key, # rubocop:todo Metrics/ParameterLists
15
19
  stripe_account: nil,
@@ -40,7 +44,8 @@ module Stripe
40
44
  client_id: client_id,
41
45
  }.reject { |_k, v| v.nil? }
42
46
 
43
- @requestor = APIRequestor.new(config_opts)
47
+ config = StripeConfiguration.client_init(config_opts)
48
+ @requestor = APIRequestor.new(config)
44
49
 
45
50
  # top-level services: The beginning of the section generated from our OpenAPI spec
46
51
  @v1 = Stripe::V1Services.new(@requestor)
@@ -37,6 +37,25 @@ module Stripe
37
37
  end
38
38
  end
39
39
 
40
+ # Set options to the StripeClient configured options, if valid as a client option and provided
41
+ # Otherwise, for user configurable global options, set them to the global configuration
42
+ # For all other options, set them to the StripeConfiguration default value
43
+ def self.client_init(config_opts)
44
+ global_config = Stripe.config
45
+ imported_options = USER_CONFIGURABLE_GLOBAL_OPTIONS - StripeClient::CLIENT_OPTIONS
46
+ client_config = StripeConfiguration.setup do |instance|
47
+ imported_options.each do |key|
48
+ begin
49
+ instance.public_send("#{key}=", global_config.public_send(key)) if global_config.respond_to?(key)
50
+ rescue NotImplementedError => e
51
+ # In Ruby <= 2.5, we can't set write_timeout on Net::HTTP, log an error and continue
52
+ Util.log_error("Failed to set #{key} on client configuration: #{e}")
53
+ end
54
+ end
55
+ end
56
+ client_config.reverse_duplicate_merge(config_opts)
57
+ end
58
+
40
59
  # Create a new config based off an existing one. This is useful when the
41
60
  # caller wants to override the global configuration
42
61
  def reverse_duplicate_merge(hash)
@@ -68,7 +87,8 @@ module Stripe
68
87
  @connect_base = DEFAULT_CONNECT_BASE
69
88
  @uploads_base = DEFAULT_UPLOAD_BASE
70
89
  @meter_events_base = DEFAULT_METER_EVENTS_BASE
71
- @base_addresses = { api: @api_base, connect: @connect_base, files: @uploads_base, events: @meter_events_base }
90
+ @base_addresses = { api: @api_base, connect: @connect_base, files: @uploads_base,
91
+ meter_events: @meter_events_base, }
72
92
  end
73
93
 
74
94
  def log_level=(val)
@@ -1,8 +1,26 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Stripe
4
+ class EventReasonRequest
5
+ attr_reader :id, :idempotency_key
6
+
7
+ def initialize(event_reason_request_payload = {})
8
+ @id = event_reason_request_payload[:id]
9
+ @idempotency_key = event_reason_request_payload[:idempotency_key]
10
+ end
11
+ end
12
+
13
+ class EventReason
14
+ attr_reader :type, :request
15
+
16
+ def initialize(event_reason_payload = {})
17
+ @type = event_reason_payload[:type]
18
+ @request = EventReasonRequest.new(event_reason_payload[:request])
19
+ end
20
+ end
21
+
4
22
  class ThinEvent
5
- attr_reader :id, :type, :created, :context, :related_object
23
+ attr_reader :id, :type, :created, :context, :related_object, :livemode, :reason
6
24
 
7
25
  def initialize(event_payload = {})
8
26
  @id = event_payload[:id]
@@ -11,7 +29,9 @@ module Stripe
11
29
  @context = event_payload[:context]
12
30
  @livemode = event_payload[:livemode]
13
31
  @related_object = event_payload[:related_object]
14
- @reason = event_payload[:reason]
32
+ return if event_payload[:reason].nil?
33
+
34
+ @reason = EventReason.new(event_payload[:reason])
15
35
  end
16
36
  end
17
37
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Stripe
4
- VERSION = "13.3.0"
4
+ VERSION = "13.3.1"
5
5
  end
data/lib/stripe.rb CHANGED
@@ -74,6 +74,28 @@ module Stripe
74
74
  DEFAULT_UPLOAD_BASE = "https://files.stripe.com"
75
75
  DEFAULT_METER_EVENTS_BASE = "https://meter-events.stripe.com"
76
76
 
77
+ # Options that can be configured globally by users
78
+ USER_CONFIGURABLE_GLOBAL_OPTIONS = Set.new(%i[
79
+ api_key
80
+ api_version
81
+ stripe_account
82
+ api_base
83
+ uploads_base
84
+ connect_base
85
+ meter_events_base
86
+ open_timeout
87
+ read_timeout
88
+ write_timeout
89
+ proxy
90
+ verify_ssl_certs
91
+ ca_bundle_path
92
+ log_level
93
+ logger
94
+ max_network_retries
95
+ enable_telemetry
96
+ client_id
97
+ ])
98
+
77
99
  @app_info = nil
78
100
 
79
101
  @config = Stripe::StripeConfiguration.setup
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: 13.3.0
4
+ version: 13.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stripe
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-12-18 00:00:00.000000000 Z
11
+ date: 2025-01-13 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.
@@ -404,7 +404,7 @@ metadata:
404
404
  homepage_uri: https://stripe.com/docs/api?lang=ruby
405
405
  source_code_uri: https://github.com/stripe/stripe-ruby
406
406
  rubygems_mfa_required: 'false'
407
- post_install_message:
407
+ post_install_message:
408
408
  rdoc_options: []
409
409
  require_paths:
410
410
  - lib
@@ -420,7 +420,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
420
420
  version: '0'
421
421
  requirements: []
422
422
  rubygems_version: 3.3.27
423
- signing_key:
423
+ signing_key:
424
424
  specification_version: 4
425
425
  summary: Ruby bindings for the Stripe API
426
426
  test_files: []