Sha256: 9a32b66542674e005b54402b354681ab8f3eb955a6999c216e084575bd2c8796

Contents?: true

Size: 1.12 KB

Versions: 28

Compression:

Stored size: 1.12 KB

Contents

# 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 = request(:delete, resource_url + "/discount")
      initialize_from(resp.data, opts, true)
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
stripe-5.22.0 lib/stripe/resources/customer.rb
stripe-5.21.0 lib/stripe/resources/customer.rb
stripe-5.20.0 lib/stripe/resources/customer.rb
stripe-5.19.0 lib/stripe/resources/customer.rb
stripe-5.18.0 lib/stripe/resources/customer.rb
stripe-5.17.0 lib/stripe/resources/customer.rb
stripe-5.16.0 lib/stripe/resources/customer.rb
stripe-5.15.0 lib/stripe/resources/customer.rb
stripe-5.14.0 lib/stripe/resources/customer.rb
stripe-5.13.0 lib/stripe/resources/customer.rb
stripe-5.12.1 lib/stripe/resources/customer.rb
stripe-5.12.0 lib/stripe/resources/customer.rb
stripe-5.11.0 lib/stripe/resources/customer.rb
stripe-5.10.0 lib/stripe/resources/customer.rb
stripe-5.9.0 lib/stripe/resources/customer.rb
stripe-5.8.0 lib/stripe/resources/customer.rb
stripe-5.7.1 lib/stripe/resources/customer.rb
stripe-5.7.0 lib/stripe/resources/customer.rb
stripe-5.6.0 lib/stripe/resources/customer.rb
stripe-5.5.0 lib/stripe/resources/customer.rb