Class: Io::Flow::V0::Models::AuthorizationCopyForm
- Inherits:
-
AuthorizationForm
- Object
- AuthorizationForm
- Io::Flow::V0::Models::AuthorizationCopyForm
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Creates a new authorization based on the underlying information in an existing authorization. A common use case here is to create a new auth when the existing one has expired.
Instance Attribute Summary collapse
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#currency ⇒ Object
readonly
Returns the value of attribute currency.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#source_authorization_key ⇒ Object
readonly
Returns the value of attribute source_authorization_key.
Attributes inherited from AuthorizationForm
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ AuthorizationCopyForm
constructor
A new instance of AuthorizationCopyForm.
- #subtype_to_hash ⇒ Object
- #to_json ⇒ Object
Methods inherited from AuthorizationForm
Constructor Details
#initialize(incoming = {}) ⇒ AuthorizationCopyForm
Returns a new instance of AuthorizationCopyForm.
12838 12839 12840 12841 12842 12843 12844 12845 12846 12847 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12838 def initialize(incoming={}) super(:discriminator => AuthorizationForm::Types::AUTHORIZATION_COPY_FORM) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:source_authorization_key, :amount, :currency], 'AuthorizationCopyForm') @source_authorization_key = HttpClient::Preconditions.assert_class('source_authorization_key', opts.delete(:source_authorization_key), String) @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) @key = (x = opts.delete(:key); x.nil? ? nil : HttpClient::Preconditions.assert_class('key', x, 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
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
12836 12837 12838 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12836 def amount @amount end |
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
12836 12837 12838 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12836 def attributes @attributes end |
#currency ⇒ Object (readonly)
Returns the value of attribute currency.
12836 12837 12838 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12836 def currency @currency end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
12836 12837 12838 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12836 def key @key end |
#source_authorization_key ⇒ Object (readonly)
Returns the value of attribute source_authorization_key.
12836 12837 12838 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12836 def @source_authorization_key end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
12853 12854 12855 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12853 def copy(incoming={}) AuthorizationCopyForm.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#subtype_to_hash ⇒ Object
12857 12858 12859 12860 12861 12862 12863 12864 12865 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12857 def subtype_to_hash { :source_authorization_key => , :amount => amount, :currency => currency, :key => key, :attributes => attributes.nil? ? nil : attributes } end |
#to_json ⇒ Object
12849 12850 12851 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12849 def to_json JSON.dump(to_hash) end |