Class: Io::Flow::V0::Models::MerchantApplication

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

Defined Under Namespace

Modules: Types

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ MerchantApplication

Returns a new instance of MerchantApplication.



12680
12681
12682
12683
12684
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12680

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

Instance Attribute Details

#discriminatorObject (readonly)

Returns the value of attribute discriminator.



12678
12679
12680
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12678

def discriminator
  @discriminator
end

Class Method Details

.from_json(hash) ⇒ Object



12694
12695
12696
12697
12698
12699
12700
12701
12702
12703
12704
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12694

def MerchantApplication.from_json(hash)
  HttpClient::Preconditions.assert_class('hash', hash, Hash)
  discriminator = HttpClient::Helper.symbolize_keys(hash)[:discriminator].to_s.strip
  if discriminator.empty?
    raise "Union type[merchant_application] requires a field named 'discriminator'"
  end
  case discriminator
    when Types::SHOPIFY_MERCHANT_APPLICATION; ShopifyMerchantApplication.new(hash)
    else MerchantApplicationUndefinedType.new(:discriminator => discriminator)
  end
end

Instance Method Details

#subtype_to_hashObject



12686
12687
12688
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12686

def subtype_to_hash
  raise 'Cannot serialize an instance of merchant_application directly - must use one of the specific types: shopify_merchant_application'
end

#to_hashObject



12690
12691
12692
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12690

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