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.



3855
3856
3857
3858
3859
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 3855

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



3865
3866
3867
3868
3869
3870
3871
3872
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 3865

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



3861
3862
3863
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 3861

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