Fix cards

This commit is contained in:
Olivier Bellone 2017-03-17 15:58:40 +01:00
parent 89f207f993
commit 58a965523a
2 changed files with 4 additions and 4 deletions

View File

@ -5,11 +5,11 @@ module Stripe
extend Stripe::APIOperations::List
def resource_url
if respond_to?(:recipient)
if respond_to?(:recipient) && !recipient.nil? && !recipient.empty?
"#{Recipient.resource_url}/#{CGI.escape(recipient)}/cards/#{CGI.escape(id)}"
elsif respond_to?(:customer)
elsif respond_to?(:customer) && !customer.nil? && !customer.empty?
"#{Customer.resource_url}/#{CGI.escape(customer)}/sources/#{CGI.escape(id)}"
elsif respond_to?(:account)
elsif respond_to?(:account) && !account.nil? && !account.empty?
"#{Account.resource_url}/#{CGI.escape(account)}/external_accounts/#{CGI.escape(id)}"
end
end

View File

@ -2,7 +2,7 @@ require File.expand_path('../../test_helper', __FILE__)
module Stripe
class CustomerCardTest < Test::Unit::TestCase
FIXTURE = API_FIXTURES.fetch(:source)
FIXTURE = API_FIXTURES.fetch(:card)
setup do
@customer =