Class: FdxV660Api::TelephoneNumber2

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

Overview

Phone number of the merchant used to execute the payment

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, additional_properties: nil) ⇒ TelephoneNumber2

Returns a new instance of TelephoneNumber2.



65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/fdx_v660_api/models/telephone_number2.rb', line 65

def initialize(type: SKIP, country: SKIP, number: SKIP, network: SKIP,
               primary: 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
  @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_number2.rb', line 23

def country
  @country
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_number2.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_number2.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_number2.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_number2.rb', line 16

def type
  @type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/fdx_v660_api/models/telephone_number2.rb', line 79

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

  # 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.
  TelephoneNumber2.new(type: type,
                       country: country,
                       number: number,
                       network: network,
                       primary: primary,
                       additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



39
40
41
42
43
44
45
46
47
# File 'lib/fdx_v660_api/models/telephone_number2.rb', line 39

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

.nullablesObject

An array for nullable fields



61
62
63
# File 'lib/fdx_v660_api/models/telephone_number2.rb', line 61

def self.nullables
  []
end

.optionalsObject

An array for optional fields



50
51
52
53
54
55
56
57
58
# File 'lib/fdx_v660_api/models/telephone_number2.rb', line 50

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

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



107
108
109
110
111
112
113
# File 'lib/fdx_v660_api/models/telephone_number2.rb', line 107

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.



123
124
125
126
127
128
# File 'lib/fdx_v660_api/models/telephone_number2.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},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



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

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