mirror of
https://github.com/stripe/stripe-ruby.git
synced 2025-05-28 00:02:13 -04:00
22 lines
843 B
Ruby
22 lines
843 B
Ruby
module Stripe
|
|
class Source < APIResource
|
|
extend Stripe::APIOperations::Create
|
|
include Stripe::APIOperations::Save
|
|
|
|
def delete(params={}, opts={})
|
|
if respond_to?(:customer) && !customer.nil?
|
|
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
|