class PayjpMock::Response::Resource::Customer
Constants
- OBJECT
- PREFIX
Public Instance Methods
canonicalize(key, value)
click to toggle source
Calls superclass method
PayjpMock::Response::Resource::Base#canonicalize
# File lib/payjp_mock/response/resource/customer.rb, line 24 def canonicalize(key, value) case key when :card cards = Response::List.new("/customers/#{@attributes[:id]}/cards", count: 1) do Card.new(value.is_a?(Hash) ? value : {}) end { cards: cards.to_h, default_card: cards.attributes[:data][0][:id] } when :default_card cards = Response::List.new("/customers/#{@attributes[:id]}/cards", count: 1) do Card.new(id: value) end { cards: cards.to_h, default_card: value } else super end end
default_attributes()
click to toggle source
# File lib/payjp_mock/response/resource/customer.rb, line 7 def default_attributes id = generate_resource_id(PREFIX) { cards: Response::List.new("/customers/#{id}/cards").to_h, created: Time.now.to_i, default_card: nil, description: 'test', email: nil, id: id, livemode: false, metadata: nil, object: OBJECT, subscriptions: Response::List.new("/customers/#{id}/subscriptions").to_h } end