Class: FdxV660Api::TelephoneNumberPlusExtension

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

Overview

A telephone number that can contain optional text for an arbitrary length telephone extension 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) ⇒ TelephoneNumberPlusExtension

Returns a new instance of TelephoneNumberPlusExtension.



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

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)


24
25
26
# File 'lib/fdx_v660_api/models/telephone_number_plus_extension.rb', line 24

def country
  @country
end

#extensionString

An arbitrary length telephone number extension

Returns:

  • (String)


41
42
43
# File 'lib/fdx_v660_api/models/telephone_number_plus_extension.rb', line 41

def extension
  @extension
end

#networkTelephoneNetwork

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

Returns:



33
34
35
# File 'lib/fdx_v660_api/models/telephone_number_plus_extension.rb', line 33

def network
  @network
end

#numberString

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

Returns:

  • (String)


28
29
30
# File 'lib/fdx_v660_api/models/telephone_number_plus_extension.rb', line 28

def number
  @number
end

#primaryTrueClass | FalseClass

Whether this is the primary and first telephone number to call

Returns:

  • (TrueClass | FalseClass)


37
38
39
# File 'lib/fdx_v660_api/models/telephone_number_plus_extension.rb', line 37

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



17
18
19
# File 'lib/fdx_v660_api/models/telephone_number_plus_extension.rb', line 17

def type
  @type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
113
# File 'lib/fdx_v660_api/models/telephone_number_plus_extension.rb', line 87

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.
  TelephoneNumberPlusExtension.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.



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

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



68
69
70
# File 'lib/fdx_v660_api/models/telephone_number_plus_extension.rb', line 68

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

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

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



117
118
119
120
121
122
123
# File 'lib/fdx_v660_api/models/telephone_number_plus_extension.rb', line 117

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.



134
135
136
137
138
139
# File 'lib/fdx_v660_api/models/telephone_number_plus_extension.rb', line 134

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.



126
127
128
129
130
131
# File 'lib/fdx_v660_api/models/telephone_number_plus_extension.rb', line 126

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