stripe-ruby/lib/stripe/resources/payment_method.rb
Alex Rattray (Stripe) d1ccff025e Revert back to initialize_from from Util.convert_to_stripe_object (#806)
* Revert "Use Util.convert_to_stripe_object instead of initialize_from"

This reverts commit ea736eba1b8f33d8febbf0b1be0957f34f7b04db.

* Make SetupIntents use initialize_from instead of Util.convert_to_stripe_object

* Fix issuing card details, which must have been broken prior to ea736eb
2019-07-05 10:47:32 -07:00

25 lines
665 B
Ruby

# frozen_string_literal: true
module Stripe
class PaymentMethod < APIResource
extend Stripe::APIOperations::Create
extend Stripe::APIOperations::List
include Stripe::APIOperations::Save
OBJECT_NAME = "payment_method".freeze
custom_method :attach, http_verb: :post
custom_method :detach, http_verb: :post
def attach(params = {}, opts = {})
resp, opts = request(:post, resource_url + "/attach", params, opts)
initialize_from(resp.data, opts)
end
def detach(params = {}, opts = {})
resp, opts = request(:post, resource_url + "/detach", params, opts)
initialize_from(resp.data, opts)
end
end
end