Class: FdxV660Api::TelephoneNumberPlusExtension2

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/fdx_v660_api/models/telephone_number_plus_extension2.rb

Overview

Phone number

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(type: SKIP, country: SKIP, number: SKIP, network: SKIP, primary: SKIP, extension: SKIP, additional_properties: nil) ⇒ TelephoneNumberPlusExtension2

Returns a new instance of TelephoneNumberPlusExtension2.



71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/fdx_v660_api/models/telephone_number_plus_extension2.rb', line 71

def initialize(type: SKIP, country: SKIP, number: SKIP, network: SKIP,
               primary: SKIP, extension: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @type = type unless type == SKIP
  @country = country unless country == SKIP
  @number = number unless number == SKIP
  @network = network unless network == SKIP
  @primary = primary unless primary == SKIP
  @extension = extension unless extension == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#countryString

Country calling codes defined by ITU-T recommendations E.123 and E.164, such as '+1' for United States and Canada, see [List_of_country_calling_codes](https://en.wikipedia.org/wiki/List_of_coun try_calling_codes)

Returns:

  • (String)


23
24
25
# File 'lib/fdx_v660_api/models/telephone_number_plus_extension2.rb', line 23

def country
  @country
end

#extensionString

An arbitrary length telephone number extension

Returns:

  • (String)


40
41
42
# File 'lib/fdx_v660_api/models/telephone_number_plus_extension2.rb', line 40

def extension
  @extension
end

#networkTelephoneNetwork

The network technology used for this telephone. One of CELLULAR, LANDLINE, PAGER, SATELLITE, or VOIP

Returns:



32
33
34
# File 'lib/fdx_v660_api/models/telephone_number_plus_extension2.rb', line 32

def network
  @network
end

#numberString

Telephone subscriber number defined by ITU-T recommendation E.164

Returns:

  • (String)


27
28
29
# File 'lib/fdx_v660_api/models/telephone_number_plus_extension2.rb', line 27

def number
  @number
end

#primaryTrueClass | FalseClass

Whether this is the primary and first telephone number to call

Returns:

  • (TrueClass | FalseClass)


36
37
38
# File 'lib/fdx_v660_api/models/telephone_number_plus_extension2.rb', line 36

def primary
  @primary
end

#typeTelephoneNumberPurpose2

Purpose of the phone number: HOME, BUSINESS, PERSONAL, FAX, or BOTH. BOTH indicates number is used for both HOME and BUSINESS purposes. CELL value is deprecated in v6.3, replaced as a network value



16
17
18
# File 'lib/fdx_v660_api/models/telephone_number_plus_extension2.rb', line 16

def type
  @type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
# File 'lib/fdx_v660_api/models/telephone_number_plus_extension2.rb', line 86

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  type = hash.key?('type') ? hash['type'] : SKIP
  country = hash.key?('country') ? hash['country'] : SKIP
  number = hash.key?('number') ? hash['number'] : SKIP
  network = hash.key?('network') ? hash['network'] : SKIP
  primary = hash.key?('primary') ? hash['primary'] : SKIP
  extension = hash.key?('extension') ? hash['extension'] : 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.
  TelephoneNumberPlusExtension2.new(type: type,
                                    country: country,
                                    number: number,
                                    network: network,
                                    primary: primary,
                                    extension: extension,
                                    additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



43
44
45
46
47
48
49
50
51
52
# File 'lib/fdx_v660_api/models/telephone_number_plus_extension2.rb', line 43

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['type'] = 'type'
  @_hash['country'] = 'country'
  @_hash['number'] = 'number'
  @_hash['network'] = 'network'
  @_hash['primary'] = 'primary'
  @_hash['extension'] = 'extension'
  @_hash
end

.nullablesObject

An array for nullable fields



67
68
69
# File 'lib/fdx_v660_api/models/telephone_number_plus_extension2.rb', line 67

def self.nullables
  []
end

.optionalsObject

An array for optional fields



55
56
57
58
59
60
61
62
63
64
# File 'lib/fdx_v660_api/models/telephone_number_plus_extension2.rb', line 55

def self.optionals
  %w[
    type
    country
    number
    network
    primary
    extension
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



123
124
125
126
127
128
# File 'lib/fdx_v660_api/models/telephone_number_plus_extension2.rb', line 123

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} type: #{@type.inspect}, country: #{@country.inspect}, number:"\
  " #{@number.inspect}, network: #{@network.inspect}, primary: #{@primary.inspect}, extension:"\
  " #{@extension.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



115
116
117
118
119
120
# File 'lib/fdx_v660_api/models/telephone_number_plus_extension2.rb', line 115

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} type: #{@type}, country: #{@country}, number: #{@number}, network:"\
  " #{@network}, primary: #{@primary}, extension: #{@extension}, additional_properties:"\
  " #{@additional_properties}>"
end