Sha256: 8af04e4505105f156ba3353df934fd8fb47d5402e8321b7a47a7c0b3ed0d5799

Contents?: true

Size: 1.47 KB

Versions: 38

Compression:

Stored size: 1.47 KB

Contents

# File generated from our OpenAPI spec
# frozen_string_literal: true

module Stripe
  class Source < APIResource
    extend Stripe::APIOperations::Create
    include Stripe::APIOperations::Save
    extend Stripe::APIOperations::NestedResource

    OBJECT_NAME = "source"

    custom_method :verify, http_verb: :post

    nested_resource_class_methods :source_transaction,
                                  operations: %i[retrieve list]

    def verify(params = {}, opts = {})
      request_stripe_object(
        method: :post,
        path: resource_url + "/verify",
        params: params,
        opts: opts
      )
    end

    def detach(params = {}, opts = {})
      if !respond_to?(:customer) || customer.nil? || customer.empty?
        raise NotImplementedError,
              "This source object does not appear to be currently attached " \
              "to a customer object."
      end

      url = "#{Customer.resource_url}/#{CGI.escape(customer)}/sources" \
            "/#{CGI.escape(id)}"
      resp, opts = execute_resource_request(:delete, url, params, opts)
      initialize_from(resp.data, opts)
    end

    def source_transactions(params = {}, opts = {})
      resp, opts = execute_resource_request(:get, resource_url + "/source_transactions", params,
                                            opts)
      Util.convert_to_stripe_object(resp.data, opts)
    end
    extend Gem::Deprecate
    deprecate :source_transactions, :"Source.list_source_transactions", 2020, 1
  end
end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
stripe-6.3.0 lib/stripe/resources/source.rb
stripe-6.2.0 lib/stripe/resources/source.rb
stripe-6.1.0 lib/stripe/resources/source.rb
stripe-6.0.0 lib/stripe/resources/source.rb
stripe-5.55.0 lib/stripe/resources/source.rb
stripe-5.54.0 lib/stripe/resources/source.rb
stripe-5.53.0 lib/stripe/resources/source.rb
stripe-5.52.0 lib/stripe/resources/source.rb
stripe-5.50.0 lib/stripe/resources/source.rb
stripe-5.49.0 lib/stripe/resources/source.rb
stripe-5.48.0 lib/stripe/resources/source.rb
stripe-5.47.0 lib/stripe/resources/source.rb
stripe-5.46.0 lib/stripe/resources/source.rb
stripe-5.45.0 lib/stripe/resources/source.rb
stripe-5.44.0 lib/stripe/resources/source.rb
stripe-5.43.0 lib/stripe/resources/source.rb
stripe-5.42.0 lib/stripe/resources/source.rb
stripe-5.41.0 lib/stripe/resources/source.rb
stripe-5.40.0 lib/stripe/resources/source.rb
stripe-5.39.0 lib/stripe/resources/source.rb