class Io::Flow::V0::Models::VirtualCard
Virtual credit cards are created for a specific limit and currency. Currently only USD denominated cards can be issued. Once created the virtual card can be used in the same way as a physical credit card using the card number, cvv and expiration details.
Attributes
attributes[R]
cvv[R]
expiration[R]
id[R]
iin[R]
key[R]
last4[R]
limit[R]
name[R]
number[R]
type[R]
Public Class Methods
new(incoming={})
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 72321 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :key, :limit, :type, :expiration, :iin, :last4, :name], 'VirtualCard') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @key = HttpClient::Preconditions.assert_class('key', opts.delete(:key), String) @number = (x = opts.delete(:number); x.nil? ? nil : HttpClient::Preconditions.assert_class('number', x, String)) @cvv = (x = opts.delete(:cvv); x.nil? ? nil : HttpClient::Preconditions.assert_class('cvv', x, String)) @limit = (x = opts.delete(:limit); x.is_a?(::Io::Flow::V0::Models::Price) ? x : ::Io::Flow::V0::Models::Price.new(x)) @type = (x = opts.delete(:type); x.is_a?(::Io::Flow::V0::Models::CardType) ? x : ::Io::Flow::V0::Models::CardType.apply(x)) @expiration = (x = opts.delete(:expiration); x.is_a?(::Io::Flow::V0::Models::Expiration) ? x : ::Io::Flow::V0::Models::Expiration.new(x)) @iin = HttpClient::Preconditions.assert_class('iin', opts.delete(:iin), String) @last4 = HttpClient::Preconditions.assert_class('last4', opts.delete(:last4), String) @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String) @attributes = (x = opts.delete(:attributes); x.nil? ? nil : HttpClient::Preconditions.assert_class('attributes', x, Hash).inject({}) { |h, d| h[d[0]] = HttpClient::Preconditions.assert_class('attributes', d[1], String); h }) end
Public Instance Methods
copy(incoming={})
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 72341 def copy(incoming={}) VirtualCard.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end
to_hash()
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 72345 def to_hash { :id => id, :key => key, :number => number, :cvv => cvv, :limit => limit.to_hash, :type => type.value, :expiration => expiration.to_hash, :iin => iin, :last4 => last4, :name => name, :attributes => attributes.nil? ? nil : attributes } end
to_json()
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 72337 def to_json JSON.dump(to_hash) end