Class: VisaAcceptanceMergedSpec::BillTo57

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/visa_acceptance_merged_spec/models/bill_to57.rb

Overview

BillTo57 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(address1: SKIP, address2: SKIP, address3: SKIP, address4: SKIP, administrative_area: SKIP, building_number: SKIP, country: SKIP, district: SKIP, locality: SKIP, postal_code: SKIP, company: SKIP, email: SKIP, first_name: SKIP, last_name: SKIP, middle_name: SKIP, name_suffix: SKIP, title: SKIP, phone_number: SKIP, phone_type: SKIP, additional_properties: nil) ⇒ BillTo57

Returns a new instance of BillTo57.



158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
# File 'lib/visa_acceptance_merged_spec/models/bill_to57.rb', line 158

def initialize(address1: SKIP, address2: SKIP, address3: SKIP,
               address4: SKIP, administrative_area: SKIP,
               building_number: SKIP, country: SKIP, district: SKIP,
               locality: SKIP, postal_code: SKIP, company: SKIP,
               email: SKIP, first_name: SKIP, last_name: SKIP,
               middle_name: SKIP, name_suffix: SKIP, title: SKIP,
               phone_number: SKIP, phone_type: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @address1 = address1 unless address1 == SKIP
  @address2 = address2 unless address2 == SKIP
  @address3 = address3 unless address3 == SKIP
  @address4 = address4 unless address4 == SKIP
  @administrative_area = administrative_area unless administrative_area == SKIP
  @building_number = building_number unless building_number == SKIP
  @country = country unless country == SKIP
  @district = district unless district == SKIP
  @locality = locality unless locality == SKIP
  @postal_code = postal_code unless postal_code == SKIP
  @company = company unless company == SKIP
  @email = email unless email == SKIP
  @first_name = first_name unless first_name == SKIP
  @last_name = last_name unless last_name == SKIP
  @middle_name = middle_name unless middle_name == SKIP
  @name_suffix = name_suffix unless name_suffix == SKIP
  @title = title unless title == SKIP
  @phone_number = phone_number unless phone_number == SKIP
  @phone_type = phone_type unless phone_type == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#address1String

Payment card billing street address as it appears on the credit card issuer’s records.

Returns:

  • (String)


15
16
17
# File 'lib/visa_acceptance_merged_spec/models/bill_to57.rb', line 15

def address1
  @address1
end

#address2String

Used for additional address information. For example: Attention: Accounts Payable Optional field.

Returns:

  • (String)


21
22
23
# File 'lib/visa_acceptance_merged_spec/models/bill_to57.rb', line 21

def address2
  @address2
end

#address3String

Additional address information (third line of the billing address)

Returns:

  • (String)


25
26
27
# File 'lib/visa_acceptance_merged_spec/models/bill_to57.rb', line 25

def address3
  @address3
end

#address4String

Additional address information (fourth line of the billing address)

Returns:

  • (String)


29
30
31
# File 'lib/visa_acceptance_merged_spec/models/bill_to57.rb', line 29

def address4
  @address4
end

#administrative_areaString

State or province of the billing address. Use the [State, Province, and Territory Codes for the United States and Canada](

Returns:

  • (String)


34
35
36
# File 'lib/visa_acceptance_merged_spec/models/bill_to57.rb', line 34

def administrative_area
  @administrative_area
end

#building_numberString

Building number in the street address.

Returns:

  • (String)


38
39
40
# File 'lib/visa_acceptance_merged_spec/models/bill_to57.rb', line 38

def building_number
  @building_number
end

#companyCompany5

Postal code for the billing address. The postal code must consist of 5 to 9 digits.

Returns:



62
63
64
# File 'lib/visa_acceptance_merged_spec/models/bill_to57.rb', line 62

def company
  @company
end

#countryString

Payment card billing country. Use the two-character [ISO Standard Country Codes](

Returns:

  • (String)


43
44
45
# File 'lib/visa_acceptance_merged_spec/models/bill_to57.rb', line 43

def country
  @country
end

#districtString

Customer’s neighborhood, community, or region (a barrio in Brazil) within the city or municipality

Returns:

  • (String)


48
49
50
# File 'lib/visa_acceptance_merged_spec/models/bill_to57.rb', line 48

def district
  @district
end

#emailString

Customer's email address, including the full domain name.

Returns:

  • (String)


66
67
68
# File 'lib/visa_acceptance_merged_spec/models/bill_to57.rb', line 66

def email
  @email
end

#first_nameString

Customer’s first name. This name must be the same as the name on the card

Returns:

  • (String)


70
71
72
# File 'lib/visa_acceptance_merged_spec/models/bill_to57.rb', line 70

def first_name
  @first_name
end

#last_nameString

Customer’s last name. This name must be the same as the name on the card.

Returns:

  • (String)


74
75
76
# File 'lib/visa_acceptance_merged_spec/models/bill_to57.rb', line 74

def last_name
  @last_name
end

#localityString

Payment card billing city.

Returns:

  • (String)


52
53
54
# File 'lib/visa_acceptance_merged_spec/models/bill_to57.rb', line 52

def locality
  @locality
end

#middle_nameString

Customer’s middle name.

Returns:

  • (String)


78
79
80
# File 'lib/visa_acceptance_merged_spec/models/bill_to57.rb', line 78

def middle_name
  @middle_name
end

#name_suffixString

Customer’s name suffix.

Returns:

  • (String)


82
83
84
# File 'lib/visa_acceptance_merged_spec/models/bill_to57.rb', line 82

def name_suffix
  @name_suffix
end

#phone_numberString

Customer’s phone number.

Returns:

  • (String)


90
91
92
# File 'lib/visa_acceptance_merged_spec/models/bill_to57.rb', line 90

def phone_number
  @phone_number
end

#phone_typeString

Customer's phone number type.

For Payouts:

This field may be sent only for FDC Compass. Possible Values:

  • day
  • home
  • night
  • work

Returns:

  • (String)


101
102
103
# File 'lib/visa_acceptance_merged_spec/models/bill_to57.rb', line 101

def phone_type
  @phone_type
end

#postal_codeString

Postal code for the billing address. The postal code must consist of 5 to 9 digits.

Returns:

  • (String)


57
58
59
# File 'lib/visa_acceptance_merged_spec/models/bill_to57.rb', line 57

def postal_code
  @postal_code
end

#titleString

Title.

Returns:

  • (String)


86
87
88
# File 'lib/visa_acceptance_merged_spec/models/bill_to57.rb', line 86

def title
  @title
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
# File 'lib/visa_acceptance_merged_spec/models/bill_to57.rb', line 192

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  address1 = hash.key?('address1') ? hash['address1'] : SKIP
  address2 = hash.key?('address2') ? hash['address2'] : SKIP
  address3 = hash.key?('address3') ? hash['address3'] : SKIP
  address4 = hash.key?('address4') ? hash['address4'] : SKIP
  administrative_area =
    hash.key?('administrativeArea') ? hash['administrativeArea'] : SKIP
  building_number =
    hash.key?('buildingNumber') ? hash['buildingNumber'] : SKIP
  country = hash.key?('country') ? hash['country'] : SKIP
  district = hash.key?('district') ? hash['district'] : SKIP
  locality = hash.key?('locality') ? hash['locality'] : SKIP
  postal_code = hash.key?('postalCode') ? hash['postalCode'] : SKIP
  company = Company5.from_hash(hash['company']) if hash['company']
  email = hash.key?('email') ? hash['email'] : SKIP
  first_name = hash.key?('firstName') ? hash['firstName'] : SKIP
  last_name = hash.key?('lastName') ? hash['lastName'] : SKIP
  middle_name = hash.key?('middleName') ? hash['middleName'] : SKIP
  name_suffix = hash.key?('nameSuffix') ? hash['nameSuffix'] : SKIP
  title = hash.key?('title') ? hash['title'] : SKIP
  phone_number = hash.key?('phoneNumber') ? hash['phoneNumber'] : SKIP
  phone_type = hash.key?('phoneType') ? hash['phoneType'] : 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.
  BillTo57.new(address1: address1,
               address2: address2,
               address3: address3,
               address4: address4,
               administrative_area: administrative_area,
               building_number: building_number,
               country: country,
               district: district,
               locality: locality,
               postal_code: postal_code,
               company: company,
               email: email,
               first_name: first_name,
               last_name: last_name,
               middle_name: middle_name,
               name_suffix: name_suffix,
               title: title,
               phone_number: phone_number,
               phone_type: phone_type,
               additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/visa_acceptance_merged_spec/models/bill_to57.rb', line 104

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['address1'] = 'address1'
  @_hash['address2'] = 'address2'
  @_hash['address3'] = 'address3'
  @_hash['address4'] = 'address4'
  @_hash['administrative_area'] = 'administrativeArea'
  @_hash['building_number'] = 'buildingNumber'
  @_hash['country'] = 'country'
  @_hash['district'] = 'district'
  @_hash['locality'] = 'locality'
  @_hash['postal_code'] = 'postalCode'
  @_hash['company'] = 'company'
  @_hash['email'] = 'email'
  @_hash['first_name'] = 'firstName'
  @_hash['last_name'] = 'lastName'
  @_hash['middle_name'] = 'middleName'
  @_hash['name_suffix'] = 'nameSuffix'
  @_hash['title'] = 'title'
  @_hash['phone_number'] = 'phoneNumber'
  @_hash['phone_type'] = 'phoneType'
  @_hash
end

.nullablesObject

An array for nullable fields



154
155
156
# File 'lib/visa_acceptance_merged_spec/models/bill_to57.rb', line 154

def self.nullables
  []
end

.optionalsObject

An array for optional fields



129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# File 'lib/visa_acceptance_merged_spec/models/bill_to57.rb', line 129

def self.optionals
  %w[
    address1
    address2
    address3
    address4
    administrative_area
    building_number
    country
    district
    locality
    postal_code
    company
    email
    first_name
    last_name
    middle_name
    name_suffix
    title
    phone_number
    phone_type
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



261
262
263
264
265
266
267
268
269
270
271
272
# File 'lib/visa_acceptance_merged_spec/models/bill_to57.rb', line 261

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} address1: #{@address1.inspect}, address2: #{@address2.inspect}, address3:"\
  " #{@address3.inspect}, address4: #{@address4.inspect}, administrative_area:"\
  " #{@administrative_area.inspect}, building_number: #{@building_number.inspect}, country:"\
  " #{@country.inspect}, district: #{@district.inspect}, locality: #{@locality.inspect},"\
  " postal_code: #{@postal_code.inspect}, company: #{@company.inspect}, email:"\
  " #{@email.inspect}, first_name: #{@first_name.inspect}, last_name: #{@last_name.inspect},"\
  " middle_name: #{@middle_name.inspect}, name_suffix: #{@name_suffix.inspect}, title:"\
  " #{@title.inspect}, phone_number: #{@phone_number.inspect}, phone_type:"\
  " #{@phone_type.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



249
250
251
252
253
254
255
256
257
258
# File 'lib/visa_acceptance_merged_spec/models/bill_to57.rb', line 249

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} address1: #{@address1}, address2: #{@address2}, address3: #{@address3},"\
  " address4: #{@address4}, administrative_area: #{@administrative_area}, building_number:"\
  " #{@building_number}, country: #{@country}, district: #{@district}, locality: #{@locality},"\
  " postal_code: #{@postal_code}, company: #{@company}, email: #{@email}, first_name:"\
  " #{@first_name}, last_name: #{@last_name}, middle_name: #{@middle_name}, name_suffix:"\
  " #{@name_suffix}, title: #{@title}, phone_number: #{@phone_number}, phone_type:"\
  " #{@phone_type}, additional_properties: #{@additional_properties}>"
end