Class: Verizon::M5GBiAddress

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

Overview

M5GBiAddress 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(address_line1: SKIP, city: SKIP, state: SKIP, zip: SKIP, zip_4: SKIP, phone: SKIP, phone_type: SKIP, email_address: SKIP, additional_properties: nil) ⇒ M5GBiAddress

Returns a new instance of M5GBiAddress.



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/verizon/models/m_5g_bi_address.rb', line 77

def initialize(address_line1: SKIP, city: SKIP, state: SKIP, zip: SKIP,
               zip_4: SKIP, phone: SKIP, phone_type: SKIP,
               email_address: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @address_line1 = address_line1 unless address_line1 == SKIP
  @city = city unless city == SKIP
  @state = state unless state == SKIP
  @zip = zip unless zip == SKIP
  @zip_4 = zip_4 unless zip_4 == SKIP
  @phone = phone unless phone == SKIP
  @phone_type = phone_type unless phone_type == SKIP
  @email_address = email_address unless email_address == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#address_line1String

TODO: Write general description for this method

Returns:

  • (String)


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

def address_line1
  @address_line1
end

#cityString

TODO: Write general description for this method

Returns:

  • (String)


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

def city
  @city
end

#email_addressString

TODO: Write general description for this method

Returns:

  • (String)


42
43
44
# File 'lib/verizon/models/m_5g_bi_address.rb', line 42

def email_address
  @email_address
end

#phoneString

TODO: Write general description for this method

Returns:

  • (String)


34
35
36
# File 'lib/verizon/models/m_5g_bi_address.rb', line 34

def phone
  @phone
end

#phone_typeString

TODO: Write general description for this method

Returns:

  • (String)


38
39
40
# File 'lib/verizon/models/m_5g_bi_address.rb', line 38

def phone_type
  @phone_type
end

#stateString

TODO: Write general description for this method

Returns:

  • (String)


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

def state
  @state
end

#zipString

TODO: Write general description for this method

Returns:

  • (String)


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

def zip
  @zip
end

#zip_4String

TODO: Write general description for this method

Returns:

  • (String)


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

def zip_4
  @zip_4
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
124
125
# File 'lib/verizon/models/m_5g_bi_address.rb', line 95

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  address_line1 = hash.key?('addressLine1') ? hash['addressLine1'] : SKIP
  city = hash.key?('city') ? hash['city'] : SKIP
  state = hash.key?('state') ? hash['state'] : SKIP
  zip = hash.key?('zip') ? hash['zip'] : SKIP
  zip_4 = hash.key?('zip+4') ? hash['zip+4'] : SKIP
  phone = hash.key?('phone') ? hash['phone'] : SKIP
  phone_type = hash.key?('phoneType') ? hash['phoneType'] : SKIP
  email_address = hash.key?('emailAddress') ? hash['emailAddress'] : 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.
  M5GBiAddress.new(address_line1: address_line1,
                   city: city,
                   state: state,
                   zip: zip,
                   zip_4: zip_4,
                   phone: phone,
                   phone_type: phone_type,
                   email_address: email_address,
                   additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['address_line1'] = 'addressLine1'
  @_hash['city'] = 'city'
  @_hash['state'] = 'state'
  @_hash['zip'] = 'zip'
  @_hash['zip_4'] = 'zip+4'
  @_hash['phone'] = 'phone'
  @_hash['phone_type'] = 'phoneType'
  @_hash['email_address'] = 'emailAddress'
  @_hash
end

.nullablesObject

An array for nullable fields



73
74
75
# File 'lib/verizon/models/m_5g_bi_address.rb', line 73

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    address_line1
    city
    state
    zip
    zip_4
    phone
    phone_type
    email_address
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:

  • The (M5GBiAddress | Hash)

    value against the validation is performed.



129
130
131
132
133
134
135
# File 'lib/verizon/models/m_5g_bi_address.rb', line 129

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.



146
147
148
149
150
151
152
# File 'lib/verizon/models/m_5g_bi_address.rb', line 146

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} address_line1: #{@address_line1.inspect}, city: #{@city.inspect}, state:"\
  " #{@state.inspect}, zip: #{@zip.inspect}, zip_4: #{@zip_4.inspect}, phone:"\
  " #{@phone.inspect}, phone_type: #{@phone_type.inspect}, email_address:"\
  " #{@email_address.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



138
139
140
141
142
143
# File 'lib/verizon/models/m_5g_bi_address.rb', line 138

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} address_line1: #{@address_line1}, city: #{@city}, state: #{@state}, zip:"\
  " #{@zip}, zip_4: #{@zip_4}, phone: #{@phone}, phone_type: #{@phone_type}, email_address:"\
  " #{@email_address}, additional_properties: #{@additional_properties}>"
end