Class: Io::Flow::V0::Models::VirtualCard
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::VirtualCard
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
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.
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#cvv ⇒ Object
readonly
Returns the value of attribute cvv.
-
#expiration ⇒ Object
readonly
Returns the value of attribute expiration.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#iin ⇒ Object
readonly
Returns the value of attribute iin.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#last4 ⇒ Object
readonly
Returns the value of attribute last4.
-
#limit ⇒ Object
readonly
Returns the value of attribute limit.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ VirtualCard
constructor
A new instance of VirtualCard.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ VirtualCard
Returns a new instance of VirtualCard.
53584 53585 53586 53587 53588 53589 53590 53591 53592 53593 53594 53595 53596 53597 53598 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53584 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 |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
53582 53583 53584 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53582 def attributes @attributes end |
#cvv ⇒ Object (readonly)
Returns the value of attribute cvv.
53582 53583 53584 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53582 def cvv @cvv end |
#expiration ⇒ Object (readonly)
Returns the value of attribute expiration.
53582 53583 53584 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53582 def expiration @expiration end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
53582 53583 53584 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53582 def id @id end |
#iin ⇒ Object (readonly)
Returns the value of attribute iin.
53582 53583 53584 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53582 def iin @iin end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
53582 53583 53584 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53582 def key @key end |
#last4 ⇒ Object (readonly)
Returns the value of attribute last4.
53582 53583 53584 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53582 def last4 @last4 end |
#limit ⇒ Object (readonly)
Returns the value of attribute limit.
53582 53583 53584 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53582 def limit @limit end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
53582 53583 53584 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53582 def name @name end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
53582 53583 53584 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53582 def number @number end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
53582 53583 53584 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53582 def type @type end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
53604 53605 53606 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53604 def copy(incoming={}) VirtualCard.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
53608 53609 53610 53611 53612 53613 53614 53615 53616 53617 53618 53619 53620 53621 53622 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53608 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 ⇒ Object
53600 53601 53602 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53600 def to_json JSON.dump(to_hash) end |