mirror of
https://github.com/stripe/stripe-ruby.git
synced 2025-10-04 00:00:47 -04:00
As seen in #928, the `refresh` method doesn't work for an event class. This is because event has a field called `request`, and it ends up replacing the `request` method that it inherited from being an API resource, so when `refresh` tries to make a request, it fails because it tries to invoke it on the accessor added for the event's property. Here we give `request` a much more unique name so that it will never conflict with a property field again, and update all internal references to use the new name. We use `alias` to make the old name available for backwards compatibility reasons because its been around for so long that people are probably calling it. Fixes #928.
37 lines
1.2 KiB
Ruby
37 lines
1.2 KiB
Ruby
# File generated from our OpenAPI spec
|
|
# frozen_string_literal: true
|
|
|
|
module Stripe
|
|
class Customer < APIResource
|
|
extend Stripe::APIOperations::Create
|
|
include Stripe::APIOperations::Delete
|
|
extend Stripe::APIOperations::List
|
|
include Stripe::APIOperations::Save
|
|
extend Stripe::APIOperations::NestedResource
|
|
|
|
OBJECT_NAME = "customer"
|
|
|
|
nested_resource_class_methods :balance_transaction,
|
|
operations: %i[create retrieve update list]
|
|
nested_resource_class_methods :tax_id,
|
|
operations: %i[create retrieve delete list]
|
|
|
|
custom_method :delete_discount, http_verb: :delete, http_path: "discount"
|
|
|
|
save_nested_resource :source
|
|
nested_resource_class_methods :source,
|
|
operations: %i[create retrieve update delete list]
|
|
|
|
# The API request for deleting a card or bank account and for detaching a
|
|
# source object are the same.
|
|
class << self
|
|
alias detach_source delete_source
|
|
end
|
|
|
|
def delete_discount
|
|
resp, opts = execute_resource_request(:delete, resource_url + "/discount")
|
|
initialize_from(resp.data, opts, true)
|
|
end
|
|
end
|
|
end
|