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.
-
#base ⇒ Object
readonly
Returns the value of attribute base.
-
#billing_address ⇒ Object
readonly
Returns the value of attribute billing_address.
-
#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.
-
#details ⇒ Object
readonly
Returns the value of attribute details.
-
#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.
-
#merchant_of_record ⇒ Object
readonly
Returns the value of attribute merchant_of_record.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#order ⇒ Object
readonly
Returns the value of attribute order.
-
#payment ⇒ Object
readonly
Returns the value of attribute payment.
-
#requested ⇒ Object
readonly
Returns the value of attribute requested.
-
#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.
40024 40025 40026 40027 40028 40029 40030 40031 40032 40033 40034 40035 40036 40037 40038 40039 40040 40041 40042 40043 40044 40045 40046 40047 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40024 def initialize(incoming={}) super(:discriminator => Authorization::Types::ONLINE_AUTHORIZATION) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :key, :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) @method = (x = opts.delete(:method); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::PaymentMethod) ? x : ::Io::Flow::V0::Models::PaymentMethod.new(x))) @merchant_of_record = (x = (x = opts.delete(:merchant_of_record); x.nil? ? "flow" : x); x.is_a?(::Io::Flow::V0::Models::MerchantOfRecord) ? x : ::Io::Flow::V0::Models::MerchantOfRecord.apply(x)) @details = (x = opts.delete(:details); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::OnlineAuthorizationDetails) ? x : ::Io::Flow::V0::Models::OnlineAuthorizationDetails.from_json(x))) @payment = (x = opts.delete(:payment); x.nil? ? nil : HttpClient::Preconditions.assert_class('payment', HttpClient::Helper.to_object(x), Hash)) @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) @requested = (x = opts.delete(:requested); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::Money) ? x : ::Io::Flow::V0::Models::Money.new(x))) @customer = (x = opts.delete(:customer); x.is_a?(::Io::Flow::V0::Models::OrderCustomer) ? x : ::Io::Flow::V0::Models::OrderCustomer.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))) @billing_address = (x = opts.delete(:billing_address); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::BillingAddress) ? x : ::Io::Flow::V0::Models::BillingAddress.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)) @base = (x = opts.delete(:base); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::Money) ? x : ::Io::Flow::V0::Models::Money.new(x))) end |
Instance Attribute Details
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
40022 40023 40024 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40022 def amount @amount end |
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
40022 40023 40024 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40022 def attributes @attributes end |
#base ⇒ Object (readonly)
Returns the value of attribute base.
40022 40023 40024 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40022 def base @base end |
#billing_address ⇒ Object (readonly)
Returns the value of attribute billing_address.
40022 40023 40024 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40022 def billing_address @billing_address end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
40022 40023 40024 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40022 def created_at @created_at end |
#currency ⇒ Object (readonly)
Returns the value of attribute currency.
40022 40023 40024 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40022 def currency @currency end |
#customer ⇒ Object (readonly)
Returns the value of attribute customer.
40022 40023 40024 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40022 def customer @customer end |
#destination ⇒ Object (readonly)
Returns the value of attribute destination.
40022 40023 40024 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40022 def destination @destination end |
#details ⇒ Object (readonly)
Returns the value of attribute details.
40022 40023 40024 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40022 def details @details end |
#expires_at ⇒ Object (readonly)
Returns the value of attribute expires_at.
40022 40023 40024 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40022 def expires_at @expires_at end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
40022 40023 40024 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40022 def id @id end |
#ip ⇒ Object (readonly)
Returns the value of attribute ip.
40022 40023 40024 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40022 def ip @ip end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
40022 40023 40024 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40022 def key @key end |
#merchant_of_record ⇒ Object (readonly)
Returns the value of attribute merchant_of_record.
40022 40023 40024 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40022 def merchant_of_record @merchant_of_record end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
40022 40023 40024 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40022 def method @method end |
#order ⇒ Object (readonly)
Returns the value of attribute order.
40022 40023 40024 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40022 def order @order end |
#payment ⇒ Object (readonly)
Returns the value of attribute payment.
40022 40023 40024 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40022 def payment @payment end |
#requested ⇒ Object (readonly)
Returns the value of attribute requested.
40022 40023 40024 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40022 def requested @requested end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
40022 40023 40024 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40022 def result @result end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
40053 40054 40055 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40053 def copy(incoming={}) OnlineAuthorization.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#subtype_to_hash ⇒ Object
40057 40058 40059 40060 40061 40062 40063 40064 40065 40066 40067 40068 40069 40070 40071 40072 40073 40074 40075 40076 40077 40078 40079 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40057 def subtype_to_hash { :id => id, :key => key, :method => method.nil? ? nil : method.to_hash, :merchant_of_record => merchant_of_record.value, :details => details.nil? ? nil : details.to_hash, :payment => payment, :amount => amount.to_f.to_s, :currency => currency, :requested => requested.nil? ? nil : requested.to_hash, :customer => customer.to_hash, :attributes => attributes, :destination => destination.nil? ? nil : destination.to_hash, :billing_address => billing_address.nil? ? nil : billing_address.to_hash, :order => order.nil? ? nil : order.to_hash, :ip => ip, :result => result.to_hash, :created_at => created_at, :expires_at => expires_at, :base => base.nil? ? nil : base.to_hash } end |
#to_json ⇒ Object
40049 40050 40051 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40049 def to_json JSON.dump(to_hash) end |