Sha256: 5f909abed57b081d1a4847164d22c5a0dbcba375cb4b6a41960d01c6642f2ade

Contents?: true

Size: 863 Bytes

Versions: 6

Compression:

Stored size: 863 Bytes

Contents

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

    def delete(params={}, opts={})
      if respond_to?(:customer) && !customer.nil? && !customer.empty?
        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)
      else
        raise NotImplementedError.new("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
    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

6 entries across 6 versions & 1 rubygems

Version Path
stripe-2.5.0 lib/stripe/source.rb
stripe-2.4.0 lib/stripe/source.rb
stripe-2.3.0 lib/stripe/source.rb
stripe-2.2.1 lib/stripe/source.rb
stripe-2.2.0 lib/stripe/source.rb
stripe-2.1.0 lib/stripe/source.rb