Class: Io::Flow::V0::Models::ExpandableSubcatalog

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

Overview

A subcatalog can be represented with just it’s ID, or the entire model

Defined Under Namespace

Modules: Types

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ ExpandableSubcatalog

Returns a new instance of ExpandableSubcatalog.



3966
3967
3968
3969
3970
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 3966

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

Class Method Details

.from_json(hash) ⇒ Object



3976
3977
3978
3979
3980
3981
3982
3983
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 3976

def ExpandableSubcatalog.from_json(hash)
  HttpClient::Preconditions.assert_class('hash', hash, Hash)
  case HttpClient::Helper.symbolize_keys(hash)[:discriminator]
    when Types::SUBCATALOG; Subcatalog.new(hash)
    when Types::SUBCATALOG_REFERENCE; SubcatalogReference.new(hash)
    else ExpandableSubcatalogUndefinedType.new(:name => union_type_name)
  end
end

Instance Method Details

#to_hashObject



3972
3973
3974
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 3972

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