Class: CyberSourceMergedSpec::ShipTo
- Defined in:
- lib/cyber_source_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_element(root) ⇒ Object
-
.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.
- #to_xml_element(doc, root_name) ⇒ 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.
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 268 269 270 271 |
# File 'lib/cyber_source_merged_spec/models/ship_to.rb', line 240 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/cyber_source_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/cyber_source_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](https://developer.cybersource.com/library/documentation/sbc/quickr ef/states_and_provinces.pdf) (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.
89 90 91 |
# File 'lib/cyber_source_merged_spec/models/ship_to.rb', line 89 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
143 144 145 |
# File 'lib/cyber_source_merged_spec/models/ship_to.rb', line 143 def building_number @building_number end |
#company ⇒ String
Name of the customer’s company.
155 156 157 |
# File 'lib/cyber_source_merged_spec/models/ship_to.rb', line 155 def company @company end |
#country ⇒ String
Country of the shipping address. Use the two-character [ISO Standard Country Codes.](http://apps.cybersource.com/library/documentation/sbc/quickref/cou ntries_alpha_list.pdf) 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.
133 134 135 |
# File 'lib/cyber_source_merged_spec/models/ship_to.rb', line 133 def country @country end |
#county ⇒ String
U.S. county if available.
119 120 121 |
# File 'lib/cyber_source_merged_spec/models/ship_to.rb', line 119 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
170 171 172 |
# File 'lib/cyber_source_merged_spec/models/ship_to.rb', line 170 def destination_code @destination_code end |
#destination_types ⇒ String
Shipping destination of item. Example: Commercial, Residential, Store
159 160 161 |
# File 'lib/cyber_source_merged_spec/models/ship_to.rb', line 159 def destination_types @destination_types end |
#district ⇒ String
Neighborhood, community, or region within a city or municipality.
137 138 139 |
# File 'lib/cyber_source_merged_spec/models/ship_to.rb', line 137 def district @district end |
#email ⇒ String
Email of the recipient.
151 152 153 |
# File 'lib/cyber_source_merged_spec/models/ship_to.rb', line 151 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/cyber_source_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/cyber_source_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/cyber_source_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.).
183 184 185 |
# File 'lib/cyber_source_merged_spec/models/ship_to.rb', line 183 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/cyber_source_merged_spec/models/ship_to.rb', line 32 def middle_name @middle_name end |
#phone_number ⇒ String
Phone number associated with the shipping address.
147 148 149 |
# File 'lib/cyber_source_merged_spec/models/ship_to.rb', line 147 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.
115 116 117 |
# File 'lib/cyber_source_merged_spec/models/ship_to.rb', line 115 def postal_code @postal_code end |
#title ⇒ String
The title of the person receiving the product.
14 15 16 |
# File 'lib/cyber_source_merged_spec/models/ship_to.rb', line 14 def title @title end |
Class Method Details
.from_element(root) ⇒ Object
332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 |
# File 'lib/cyber_source_merged_spec/models/ship_to.rb', line 332 def self.from_element(root) title = XmlUtilities.from_element(root, 'title', String) first_name = XmlUtilities.from_element(root, 'firstName', String) middle_name = XmlUtilities.from_element(root, 'middleName', String) last_name = XmlUtilities.from_element(root, 'lastName', String) address1 = XmlUtilities.from_element(root, 'address1', String) address2 = XmlUtilities.from_element(root, 'address2', String) locality = XmlUtilities.from_element(root, 'locality', String) administrative_area = XmlUtilities.from_element(root, 'administrativeArea', String) postal_code = XmlUtilities.from_element(root, 'postalCode', String) county = XmlUtilities.from_element(root, 'county', String) country = XmlUtilities.from_element(root, 'country', String) district = XmlUtilities.from_element(root, 'district', String) building_number = XmlUtilities.from_element(root, 'buildingNumber', String) phone_number = XmlUtilities.from_element(root, 'phoneNumber', String) email = XmlUtilities.from_element(root, 'email', String) company = XmlUtilities.from_element(root, 'company', String) destination_types = XmlUtilities.from_element(root, 'destinationTypes', String) destination_code = XmlUtilities.from_element(root, 'destinationCode', Integer) method = XmlUtilities.from_element(root, 'method', String) 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 |
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 327 328 329 330 |
# File 'lib/cyber_source_merged_spec/models/ship_to.rb', line 274 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.
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 |
# File 'lib/cyber_source_merged_spec/models/ship_to.rb', line 186 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
236 237 238 |
# File 'lib/cyber_source_merged_spec/models/ship_to.rb', line 236 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 |
# File 'lib/cyber_source_merged_spec/models/ship_to.rb', line 211 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.
426 427 428 429 430 431 432 433 434 435 436 437 |
# File 'lib/cyber_source_merged_spec/models/ship_to.rb', line 426 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.
413 414 415 416 417 418 419 420 421 422 423 |
# File 'lib/cyber_source_merged_spec/models/ship_to.rb', line 413 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 |
#to_xml_element(doc, root_name) ⇒ Object
380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 |
# File 'lib/cyber_source_merged_spec/models/ship_to.rb', line 380 def to_xml_element(doc, root_name) root = doc.create_element(root_name) XmlUtilities.add_as_subelement(doc, root, 'title', title) XmlUtilities.add_as_subelement(doc, root, 'firstName', first_name) XmlUtilities.add_as_subelement(doc, root, 'middleName', middle_name) XmlUtilities.add_as_subelement(doc, root, 'lastName', last_name) XmlUtilities.add_as_subelement(doc, root, 'address1', address1) XmlUtilities.add_as_subelement(doc, root, 'address2', address2) XmlUtilities.add_as_subelement(doc, root, 'locality', locality) XmlUtilities.add_as_subelement(doc, root, 'administrativeArea', administrative_area) XmlUtilities.add_as_subelement(doc, root, 'postalCode', postal_code) XmlUtilities.add_as_subelement(doc, root, 'county', county) XmlUtilities.add_as_subelement(doc, root, 'country', country) XmlUtilities.add_as_subelement(doc, root, 'district', district) XmlUtilities.add_as_subelement(doc, root, 'buildingNumber', building_number) XmlUtilities.add_as_subelement(doc, root, 'phoneNumber', phone_number) XmlUtilities.add_as_subelement(doc, root, 'email', email) XmlUtilities.add_as_subelement(doc, root, 'company', company) XmlUtilities.add_as_subelement(doc, root, 'destinationTypes', destination_types) XmlUtilities.add_as_subelement(doc, root, 'destinationCode', destination_code) XmlUtilities.add_as_subelement(doc, root, 'method', method) XmlUtilities.add_as_subelement(doc, root, 'additional_properties', additional_properties) root end |