Class: Verizon::M5GBiCustomerName

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

Overview

M5GBiCustomerName 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(first_name: SKIP, last_name: SKIP, middle_name: SKIP, title: SKIP, suffex: SKIP, additional_properties: nil) ⇒ M5GBiCustomerName

Returns a new instance of M5GBiCustomerName.



59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/verizon/models/m_5g_bi_customer_name.rb', line 59

def initialize(first_name: SKIP, last_name: SKIP, middle_name: SKIP,
               title: SKIP, suffex: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @first_name = first_name unless first_name == SKIP
  @last_name = last_name unless last_name == SKIP
  @middle_name = middle_name unless middle_name == SKIP
  @title = title unless title == SKIP
  @suffex = suffex unless suffex == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#first_nameString

TODO: Write general description for this method

Returns:

  • (String)


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

def first_name
  @first_name
end

#last_nameString

TODO: Write general description for this method

Returns:

  • (String)


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

def last_name
  @last_name
end

#middle_nameString

TODO: Write general description for this method

Returns:

  • (String)


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

def middle_name
  @middle_name
end

#suffexString

TODO: Write general description for this method

Returns:

  • (String)


30
31
32
# File 'lib/verizon/models/m_5g_bi_customer_name.rb', line 30

def suffex
  @suffex
end

#titleString

TODO: Write general description for this method

Returns:

  • (String)


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

def title
  @title
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a 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
# File 'lib/verizon/models/m_5g_bi_customer_name.rb', line 73

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  first_name = hash.key?('firstName') ? hash['firstName'] : SKIP
  last_name = hash.key?('lastName') ? hash['lastName'] : SKIP
  middle_name = hash.key?('middleName') ? hash['middleName'] : SKIP
  title = hash.key?('title') ? hash['title'] : SKIP
  suffex = hash.key?('suffex') ? hash['suffex'] : SKIP

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  M5GBiCustomerName.new(first_name: first_name,
                        last_name: last_name,
                        middle_name: middle_name,
                        title: title,
                        suffex: suffex,
                        additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['first_name'] = 'firstName'
  @_hash['last_name'] = 'lastName'
  @_hash['middle_name'] = 'middleName'
  @_hash['title'] = 'title'
  @_hash['suffex'] = 'suffex'
  @_hash
end

.nullablesObject

An array for nullable fields



55
56
57
# File 'lib/verizon/models/m_5g_bi_customer_name.rb', line 55

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    first_name
    last_name
    middle_name
    title
    suffex
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



101
102
103
104
105
106
107
# File 'lib/verizon/models/m_5g_bi_customer_name.rb', line 101

def self.validate(value)
  return true if value.instance_of? self

  return false unless value.instance_of? Hash

  true
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



118
119
120
121
122
123
# File 'lib/verizon/models/m_5g_bi_customer_name.rb', line 118

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} first_name: #{@first_name.inspect}, last_name: #{@last_name.inspect},"\
  " middle_name: #{@middle_name.inspect}, title: #{@title.inspect}, suffex:"\
  " #{@suffex.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



110
111
112
113
114
115
# File 'lib/verizon/models/m_5g_bi_customer_name.rb', line 110

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} first_name: #{@first_name}, last_name: #{@last_name}, middle_name:"\
  " #{@middle_name}, title: #{@title}, suffex: #{@suffex}, additional_properties:"\
  " #{@additional_properties}>"
end