Class: Io::Flow::V0::Models::ExpandableUser

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

Direct Known Subclasses

ExpandableUserUndefinedType, User, UserReference

Defined Under Namespace

Modules: Types

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ ExpandableUser

Returns a new instance of ExpandableUser.



3939
3940
3941
3942
3943
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 3939

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

Class Method Details

.from_json(hash) ⇒ Object



3949
3950
3951
3952
3953
3954
3955
3956
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 3949

def ExpandableUser.from_json(hash)
  HttpClient::Preconditions.assert_class('hash', hash, Hash)
  case HttpClient::Helper.symbolize_keys(hash)[:discriminator]
    when Types::USER; User.new(hash)
    when Types::USER_REFERENCE; UserReference.new(hash)
    else ExpandableUserUndefinedType.new(:name => union_type_name)
  end
end

Instance Method Details

#to_hashObject



3945
3946
3947
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 3945

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