Class: WhenIWork::User

Inherits:
Object
  • Object
show all
Includes:
Response
Defined in:
lib/wheniwork-ruby/models/user.rb

Instance Attribute Summary collapse

Attributes included from Response

#raw_data

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Response

#_deserialize, #_to_hash, #build_from_hash, #eql?, #to_body, #to_hash, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ User

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/wheniwork-ruby/models/user.rb', line 73

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}

  if attributes.has_key?(:'id')
    self.id = attributes[:'id']
  end

  if attributes.has_key?(:'account_id')
    self. = attributes[:'account_id']
  end

  if attributes.has_key?(:'role')
    self.role = attributes[:'role']
  end

  if attributes.has_key?(:'email')
    self.email = attributes[:'email']
  end

  if attributes.has_key?(:'first_name')
    self.first_name = attributes[:'first_name']
  end

  if attributes.has_key?(:'last_name')
    self.last_name = attributes[:'last_name']
  end

  if attributes.has_key?(:'phone_number')
    self.phone_number = attributes[:'phone_number']
  end

  if attributes.has_key?(:'employee_code')
    self.employee_code = attributes[:'employee_code']
  end

  if attributes.has_key?(:'positions')
    if (value = attributes[:'positions']).is_a?(Array)
      self.positions = value
    end
  end

  if attributes.has_key?(:'locations')
    if (value = attributes[:'locations']).is_a?(Array)
      self.locations = value
    end
  end

end

Instance Attribute Details

#account_idObject

Returns the value of attribute account_id.



29
30
31
# File 'lib/wheniwork-ruby/models/user.rb', line 29

def 
  @account_id
end

#emailObject

Returns the value of attribute email.



31
32
33
# File 'lib/wheniwork-ruby/models/user.rb', line 31

def email
  @email
end

#employee_codeObject

Returns the value of attribute employee_code.



35
36
37
# File 'lib/wheniwork-ruby/models/user.rb', line 35

def employee_code
  @employee_code
end

#first_nameObject

Returns the value of attribute first_name.



32
33
34
# File 'lib/wheniwork-ruby/models/user.rb', line 32

def first_name
  @first_name
end

#idObject

Returns the value of attribute id.



28
29
30
# File 'lib/wheniwork-ruby/models/user.rb', line 28

def id
  @id
end

#last_nameObject

Returns the value of attribute last_name.



33
34
35
# File 'lib/wheniwork-ruby/models/user.rb', line 33

def last_name
  @last_name
end

#locationsObject

Returns the value of attribute locations.



37
38
39
# File 'lib/wheniwork-ruby/models/user.rb', line 37

def locations
  @locations
end

#phone_numberObject

Returns the value of attribute phone_number.



34
35
36
# File 'lib/wheniwork-ruby/models/user.rb', line 34

def phone_number
  @phone_number
end

#positionsObject

Returns the value of attribute positions.



36
37
38
# File 'lib/wheniwork-ruby/models/user.rb', line 36

def positions
  @positions
end

#roleObject

Returns the value of attribute role.



30
31
32
# File 'lib/wheniwork-ruby/models/user.rb', line 30

def role
  @role
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/wheniwork-ruby/models/user.rb', line 40

def self.attribute_map
  {
    :'id' => :'id',
    :'account_id' => :'account_id',
    :'role' => :'role',
    :'email' => :'email',
    :'first_name' => :'first_name',
    :'last_name' => :'last_name',
    :'phone_number' => :'phone_number',
    :'employee_code' => :'employee_code',
    :'positions' => :'positions',
    :'locations' => :'locations'
  }
end

.swagger_typesObject

Attribute type mapping.



56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/wheniwork-ruby/models/user.rb', line 56

def self.swagger_types
  {
    :'id' => :'Integer',
    :'account_id' => :'Integer',
    :'role' => :'Integer',
    :'email' => :'String',
    :'first_name' => :'String',
    :'last_name' => :'String',
    :'phone_number' => :'String',
    :'employee_code' => :'String',
    :'positions' => :'Array<Integer>',
    :'locations' => :'Array<Integer>'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



139
140
141
142
143
144
145
146
147
148
149
150
151
152
# File 'lib/wheniwork-ruby/models/user.rb', line 139

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
       == o. &&
      role == o.role &&
      email == o.email &&
      first_name == o.first_name &&
      last_name == o.last_name &&
      phone_number == o.phone_number &&
      employee_code == o.employee_code &&
      positions == o.positions &&
      locations == o.locations
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



156
157
158
# File 'lib/wheniwork-ruby/models/user.rb', line 156

def hash
  [id, , role, email, first_name, last_name, phone_number, employee_code, positions, locations].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properies with the reasons



127
128
129
130
# File 'lib/wheniwork-ruby/models/user.rb', line 127

def list_invalid_properties
  invalid_properties = Array.new
  return invalid_properties
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



134
135
# File 'lib/wheniwork-ruby/models/user.rb', line 134

def valid?
end