Class: Verizon::DtoUserDto
- Defined in:
- lib/verizon/models/dto_user_dto.rb
Overview
DtoUserDto Model.
Instance Attribute Summary collapse
-
#customdata ⇒ Hash[String, Object]
Name/value pair, where the value is client defined.
-
#email ⇒ String
Contact email for the group.
-
#firstname ⇒ String
The first name in the user record.
-
#lastname ⇒ String
The last name in the user record.
-
#mdn ⇒ String
The Mobile Directory Number.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(email: SKIP, firstname: SKIP, lastname: SKIP, mdn: SKIP, customdata: SKIP) ⇒ DtoUserDto
constructor
A new instance of DtoUserDto.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
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
#customdata ⇒ Hash[String, Object]
Name/value pair, where the value is client defined. The purpose is to keep track of current state per device action.
31 32 33 |
# File 'lib/verizon/models/dto_user_dto.rb', line 31 def customdata @customdata end |
#email ⇒ String
Contact email for the group
14 15 16 |
# File 'lib/verizon/models/dto_user_dto.rb', line 14 def email @email end |
#firstname ⇒ String
The first name in the user record
18 19 20 |
# File 'lib/verizon/models/dto_user_dto.rb', line 18 def firstname @firstname end |
#lastname ⇒ String
The last name in the user record
22 23 24 |
# File 'lib/verizon/models/dto_user_dto.rb', line 22 def lastname @lastname end |
#mdn ⇒ String
The Mobile Directory Number
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 |
.names ⇒ Object
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 |
.nullables ⇒ Object
An array for nullable fields
56 57 58 |
# File 'lib/verizon/models/dto_user_dto.rb', line 56 def self.nullables [] end |
.optionals ⇒ Object
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
#inspect ⇒ Object
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_s ⇒ Object
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 |