Class: FdxV660Api::NameAddressAndPhone1

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

Overview

Acquirer's information contact name, street address, city or town, state or province, country, ZIP or foreign postal code, and telephone no. (If different from ACQUIRER)

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(line1: SKIP, line2: SKIP, line3: SKIP, city: SKIP, region: SKIP, postal_code: SKIP, country: SKIP, unit_type: SKIP, unit_number: SKIP, name1: SKIP, name2: SKIP, phone: SKIP, additional_properties: nil) ⇒ NameAddressAndPhone1

Returns a new instance of NameAddressAndPhone1.



113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# File 'lib/fdx_v660_api/models/name_address_and_phone1.rb', line 113

def initialize(line1: SKIP, line2: SKIP, line3: SKIP, city: SKIP,
               region: SKIP, postal_code: SKIP, country: SKIP,
               unit_type: SKIP, unit_number: SKIP, name1: SKIP, name2: SKIP,
               phone: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @line1 = line1 unless line1 == SKIP
  @line2 = line2 unless line2 == SKIP
  @line3 = line3 unless line3 == SKIP
  @city = city unless city == SKIP
  @region = region unless region == SKIP
  @postal_code = postal_code unless postal_code == SKIP
  @country = country unless country == SKIP
  @unit_type = unit_type unless unit_type == SKIP
  @unit_number = unit_number unless unit_number == SKIP
  @name1 = name1 unless name1 == SKIP
  @name2 = name2 unless name2 == SKIP
  @phone = phone unless phone == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#cityString

City

Returns:

  • (String)


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

def city
  @city
end

#countryIso3166CountryCode1

Country code

Returns:



47
48
49
# File 'lib/fdx_v660_api/models/name_address_and_phone1.rb', line 47

def country
  @country
end

#line1String

Address line 1

Returns:

  • (String)


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

def line1
  @line1
end

#line2String

Address line 2

Returns:

  • (String)


20
21
22
# File 'lib/fdx_v660_api/models/name_address_and_phone1.rb', line 20

def line2
  @line2
end

#line3String

Address line 3

Returns:

  • (String)


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

def line3
  @line3
end

#name1String

Name line 1

Returns:

  • (String)


62
63
64
# File 'lib/fdx_v660_api/models/name_address_and_phone1.rb', line 62

def name1
  @name1
end

#name2String

Name line 2

Returns:

  • (String)


66
67
68
# File 'lib/fdx_v660_api/models/name_address_and_phone1.rb', line 66

def name2
  @name2
end

#phoneTelephoneNumberPlusExtension2

Phone number



70
71
72
# File 'lib/fdx_v660_api/models/name_address_and_phone1.rb', line 70

def phone
  @phone
end

#postal_codeString

Postal code

Returns:

  • (String)


43
44
45
# File 'lib/fdx_v660_api/models/name_address_and_phone1.rb', line 43

def postal_code
  @postal_code
end

#regionString

State, Province, Territory, Canton or Prefecture. From [Universal Postal Union](https://www.upu.int/en/Postal-Solutions/Programmes-Services/Address ing-Solutions#addressing-s42-standard) as of 2-26-2020, [S42 International Address Standards](https://www.upu.int/UPU/media/upu/documents/PostCode/S42_Intern ational-Addressing-Standards.pdf). For U.S. addresses can be a 2-character code from StateCode. For Canadian addresses can be a 2-character code from ProvinceTerritoryCode

Returns:

  • (String)


39
40
41
# File 'lib/fdx_v660_api/models/name_address_and_phone1.rb', line 39

def region
  @region
end

#unit_numberString

The number component of the address location's unit, can contain letters as appropriate

Returns:

  • (String)


58
59
60
# File 'lib/fdx_v660_api/models/name_address_and_phone1.rb', line 58

def unit_number
  @unit_number
end

#unit_typeString

Text name for type of unit, such as Suite, Apt./Apartment, Room, Floor, or Dept./Department. Does not appear on tax forms, for use in creating a postal address from a tax form recipient address

Returns:

  • (String)


53
54
55
# File 'lib/fdx_v660_api/models/name_address_and_phone1.rb', line 53

def unit_type
  @unit_type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
# File 'lib/fdx_v660_api/models/name_address_and_phone1.rb', line 136

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  line1 = hash.key?('line1') ? hash['line1'] : SKIP
  line2 = hash.key?('line2') ? hash['line2'] : SKIP
  line3 = hash.key?('line3') ? hash['line3'] : SKIP
  city = hash.key?('city') ? hash['city'] : SKIP
  region = hash.key?('region') ? hash['region'] : SKIP
  postal_code = hash.key?('postalCode') ? hash['postalCode'] : SKIP
  country = hash.key?('country') ? hash['country'] : SKIP
  unit_type = hash.key?('unitType') ? hash['unitType'] : SKIP
  unit_number = hash.key?('unitNumber') ? hash['unitNumber'] : SKIP
  name1 = hash.key?('name1') ? hash['name1'] : SKIP
  name2 = hash.key?('name2') ? hash['name2'] : SKIP
  phone = TelephoneNumberPlusExtension2.from_hash(hash['phone']) if hash['phone']

  # 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.
  NameAddressAndPhone1.new(line1: line1,
                           line2: line2,
                           line3: line3,
                           city: city,
                           region: region,
                           postal_code: postal_code,
                           country: country,
                           unit_type: unit_type,
                           unit_number: unit_number,
                           name1: name1,
                           name2: name2,
                           phone: phone,
                           additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/fdx_v660_api/models/name_address_and_phone1.rb', line 73

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['line1'] = 'line1'
  @_hash['line2'] = 'line2'
  @_hash['line3'] = 'line3'
  @_hash['city'] = 'city'
  @_hash['region'] = 'region'
  @_hash['postal_code'] = 'postalCode'
  @_hash['country'] = 'country'
  @_hash['unit_type'] = 'unitType'
  @_hash['unit_number'] = 'unitNumber'
  @_hash['name1'] = 'name1'
  @_hash['name2'] = 'name2'
  @_hash['phone'] = 'phone'
  @_hash
end

.nullablesObject

An array for nullable fields



109
110
111
# File 'lib/fdx_v660_api/models/name_address_and_phone1.rb', line 109

def self.nullables
  []
end

.optionalsObject

An array for optional fields



91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/fdx_v660_api/models/name_address_and_phone1.rb', line 91

def self.optionals
  %w[
    line1
    line2
    line3
    city
    region
    postal_code
    country
    unit_type
    unit_number
    name1
    name2
    phone
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



186
187
188
189
190
191
192
193
# File 'lib/fdx_v660_api/models/name_address_and_phone1.rb', line 186

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} line1: #{@line1.inspect}, line2: #{@line2.inspect}, line3:"\
  " #{@line3.inspect}, city: #{@city.inspect}, region: #{@region.inspect}, postal_code:"\
  " #{@postal_code.inspect}, country: #{@country.inspect}, unit_type: #{@unit_type.inspect},"\
  " unit_number: #{@unit_number.inspect}, name1: #{@name1.inspect}, name2: #{@name2.inspect},"\
  " phone: #{@phone.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



177
178
179
180
181
182
183
# File 'lib/fdx_v660_api/models/name_address_and_phone1.rb', line 177

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} line1: #{@line1}, line2: #{@line2}, line3: #{@line3}, city: #{@city},"\
  " region: #{@region}, postal_code: #{@postal_code}, country: #{@country}, unit_type:"\
  " #{@unit_type}, unit_number: #{@unit_number}, name1: #{@name1}, name2: #{@name2}, phone:"\
  " #{@phone}, additional_properties: #{@additional_properties}>"
end