Class: Io::Flow::V0::Models::CardAuthorization
- Inherits:
-
Authorization
- Object
- Authorization
- Io::Flow::V0::Models::CardAuthorization
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
An authorization is used to check and reserve funds w/ a given payment method. No funds are actually transferred; once you have you an authorization, you can capture up to the amount of the authorization.
Instance Attribute Summary collapse
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#card ⇒ Object
readonly
Returns the value of attribute card.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#currency ⇒ Object
readonly
Returns the value of attribute currency.
-
#customer ⇒ Object
readonly
Returns the value of attribute customer.
-
#destination ⇒ Object
readonly
Returns the value of attribute destination.
-
#expires_at ⇒ Object
readonly
Returns the value of attribute expires_at.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#ip ⇒ Object
readonly
Returns the value of attribute ip.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#order ⇒ Object
readonly
Returns the value of attribute order.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
Attributes inherited from Authorization
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ CardAuthorization
constructor
A new instance of CardAuthorization.
- #subtype_to_hash ⇒ Object
- #to_json ⇒ Object
Methods inherited from Authorization
Constructor Details
#initialize(incoming = {}) ⇒ CardAuthorization
Returns a new instance of CardAuthorization.
13637 13638 13639 13640 13641 13642 13643 13644 13645 13646 13647 13648 13649 13650 13651 13652 13653 13654 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13637 def initialize(incoming={}) super(:discriminator => Authorization::Types::CARD_AUTHORIZATION) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :key, :card, :amount, :currency, :customer, :attributes, :result, :created_at], 'CardAuthorization') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @key = HttpClient::Preconditions.assert_class('key', opts.delete(:key), String) @card = (x = opts.delete(:card); x.is_a?(::Io::Flow::V0::Models::ExpandableCard) ? x : ::Io::Flow::V0::Models::ExpandableCard.from_json(x)) @amount = HttpClient::Preconditions.assert_class('amount', HttpClient::Helper.to_big_decimal(opts.delete(:amount)), BigDecimal) @currency = HttpClient::Preconditions.assert_class('currency', opts.delete(:currency), String) @customer = (x = opts.delete(:customer); x.is_a?(::Io::Flow::V0::Models::Customer) ? x : ::Io::Flow::V0::Models::Customer.new(x)) @attributes = HttpClient::Preconditions.assert_class('attributes', opts.delete(:attributes), Hash).inject({}) { |h, d| h[d[0]] = HttpClient::Preconditions.assert_class('attributes', d[1], String); h } @destination = (x = opts.delete(:destination); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::Address) ? x : ::Io::Flow::V0::Models::Address.new(x))) @order = (x = opts.delete(:order); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::AuthorizationOrderReference) ? x : ::Io::Flow::V0::Models::AuthorizationOrderReference.new(x))) @ip = (x = opts.delete(:ip); x.nil? ? nil : HttpClient::Preconditions.assert_class('ip', x, String)) @result = (x = opts.delete(:result); x.is_a?(::Io::Flow::V0::Models::AuthorizationResult) ? x : ::Io::Flow::V0::Models::AuthorizationResult.new(x)) @created_at = HttpClient::Preconditions.assert_class('created_at', HttpClient::Helper.to_date_time_iso8601(opts.delete(:created_at)), DateTime) @expires_at = (x = opts.delete(:expires_at); x.nil? ? nil : HttpClient::Preconditions.assert_class('expires_at', HttpClient::Helper.to_date_time_iso8601(x), DateTime)) end |
Instance Attribute Details
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
13635 13636 13637 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13635 def amount @amount end |
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
13635 13636 13637 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13635 def attributes @attributes end |
#card ⇒ Object (readonly)
Returns the value of attribute card.
13635 13636 13637 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13635 def card @card end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
13635 13636 13637 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13635 def created_at @created_at end |
#currency ⇒ Object (readonly)
Returns the value of attribute currency.
13635 13636 13637 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13635 def currency @currency end |
#customer ⇒ Object (readonly)
Returns the value of attribute customer.
13635 13636 13637 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13635 def customer @customer end |
#destination ⇒ Object (readonly)
Returns the value of attribute destination.
13635 13636 13637 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13635 def destination @destination end |
#expires_at ⇒ Object (readonly)
Returns the value of attribute expires_at.
13635 13636 13637 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13635 def expires_at @expires_at end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
13635 13636 13637 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13635 def id @id end |
#ip ⇒ Object (readonly)
Returns the value of attribute ip.
13635 13636 13637 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13635 def ip @ip end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
13635 13636 13637 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13635 def key @key end |
#order ⇒ Object (readonly)
Returns the value of attribute order.
13635 13636 13637 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13635 def order @order end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
13635 13636 13637 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13635 def result @result end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
13660 13661 13662 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13660 def copy(incoming={}) CardAuthorization.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#subtype_to_hash ⇒ Object
13664 13665 13666 13667 13668 13669 13670 13671 13672 13673 13674 13675 13676 13677 13678 13679 13680 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13664 def subtype_to_hash { :id => id, :key => key, :card => card.to_hash, :amount => amount, :currency => currency, :customer => customer.to_hash, :attributes => attributes, :destination => destination.nil? ? nil : destination.to_hash, :order => order.nil? ? nil : order.to_hash, :ip => ip, :result => result.to_hash, :created_at => created_at, :expires_at => expires_at } end |
#to_json ⇒ Object
13656 13657 13658 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13656 def to_json JSON.dump(to_hash) end |