Kamil Pajdzik ec71fd87f2
Next major release changes (#1103)
* chore!: Update CA certifacte bundle (Apr 26). (#1079)

* Generate stripe-ruby with breaking changes (#1102)

* Generate stripe-ruby with breaking changes

* Remove RecipientTest

* Remove AlipayAccount tests

* Regenerate files

* Delete outdated tests

* Fix more tests

* Fix more tests

* Fix example test manually

* Update retrieve_cash_balance method to have params. (#1104)

Co-authored-by: Dominic Charley-Roy <78050200+dcr-stripe@users.noreply.github.com>
2022-08-01 10:33:48 -07:00

37 lines
1.3 KiB
Ruby

# File generated from our OpenAPI spec
# frozen_string_literal: true
module Stripe
class Card < APIResource
include Stripe::APIOperations::Delete
extend Stripe::APIOperations::List
include Stripe::APIOperations::Save
OBJECT_NAME = "card"
def resource_url
if respond_to?(:customer) && !customer.nil? && !customer.empty?
"#{Customer.resource_url}/#{CGI.escape(customer)}/sources/#{CGI.escape(id)}"
elsif respond_to?(:account) && !account.nil? && !account.empty?
"#{Account.resource_url}/#{CGI.escape(account)}/external_accounts/#{CGI.escape(id)}"
end
end
def self.update(_id, _params = nil, _opts = nil)
raise NotImplementedError,
"Card cannot be updated without a customer ID or an account ID. " \
"Update a card using `Customer.update_source('customer_id', " \
"'card_id', update_params)` or `Account.update_external_account(" \
"'account_id', 'card_id', update_params)`"
end
def self.retrieve(_id, _opts = nil)
raise NotImplementedError,
"Card cannot be retrieved without a customer ID or an account " \
"ID. Retrieve a card using `Customer.retrieve_source(" \
"'customer_id', 'card_id')` or " \
"`Account.retrieve_external_account('account_id', 'card_id')`"
end
end
end