Sha256: fae19d0f0ce397c985994ed6fec0835cd319c0afdbdb809ed9acdb595dcba084

Contents?: true

Size: 937 Bytes

Versions: 1

Compression:

Stored size: 937 Bytes

Contents

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

    OBJECT_NAME = "source".freeze

    def delete(params = {}, opts = {})
      if !respond_to?(:customer) || customer.nil? || customer.empty?
        raise NotImplementedError,
              "Source objects cannot be deleted, they can only be detached " \
              "from customer objects. 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 = request(:delete, url, params, Util.normalize_opts(opts))
      initialize_from(resp.data, opts)
    end

    def verify(params = {}, opts = {})
      resp, opts = request(:post, resource_url + "/verify", params, Util.normalize_opts(opts))
      initialize_from(resp.data, opts)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
stripe-3.4.1 lib/stripe/source.rb