Class: Io::Flow::V0::Models::ExpandableOrganization

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

Defined Under Namespace

Modules: Types

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ ExpandableOrganization

Returns a new instance of ExpandableOrganization.



4139
4140
4141
4142
4143
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4139

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

Class Method Details

.from_json(hash) ⇒ Object



4149
4150
4151
4152
4153
4154
4155
4156
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4149

def ExpandableOrganization.from_json(hash)
  HttpClient::Preconditions.assert_class('hash', hash, Hash)
  case HttpClient::Helper.symbolize_keys(hash)[:discriminator]
    when Types::ORGANIZATION; Organization.new(hash)
    when Types::ORGANIZATION_REFERENCE; OrganizationReference.new(hash)
    else ExpandableOrganizationUndefinedType.new(:name => union_type_name)
  end
end

Instance Method Details

#to_hashObject



4145
4146
4147
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4145

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