class Io::Flow::V0::Models::AuthorizationCopyForm

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.

Attributes

amount[R]
attributes[R]
currency[R]
source_authorization_key[R]

Public Class Methods

new(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 31060
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)
  @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

Public Instance Methods

copy(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 31074
def copy(incoming={})
  AuthorizationCopyForm.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end
subtype_to_hash() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 31078
def subtype_to_hash
  {
    :source_authorization_key => source_authorization_key,
    :amount => amount.to_f.to_s,
    :currency => currency,
    :attributes => attributes.nil? ? nil : attributes
  }
end
to_json() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 31070
def to_json
  JSON.dump(to_hash)
end