Class: Io::Flow::V0::Models::OnlineAuthorization
- Inherits:
-
Authorization
- Object
- Authorization
- Io::Flow::V0::Models::OnlineAuthorization
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#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.
-
#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.
-
#payment ⇒ Object
readonly
Returns the value of attribute payment.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
Attributes inherited from Authorization
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ OnlineAuthorization
constructor
A new instance of OnlineAuthorization.
- #subtype_to_hash ⇒ Object
- #to_json ⇒ Object
Methods inherited from Authorization
Constructor Details
#initialize(incoming = {}) ⇒ OnlineAuthorization
Returns a new instance of OnlineAuthorization.
18747 18748 18749 18750 18751 18752 18753 18754 18755 18756 18757 18758 18759 18760 18761 18762 18763 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18747 def initialize(incoming={}) super(:discriminator => Authorization::Types::ONLINE_AUTHORIZATION) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :key, :payment, :amount, :currency, :customer, :attributes, :result, :created_at], 'OnlineAuthorization') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @key = HttpClient::Preconditions.assert_class('key', opts.delete(:key), String) @payment = (x = opts.delete(:payment); x.is_a?(::Io::Flow::V0::Models::ExpandablePayment) ? x : ::Io::Flow::V0::Models::ExpandablePayment.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) end |
Instance Attribute Details
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
18745 18746 18747 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18745 def amount @amount end |
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
18745 18746 18747 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18745 def attributes @attributes end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
18745 18746 18747 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18745 def created_at @created_at end |
#currency ⇒ Object (readonly)
Returns the value of attribute currency.
18745 18746 18747 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18745 def currency @currency end |
#customer ⇒ Object (readonly)
Returns the value of attribute customer.
18745 18746 18747 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18745 def customer @customer end |
#destination ⇒ Object (readonly)
Returns the value of attribute destination.
18745 18746 18747 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18745 def destination @destination end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
18745 18746 18747 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18745 def id @id end |
#ip ⇒ Object (readonly)
Returns the value of attribute ip.
18745 18746 18747 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18745 def ip @ip end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
18745 18746 18747 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18745 def key @key end |
#order ⇒ Object (readonly)
Returns the value of attribute order.
18745 18746 18747 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18745 def order @order end |
#payment ⇒ Object (readonly)
Returns the value of attribute payment.
18745 18746 18747 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18745 def payment @payment end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
18745 18746 18747 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18745 def result @result end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
18769 18770 18771 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18769 def copy(incoming={}) OnlineAuthorization.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#subtype_to_hash ⇒ Object
18773 18774 18775 18776 18777 18778 18779 18780 18781 18782 18783 18784 18785 18786 18787 18788 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18773 def subtype_to_hash { :id => id, :key => key, :payment => payment.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 } end |
#to_json ⇒ Object
18765 18766 18767 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18765 def to_json JSON.dump(to_hash) end |