Class: NewStoreApi::PostUsersRequest

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/new_store_api/models/post_users_request.rb

Overview

PostUsersRequest Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(email = nil, external_directory = SKIP, first_name = SKIP, is_active = SKIP, last_name = SKIP, phone = SKIP, roles = SKIP) ⇒ PostUsersRequest

Returns a new instance of PostUsersRequest.



70
71
72
73
74
75
76
77
78
79
80
# File 'lib/new_store_api/models/post_users_request.rb', line 70

def initialize(email = nil, external_directory = SKIP, first_name = SKIP,
               is_active = SKIP, last_name = SKIP, phone = SKIP,
               roles = SKIP)
  @email = email
  @external_directory = external_directory unless external_directory == SKIP
  @first_name = first_name unless first_name == SKIP
  @is_active = is_active unless is_active == SKIP
  @last_name = last_name unless last_name == SKIP
  @phone = phone unless phone == SKIP
  @roles = roles unless roles == SKIP
end

Instance Attribute Details

#emailString

Email address of the user.

Returns:

  • (String)


14
15
16
# File 'lib/new_store_api/models/post_users_request.rb', line 14

def email
  @email
end

#external_directoryTrueClass | FalseClass

User is managed by an external directory.

Returns:

  • (TrueClass | FalseClass)


18
19
20
# File 'lib/new_store_api/models/post_users_request.rb', line 18

def external_directory
  @external_directory
end

#first_nameString

First name of the user.

Returns:

  • (String)


22
23
24
# File 'lib/new_store_api/models/post_users_request.rb', line 22

def first_name
  @first_name
end

#is_activeTrueClass | FalseClass

Whether the user can login or not.

Returns:

  • (TrueClass | FalseClass)


26
27
28
# File 'lib/new_store_api/models/post_users_request.rb', line 26

def is_active
  @is_active
end

#last_nameString

Last name of the user.

Returns:

  • (String)


30
31
32
# File 'lib/new_store_api/models/post_users_request.rb', line 30

def last_name
  @last_name
end

#phoneString

Telephone number of the user.

Returns:

  • (String)


34
35
36
# File 'lib/new_store_api/models/post_users_request.rb', line 34

def phone
  @phone
end

#rolesArray[String]

List of role names the user is assigned to.

Returns:

  • (Array[String])


38
39
40
# File 'lib/new_store_api/models/post_users_request.rb', line 38

def roles
  @roles
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/new_store_api/models/post_users_request.rb', line 83

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  email = hash.key?('email') ? hash['email'] : nil
  external_directory =
    hash.key?('external_directory') ? hash['external_directory'] : SKIP
  first_name = hash.key?('first_name') ? hash['first_name'] : SKIP
  is_active = hash.key?('is_active') ? hash['is_active'] : SKIP
  last_name = hash.key?('last_name') ? hash['last_name'] : SKIP
  phone = hash.key?('phone') ? hash['phone'] : SKIP
  roles = hash.key?('roles') ? hash['roles'] : SKIP

  # Create object from extracted values.
  PostUsersRequest.new(email,
                       external_directory,
                       first_name,
                       is_active,
                       last_name,
                       phone,
                       roles)
end

.namesObject

A mapping from model property names to API property names.



41
42
43
44
45
46
47
48
49
50
51
# File 'lib/new_store_api/models/post_users_request.rb', line 41

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['email'] = 'email'
  @_hash['external_directory'] = 'external_directory'
  @_hash['first_name'] = 'first_name'
  @_hash['is_active'] = 'is_active'
  @_hash['last_name'] = 'last_name'
  @_hash['phone'] = 'phone'
  @_hash['roles'] = 'roles'
  @_hash
end

.nullablesObject

An array for nullable fields



66
67
68
# File 'lib/new_store_api/models/post_users_request.rb', line 66

def self.nullables
  []
end

.optionalsObject

An array for optional fields



54
55
56
57
58
59
60
61
62
63
# File 'lib/new_store_api/models/post_users_request.rb', line 54

def self.optionals
  %w[
    external_directory
    first_name
    is_active
    last_name
    phone
    roles
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



115
116
117
118
119
120
121
# File 'lib/new_store_api/models/post_users_request.rb', line 115

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} email: #{@email.inspect}, external_directory:"\
  " #{@external_directory.inspect}, first_name: #{@first_name.inspect}, is_active:"\
  " #{@is_active.inspect}, last_name: #{@last_name.inspect}, phone: #{@phone.inspect}, roles:"\
  " #{@roles.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



107
108
109
110
111
112
# File 'lib/new_store_api/models/post_users_request.rb', line 107

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} email: #{@email}, external_directory: #{@external_directory}, first_name:"\
  " #{@first_name}, is_active: #{@is_active}, last_name: #{@last_name}, phone: #{@phone},"\
  " roles: #{@roles}>"
end