module Stripe
  class BitcoinReceiver < APIResource
    extend Stripe::APIOperations::Create
    include Stripe::APIOperations::Update
    include Stripe::APIOperations::Delete
    extend Stripe::APIOperations::List

    def self.url
      "/v1/bitcoin/receivers"
    end

    def url
      if respond_to?(:customer)
        "#{Customer.url}/#{CGI.escape(customer)}/sources/#{CGI.escape(id)}"
      else
        "#{self.class.url}/#{CGI.escape(id)}"
      end
    end
  end
end

module Stripe
  class BitcoinReceiver < APIResource
    extend Stripe::APIOperations::Create
    include Stripe::APIOperations::Update
    include Stripe::APIOperations::Delete
    extend Stripe::APIOperations::List

    def self.url
      "/v1/bitcoin/receivers"
    end

    def url
      if respond_to?(:customer) && !self.customer.nil?
        "#{Customer.url}/#{CGI.escape(customer)}/sources/#{CGI.escape(id)}"
      else
        "#{self.class.url}/#{CGI.escape(id)}"
      end
    end
  end
end

Check for nil customer value when determining bitcoin receiver URL
Check for nil customer value when determining bitcoin receiver URL

Stripe API responses include `customer: nil`, which causes `refresh`
to throw an exception
