Class: Io::Flow::V0::Models::AuthorizationForm

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Overview

Flow provides several different options for creating an authorization

Defined Under Namespace

Modules: Types

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ AuthorizationForm

Returns a new instance of AuthorizationForm.



3574
3575
3576
3577
3578
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 3574

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:name], 'AuthorizationForm')
  @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String)
end

Class Method Details

.from_json(hash) ⇒ Object



3584
3585
3586
3587
3588
3589
3590
3591
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 3584

def AuthorizationForm.from_json(hash)
  HttpClient::Preconditions.assert_class('hash', hash, Hash)
  case HttpClient::Helper.symbolize_keys(hash)[:discriminator]
    when Types::DIRECT_AUTHORIZATION_FORM; DirectAuthorizationForm.new(hash)
    when Types::MERCHANT_OF_RECORD_AUTHORIZATION_FORM; MerchantOfRecordAuthorizationForm.new(hash)
    else AuthorizationFormUndefinedType.new(:name => union_type_name)
  end
end

Instance Method Details

#to_hashObject



3580
3581
3582
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 3580

def to_hash
  subtype_to_hash.merge(:discriminator => @name)
end