Class: VisaAcceptanceMergedSpec::ShipTo
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- VisaAcceptanceMergedSpec::ShipTo
- Defined in:
- lib/visa_acceptance_merged_spec/models/ship_to.rb
Overview
ShipTo Model.
Instance Attribute Summary collapse
-
#address1 ⇒ String
First line of the shipping address.
-
#address2 ⇒ String
Second line of the shipping address.
-
#administrative_area ⇒ String
State or province of the shipping address.
-
#building_number ⇒ String
Building number in the street address.
-
#company ⇒ String
Name of the customer’s company.
-
#country ⇒ String
Country of the shipping address.
-
#county ⇒ String
U.S.
-
#destination_code ⇒ Integer
Indicates destination chosen for the transaction.
-
#destination_types ⇒ String
Shipping destination of item.
-
#district ⇒ String
Neighborhood, community, or region within a city or municipality.
-
#email ⇒ String
Email of the recipient.
-
#first_name ⇒ String
First name of the recipient.
-
#last_name ⇒ String
Last name of the recipient.
-
#locality ⇒ String
City of the shipping address.
-
#method ⇒ String
Shipping method for the product.
-
#middle_name ⇒ String
Middle name of the recipient.
-
#phone_number ⇒ String
Phone number associated with the shipping address.
-
#postal_code ⇒ String
Postal code for the shipping address.
-
#title ⇒ String
The title of the person receiving the product.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(title: SKIP, first_name: SKIP, middle_name: SKIP, last_name: SKIP, address1: SKIP, address2: SKIP, locality: SKIP, administrative_area: SKIP, postal_code: SKIP, county: SKIP, country: SKIP, district: SKIP, building_number: SKIP, phone_number: SKIP, email: SKIP, company: SKIP, destination_types: SKIP, destination_code: SKIP, method: SKIP, additional_properties: nil) ⇒ ShipTo
constructor
A new instance of ShipTo.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(title: SKIP, first_name: SKIP, middle_name: SKIP, last_name: SKIP, address1: SKIP, address2: SKIP, locality: SKIP, administrative_area: SKIP, postal_code: SKIP, county: SKIP, country: SKIP, district: SKIP, building_number: SKIP, phone_number: SKIP, email: SKIP, company: SKIP, destination_types: SKIP, destination_code: SKIP, method: SKIP, additional_properties: nil) ⇒ ShipTo
Returns a new instance of ShipTo.
236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 |
# File 'lib/visa_acceptance_merged_spec/models/ship_to.rb', line 236 def initialize(title: SKIP, first_name: SKIP, middle_name: SKIP, last_name: SKIP, address1: SKIP, address2: SKIP, locality: SKIP, administrative_area: SKIP, postal_code: SKIP, county: SKIP, country: SKIP, district: SKIP, building_number: SKIP, phone_number: SKIP, email: SKIP, company: SKIP, destination_types: SKIP, destination_code: SKIP, method: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @title = title unless title == SKIP @first_name = first_name unless first_name == SKIP @middle_name = middle_name unless middle_name == SKIP @last_name = last_name unless last_name == SKIP @address1 = address1 unless address1 == SKIP @address2 = address2 unless address2 == SKIP @locality = locality unless locality == SKIP @administrative_area = administrative_area unless administrative_area == SKIP @postal_code = postal_code unless postal_code == SKIP @county = county unless county == SKIP @country = country unless country == SKIP @district = district unless district == SKIP @building_number = building_number unless building_number == SKIP @phone_number = phone_number unless phone_number == SKIP @email = email unless email == SKIP @company = company unless company == SKIP @destination_types = destination_types unless destination_types == SKIP @destination_code = destination_code unless destination_code == SKIP @method = method unless method == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#address1 ⇒ String
First line of the shipping address. Required field for authorization if any shipping address information is included in the request; otherwise, optional.
Tax Calculation
Optional field for U.S. and Canadian taxes. Not applicable to international and value added taxes. Billing address objects will be used to determine the cardholder’s location when shipTo objects are not present.
52 53 54 |
# File 'lib/visa_acceptance_merged_spec/models/ship_to.rb', line 52 def address1 @address1 end |
#address2 ⇒ String
Second line of the shipping address. Optional field.
Tax Calculation
Optional field for U.S. and Canadian taxes. Not applicable to international and value added taxes. Billing address objects will be used to determine the cardholder’s location when shipTo objects are not present.
62 63 64 |
# File 'lib/visa_acceptance_merged_spec/models/ship_to.rb', line 62 def address2 @address2 end |
#administrative_area ⇒ String
State or province of the shipping address. Use the [State, Province, and Territory Codes for the United States and Canada]( (maximum length: 2) Required field for authorization if any shipping address information is included in the request and shipping to the U.S. or Canada; otherwise, optional.
Tax Calculation
Optional field for U.S. and Canadian taxes. Not applicable to international and value added taxes. Billing address objects will be used to determine the cardholder’s location when shipTo objects are not present.
87 88 89 |
# File 'lib/visa_acceptance_merged_spec/models/ship_to.rb', line 87 def administrative_area @administrative_area end |
#building_number ⇒ String
Building number in the street address. For example, the building number is 187 in the following address: Rua da Quitanda 187
139 140 141 |
# File 'lib/visa_acceptance_merged_spec/models/ship_to.rb', line 139 def building_number @building_number end |
#company ⇒ String
Name of the customer’s company.
151 152 153 |
# File 'lib/visa_acceptance_merged_spec/models/ship_to.rb', line 151 def company @company end |
#country ⇒ String
Country of the shipping address. Use the two-character [ISO Standard Country Codes.]( Required field for authorization if any shipping address information is included in the request; otherwise, optional.
Tax Calculation
Optional field for U.S., Canadian, international tax, and value added taxes. Billing address objects will be used to determine the cardholder’s location when shipTo objects are not present.
129 130 131 |
# File 'lib/visa_acceptance_merged_spec/models/ship_to.rb', line 129 def country @country end |
#county ⇒ String
U.S. county if available.
117 118 119 |
# File 'lib/visa_acceptance_merged_spec/models/ship_to.rb', line 117 def county @county end |
#destination_code ⇒ Integer
Indicates destination chosen for the transaction. Possible values:
- 01- Ship to cardholder billing address
- 02- Ship to another verified address on file with merchant
- 03- Ship to address that is different than billing address
- 04- Ship to store (store address should be populated on request)
- 05- Digital goods
- 06- Travel and event tickets, not shipped
- 07- Other
166 167 168 |
# File 'lib/visa_acceptance_merged_spec/models/ship_to.rb', line 166 def destination_code @destination_code end |
#destination_types ⇒ String
Shipping destination of item. Example: Commercial, Residential, Store
155 156 157 |
# File 'lib/visa_acceptance_merged_spec/models/ship_to.rb', line 155 def destination_types @destination_types end |
#district ⇒ String
Neighborhood, community, or region within a city or municipality.
133 134 135 |
# File 'lib/visa_acceptance_merged_spec/models/ship_to.rb', line 133 def district @district end |
#email ⇒ String
Email of the recipient.
147 148 149 |
# File 'lib/visa_acceptance_merged_spec/models/ship_to.rb', line 147 def email @email end |
#first_name ⇒ String
First name of the recipient.
Litle
Maximum length: 25
All other processors
Maximum length: 60 Optional field.
23 24 25 |
# File 'lib/visa_acceptance_merged_spec/models/ship_to.rb', line 23 def first_name @first_name end |
#last_name ⇒ String
Last name of the recipient.
Litle
Maximum length: 25
All other processors
Maximum length: 60 Optional field.
41 42 43 |
# File 'lib/visa_acceptance_merged_spec/models/ship_to.rb', line 41 def last_name @last_name end |
#locality ⇒ String
City of the shipping address. Required field for authorization if any shipping address information is included in the request and shipping to the U.S. or Canada; otherwise, optional.
Tax Calculation
Optional field for U.S. and Canadian taxes. Not applicable to international and value added taxes. Billing address objects will be used to determine the cardholder’s location when shipTo objects are not present.
74 75 76 |
# File 'lib/visa_acceptance_merged_spec/models/ship_to.rb', line 74 def locality @locality end |
#method ⇒ String
Shipping method for the product. Possible values:
- lowcost: Lowest-cost service
- sameday: Courier or same-day service
- oneday: Next-day or overnight service
- twoday: Two-day service
- threeday: Three-day service
- pickup: Store pick-up
- other: Other shipping method
- none: No shipping method because product is a service or subscription Required for American Express SafeKey (U.S.).
179 180 181 |
# File 'lib/visa_acceptance_merged_spec/models/ship_to.rb', line 179 def method @method end |
#middle_name ⇒ String
Middle name of the recipient.
Litle
Maximum length: 25
All other processors
Maximum length: 60 Optional field.
32 33 34 |
# File 'lib/visa_acceptance_merged_spec/models/ship_to.rb', line 32 def middle_name @middle_name end |
#phone_number ⇒ String
Phone number associated with the shipping address.
143 144 145 |
# File 'lib/visa_acceptance_merged_spec/models/ship_to.rb', line 143 def phone_number @phone_number end |
#postal_code ⇒ String
Postal code for the shipping address. The postal code must consist of 5 to 9 digits. Required field for authorization if any shipping address information is included in the request and shipping to the U.S. or Canada; otherwise, optional. When the billing country is the U.S., the 9-digit postal code must follow this format: [5 digits][dash][4 digits] Example 12345-6789 When the billing country is Canada, the 6-digit postal code must follow this format: [alpha][numeric][alpha][space][numeric][alpha][numeric] Example A1B 2C3
American Express Direct
Before sending the postal code to the processor, all nonalphanumeric characters are removed and, if the remaining value is longer than nine characters, the value is truncated starting from the right side.
Tax Calculation
Optional field for U.S. and Canadian taxes. Not applicable to international and value added taxes. Billing address objects will be used to determine the cardholder’s location when shipTo objects are not present.
113 114 115 |
# File 'lib/visa_acceptance_merged_spec/models/ship_to.rb', line 113 def postal_code @postal_code end |
#title ⇒ String
The title of the person receiving the product.
14 15 16 |
# File 'lib/visa_acceptance_merged_spec/models/ship_to.rb', line 14 def title @title end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 |
# File 'lib/visa_acceptance_merged_spec/models/ship_to.rb', line 270 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. title = hash.key?('title') ? hash['title'] : SKIP first_name = hash.key?('firstName') ? hash['firstName'] : SKIP middle_name = hash.key?('middleName') ? hash['middleName'] : SKIP last_name = hash.key?('lastName') ? hash['lastName'] : SKIP address1 = hash.key?('address1') ? hash['address1'] : SKIP address2 = hash.key?('address2') ? hash['address2'] : SKIP locality = hash.key?('locality') ? hash['locality'] : SKIP administrative_area = hash.key?('administrativeArea') ? hash['administrativeArea'] : SKIP postal_code = hash.key?('postalCode') ? hash['postalCode'] : SKIP county = hash.key?('county') ? hash['county'] : SKIP country = hash.key?('country') ? hash['country'] : SKIP district = hash.key?('district') ? hash['district'] : SKIP building_number = hash.key?('buildingNumber') ? hash['buildingNumber'] : SKIP phone_number = hash.key?('phoneNumber') ? hash['phoneNumber'] : SKIP email = hash.key?('email') ? hash['email'] : SKIP company = hash.key?('company') ? hash['company'] : SKIP destination_types = hash.key?('destinationTypes') ? hash['destinationTypes'] : SKIP destination_code = hash.key?('destinationCode') ? hash['destinationCode'] : SKIP method = hash.key?('method') ? hash['method'] : 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. ShipTo.new(title: title, first_name: first_name, middle_name: middle_name, last_name: last_name, address1: address1, address2: address2, locality: locality, administrative_area: administrative_area, postal_code: postal_code, county: county, country: country, district: district, building_number: building_number, phone_number: phone_number, email: email, company: company, destination_types: destination_types, destination_code: destination_code, method: method, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 |
# File 'lib/visa_acceptance_merged_spec/models/ship_to.rb', line 182 def self.names @_hash = {} if @_hash.nil? @_hash['title'] = 'title' @_hash['first_name'] = 'firstName' @_hash['middle_name'] = 'middleName' @_hash['last_name'] = 'lastName' @_hash['address1'] = 'address1' @_hash['address2'] = 'address2' @_hash['locality'] = 'locality' @_hash['administrative_area'] = 'administrativeArea' @_hash['postal_code'] = 'postalCode' @_hash['county'] = 'county' @_hash['country'] = 'country' @_hash['district'] = 'district' @_hash['building_number'] = 'buildingNumber' @_hash['phone_number'] = 'phoneNumber' @_hash['email'] = 'email' @_hash['company'] = 'company' @_hash['destination_types'] = 'destinationTypes' @_hash['destination_code'] = 'destinationCode' @_hash['method'] = 'method' @_hash end |
.nullables ⇒ Object
An array for nullable fields
232 233 234 |
# File 'lib/visa_acceptance_merged_spec/models/ship_to.rb', line 232 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 |
# File 'lib/visa_acceptance_merged_spec/models/ship_to.rb', line 207 def self.optionals %w[ title first_name middle_name last_name address1 address2 locality administrative_area postal_code county country district building_number phone_number email company destination_types destination_code method ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
342 343 344 345 346 347 348 349 350 351 352 353 |
# File 'lib/visa_acceptance_merged_spec/models/ship_to.rb', line 342 def inspect class_name = self.class.name.split('::').last "<#{class_name} title: #{@title.inspect}, first_name: #{@first_name.inspect}, middle_name:"\ " #{@middle_name.inspect}, last_name: #{@last_name.inspect}, address1: #{@address1.inspect},"\ " address2: #{@address2.inspect}, locality: #{@locality.inspect}, administrative_area:"\ " #{@administrative_area.inspect}, postal_code: #{@postal_code.inspect}, county:"\ " #{@county.inspect}, country: #{@country.inspect}, district: #{@district.inspect},"\ " building_number: #{@building_number.inspect}, phone_number: #{@phone_number.inspect},"\ " email: #{@email.inspect}, company: #{@company.inspect}, destination_types:"\ " #{@destination_types.inspect}, destination_code: #{@destination_code.inspect}, method:"\ " #{@method.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
329 330 331 332 333 334 335 336 337 338 339 |
# File 'lib/visa_acceptance_merged_spec/models/ship_to.rb', line 329 def to_s class_name = self.class.name.split('::').last "<#{class_name} title: #{@title}, first_name: #{@first_name}, middle_name: #{@middle_name},"\ " last_name: #{@last_name}, address1: #{@address1}, address2: #{@address2}, locality:"\ " #{@locality}, administrative_area: #{@administrative_area}, postal_code: #{@postal_code},"\ " county: #{@county}, country: #{@country}, district: #{@district}, building_number:"\ " #{@building_number}, phone_number: #{@phone_number}, email: #{@email}, company:"\ " #{@company}, destination_types: #{@destination_types}, destination_code:"\ " #{@destination_code}, method: #{@method}, additional_properties:"\ " #{@additional_properties}>" end |