Class: Verizon::DtoUserDto

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/verizon/models/dto_user_dto.rb

Overview

DtoUserDto 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: SKIP, firstname: SKIP, lastname: SKIP, mdn: SKIP, customdata: SKIP) ⇒ DtoUserDto

Returns a new instance of DtoUserDto.



60
61
62
63
64
65
66
67
# File 'lib/verizon/models/dto_user_dto.rb', line 60

def initialize(email: SKIP, firstname: SKIP, lastname: SKIP, mdn: SKIP,
               customdata: SKIP)
  @email = email unless email == SKIP
  @firstname = firstname unless firstname == SKIP
  @lastname = lastname unless lastname == SKIP
  @mdn = mdn unless mdn == SKIP
  @customdata = customdata unless customdata == SKIP
end

Instance Attribute Details

#customdataHash[String, Object]

Name/value pair, where the value is client defined. The purpose is to keep track of current state per device action.

Returns:

  • (Hash[String, Object])


31
32
33
# File 'lib/verizon/models/dto_user_dto.rb', line 31

def customdata
  @customdata
end

#emailString

Contact email for the group

Returns:

  • (String)


14
15
16
# File 'lib/verizon/models/dto_user_dto.rb', line 14

def email
  @email
end

#firstnameString

The first name in the user record

Returns:

  • (String)


18
19
20
# File 'lib/verizon/models/dto_user_dto.rb', line 18

def firstname
  @firstname
end

#lastnameString

The last name in the user record

Returns:

  • (String)


22
23
24
# File 'lib/verizon/models/dto_user_dto.rb', line 22

def lastname
  @lastname
end

#mdnString

The Mobile Directory Number

Returns:

  • (String)


26
27
28
# File 'lib/verizon/models/dto_user_dto.rb', line 26

def mdn
  @mdn
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/verizon/models/dto_user_dto.rb', line 70

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  email = hash.key?('email') ? hash['email'] : SKIP
  firstname = hash.key?('firstname') ? hash['firstname'] : SKIP
  lastname = hash.key?('lastname') ? hash['lastname'] : SKIP
  mdn = hash.key?('mdn') ? hash['mdn'] : SKIP
  customdata = hash.key?('customdata') ? hash['customdata'] : SKIP

  # Create object from extracted values.
  DtoUserDto.new(email: email,
                 firstname: firstname,
                 lastname: lastname,
                 mdn: mdn,
                 customdata: customdata)
end

.namesObject

A mapping from model property names to API property names.



34
35
36
37
38
39
40
41
42
# File 'lib/verizon/models/dto_user_dto.rb', line 34

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['email'] = 'email'
  @_hash['firstname'] = 'firstname'
  @_hash['lastname'] = 'lastname'
  @_hash['mdn'] = 'mdn'
  @_hash['customdata'] = 'customdata'
  @_hash
end

.nullablesObject

An array for nullable fields



56
57
58
# File 'lib/verizon/models/dto_user_dto.rb', line 56

def self.nullables
  []
end

.optionalsObject

An array for optional fields



45
46
47
48
49
50
51
52
53
# File 'lib/verizon/models/dto_user_dto.rb', line 45

def self.optionals
  %w[
    email
    firstname
    lastname
    mdn
    customdata
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



96
97
98
99
100
# File 'lib/verizon/models/dto_user_dto.rb', line 96

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} email: #{@email.inspect}, firstname: #{@firstname.inspect}, lastname:"\
  " #{@lastname.inspect}, mdn: #{@mdn.inspect}, customdata: #{@customdata.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



89
90
91
92
93
# File 'lib/verizon/models/dto_user_dto.rb', line 89

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} email: #{@email}, firstname: #{@firstname}, lastname: #{@lastname}, mdn:"\
  " #{@mdn}, customdata: #{@customdata}>"
end