Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Layout/LineLength:
Exclude:
- "lib/stripe/object_types.rb"
- "lib/stripe/stripe_client.rb"
- "lib/stripe/stripe_event_router.rb"
- "lib/stripe/resources/**/*.rb"
- "lib/stripe/services/**/*.rb"
- "lib/stripe/events/**/*.rb"
Expand Down Expand Up @@ -86,6 +87,10 @@ Metrics/ParameterLists:
- "lib/stripe/stripe_client.rb"
- "lib/stripe/params/**/*.rb"

Naming/MethodName:
Exclude:
- "lib/stripe/stripe_event_router.rb"

Naming/MethodParameterName:
# We have many parameters that are less than 3 characters for tax codes
Exclude:
Expand Down
1 change: 1 addition & 0 deletions lib/stripe.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
require "stripe/api_resource_test_helpers"
require "stripe/singleton_api_resource"
require "stripe/webhook"
require "stripe/stripe_event_router"
require "stripe/stripe_configuration"
require "stripe/resources/v2/amount"
require "stripe/resources/v2/deleted_object"
Expand Down
9 changes: 8 additions & 1 deletion lib/stripe/stripe_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ class StripeClient
# attr_readers: The beginning of the section generated from our OpenAPI spec
attr_reader :v1
attr_reader :v2

# attr_readers: The end of the section generated from our OpenAPI spec

# For internal use only. Does not provide a stable API and may be broken
# with future non-major changes.
attr_reader :requestor

# For internal use only. Does not provide a stable API and may be broken
# with future non-major changes.
CLIENT_OPTIONS = Set.new(%i[api_key stripe_account stripe_context api_version api_base uploads_base connect_base meter_events_base client_id])
Expand Down Expand Up @@ -87,5 +90,9 @@ def deserialize(data, api_mode: :v1)
data = JSON.parse(data) if data.is_a?(String)
Util.convert_to_stripe_object(data, {}, api_mode: api_mode, requestor: @requestor)
end

def router(webhook_secret, &blk)
::Stripe::StripeEventRouter.new(self, webhook_secret, &blk)
end
end
end
Loading
Loading