Method: Stripe::Source#detach

Defined in:
lib/stripe/resources/source.rb

#detach(params = {}, opts = {}) ⇒ Object



64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/stripe/resources/source.rb', line 64

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)}"
  opts = Util.normalize_opts(opts)
  APIRequestor.active_requestor.execute_request_initialize_from(:delete, url, :api, self,
                                                                params: params, opts: opts)
end