Class: CyberSourceMergedSpec::ShipTo9
- Defined in:
- lib/cyber_source_merged_spec/models/ship_to9.rb
Overview
ShipTo9 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.
-
#district ⇒ String
Neighborhood, community, or region within a city or municipality.
-
#email ⇒ String
Customer's primary email address, including the full domain name.
-
#first_name ⇒ String
First name of the recipient.
-
#immutable ⇒ String
Indicates whether customers are permitted to edit the shipping address in their PayPal account.
-
#last_name ⇒ String
Last name of the recipient.
-
#locality ⇒ String
City of the shipping address.
-
#middle_name ⇒ String
Middle name of the recipient.
-
#not_applicable ⇒ String
Indicates whether the shipping address is displayed to the customer in their PayPal account.
-
#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(email: SKIP, title: SKIP, first_name: SKIP, middle_name: SKIP, last_name: SKIP, company: SKIP, address1: SKIP, address2: SKIP, district: SKIP, locality: SKIP, administrative_area: SKIP, postal_code: SKIP, country: SKIP, building_number: SKIP, phone_number: SKIP, immutable: SKIP, not_applicable: SKIP, county: SKIP, additional_properties: nil) ⇒ ShipTo9
constructor
A new instance of ShipTo9.
-
#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(email: SKIP, title: SKIP, first_name: SKIP, middle_name: SKIP, last_name: SKIP, company: SKIP, address1: SKIP, address2: SKIP, district: SKIP, locality: SKIP, administrative_area: SKIP, postal_code: SKIP, country: SKIP, building_number: SKIP, phone_number: SKIP, immutable: SKIP, not_applicable: SKIP, county: SKIP, additional_properties: nil) ⇒ ShipTo9
Returns a new instance of ShipTo9.
232 233 234 235 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 |
# File 'lib/cyber_source_merged_spec/models/ship_to9.rb', line 232 def initialize(email: SKIP, title: SKIP, first_name: SKIP, middle_name: SKIP, last_name: SKIP, company: SKIP, address1: SKIP, address2: SKIP, district: SKIP, locality: SKIP, administrative_area: SKIP, postal_code: SKIP, country: SKIP, building_number: SKIP, phone_number: SKIP, immutable: SKIP, not_applicable: SKIP, county: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @email = email unless email == SKIP @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 @company = company unless company == SKIP @address1 = address1 unless address1 == SKIP @address2 = address2 unless address2 == SKIP @district = district unless district == SKIP @locality = locality unless locality == SKIP @administrative_area = administrative_area unless administrative_area == SKIP @postal_code = postal_code unless postal_code == SKIP @country = country unless country == SKIP @building_number = building_number unless building_number == SKIP @phone_number = phone_number unless phone_number == SKIP @immutable = immutable unless immutable == SKIP @not_applicable = not_applicable unless not_applicable == SKIP @county = county unless county == 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.
60 61 62 |
# File 'lib/cyber_source_merged_spec/models/ship_to9.rb', line 60 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.
70 71 72 |
# File 'lib/cyber_source_merged_spec/models/ship_to9.rb', line 70 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.
101 102 103 |
# File 'lib/cyber_source_merged_spec/models/ship_to9.rb', line 101 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
147 148 149 |
# File 'lib/cyber_source_merged_spec/models/ship_to9.rb', line 147 def building_number @building_number end |
#company ⇒ String
Name of the customer’s company.
49 50 51 |
# File 'lib/cyber_source_merged_spec/models/ship_to9.rb', line 49 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.
141 142 143 |
# File 'lib/cyber_source_merged_spec/models/ship_to9.rb', line 141 def country @country end |
#county ⇒ String
U.S. county if available.
177 178 179 |
# File 'lib/cyber_source_merged_spec/models/ship_to9.rb', line 177 def county @county end |
#district ⇒ String
Neighborhood, community, or region within a city or municipality.
74 75 76 |
# File 'lib/cyber_source_merged_spec/models/ship_to9.rb', line 74 def district @district end |
#email ⇒ String
Customer's primary email address, including the full domain name.
14 15 16 |
# File 'lib/cyber_source_merged_spec/models/ship_to9.rb', line 14 def email @email end |
#first_name ⇒ String
First name of the recipient.
Litle
Maximum length: 25
All other processors
Maximum length: 60 Optional field.
27 28 29 |
# File 'lib/cyber_source_merged_spec/models/ship_to9.rb', line 27 def first_name @first_name end |
#immutable ⇒ String
Indicates whether customers are permitted to edit the shipping address in their PayPal account. Possible values:
- true: Customer cannot edit the shipping address.
- false (default): Customer can edit the shipping address.
161 162 163 |
# File 'lib/cyber_source_merged_spec/models/ship_to9.rb', line 161 def immutable @immutable end |
#last_name ⇒ String
Last name of the recipient.
Litle
Maximum length: 25
All other processors
Maximum length: 60 Optional field.
45 46 47 |
# File 'lib/cyber_source_merged_spec/models/ship_to9.rb', line 45 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.
86 87 88 |
# File 'lib/cyber_source_merged_spec/models/ship_to9.rb', line 86 def locality @locality end |
#middle_name ⇒ String
Middle name of the recipient.
Litle
Maximum length: 25
All other processors
Maximum length: 60 Optional field.
36 37 38 |
# File 'lib/cyber_source_merged_spec/models/ship_to9.rb', line 36 def middle_name @middle_name end |
#not_applicable ⇒ String
Indicates whether the shipping address is displayed to the customer in their PayPal account. Possible values:
- true: Shipping address is not displayed.
- false (default): Shipping address is displayed. For example, for digital downloads and services in which a shipping address is not required, set the value to true.
173 174 175 |
# File 'lib/cyber_source_merged_spec/models/ship_to9.rb', line 173 def not_applicable @not_applicable end |
#phone_number ⇒ String
Phone number associated with the shipping address.
151 152 153 |
# File 'lib/cyber_source_merged_spec/models/ship_to9.rb', line 151 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.
127 128 129 |
# File 'lib/cyber_source_merged_spec/models/ship_to9.rb', line 127 def postal_code @postal_code end |
#title ⇒ String
The title of the person receiving the product.
18 19 20 |
# File 'lib/cyber_source_merged_spec/models/ship_to9.rb', line 18 def title @title end |
Class Method Details
.from_element(root) ⇒ Object
318 319 320 321 322 323 324 325 326 327 328 329 330 331 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 |
# File 'lib/cyber_source_merged_spec/models/ship_to9.rb', line 318 def self.from_element(root) email = XmlUtilities.from_element(root, 'email', String) 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) company = XmlUtilities.from_element(root, 'company', String) address1 = XmlUtilities.from_element(root, 'address1', String) address2 = XmlUtilities.from_element(root, 'address2', String) district = XmlUtilities.from_element(root, 'district', String) locality = XmlUtilities.from_element(root, 'locality', String) administrative_area = XmlUtilities.from_element(root, 'administrativeArea', String) postal_code = XmlUtilities.from_element(root, 'postalCode', String) country = XmlUtilities.from_element(root, 'country', String) building_number = XmlUtilities.from_element(root, 'buildingNumber', String) phone_number = XmlUtilities.from_element(root, 'phoneNumber', String) immutable = XmlUtilities.from_element(root, 'immutable', String) not_applicable = XmlUtilities.from_element(root, 'notApplicable', String) county = XmlUtilities.from_element(root, 'county', String) new(email: email, title: title, first_name: first_name, middle_name: middle_name, last_name: last_name, company: company, address1: address1, address2: address2, district: district, locality: locality, administrative_area: administrative_area, postal_code: postal_code, country: country, building_number: building_number, phone_number: phone_number, immutable: immutable, not_applicable: not_applicable, county: county, additional_properties: additional_properties) end |
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
264 265 266 267 268 269 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 |
# File 'lib/cyber_source_merged_spec/models/ship_to9.rb', line 264 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. email = hash.key?('email') ? hash['email'] : SKIP 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 company = hash.key?('company') ? hash['company'] : SKIP address1 = hash.key?('address1') ? hash['address1'] : SKIP address2 = hash.key?('address2') ? hash['address2'] : SKIP district = hash.key?('district') ? hash['district'] : SKIP locality = hash.key?('locality') ? hash['locality'] : SKIP administrative_area = hash.key?('administrativeArea') ? hash['administrativeArea'] : SKIP postal_code = hash.key?('postalCode') ? hash['postalCode'] : SKIP country = hash.key?('country') ? hash['country'] : SKIP building_number = hash.key?('buildingNumber') ? hash['buildingNumber'] : SKIP phone_number = hash.key?('phoneNumber') ? hash['phoneNumber'] : SKIP immutable = hash.key?('immutable') ? hash['immutable'] : SKIP not_applicable = hash.key?('notApplicable') ? hash['notApplicable'] : SKIP county = hash.key?('county') ? hash['county'] : 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. ShipTo9.new(email: email, title: title, first_name: first_name, middle_name: middle_name, last_name: last_name, company: company, address1: address1, address2: address2, district: district, locality: locality, administrative_area: administrative_area, postal_code: postal_code, country: country, building_number: building_number, phone_number: phone_number, immutable: immutable, not_applicable: not_applicable, county: county, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 |
# File 'lib/cyber_source_merged_spec/models/ship_to9.rb', line 180 def self.names @_hash = {} if @_hash.nil? @_hash['email'] = 'email' @_hash['title'] = 'title' @_hash['first_name'] = 'firstName' @_hash['middle_name'] = 'middleName' @_hash['last_name'] = 'lastName' @_hash['company'] = 'company' @_hash['address1'] = 'address1' @_hash['address2'] = 'address2' @_hash['district'] = 'district' @_hash['locality'] = 'locality' @_hash['administrative_area'] = 'administrativeArea' @_hash['postal_code'] = 'postalCode' @_hash['country'] = 'country' @_hash['building_number'] = 'buildingNumber' @_hash['phone_number'] = 'phoneNumber' @_hash['immutable'] = 'immutable' @_hash['not_applicable'] = 'notApplicable' @_hash['county'] = 'county' @_hash end |
.nullables ⇒ Object
An array for nullable fields
228 229 230 |
# File 'lib/cyber_source_merged_spec/models/ship_to9.rb', line 228 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
# File 'lib/cyber_source_merged_spec/models/ship_to9.rb', line 204 def self.optionals %w[ email title first_name middle_name last_name company address1 address2 district locality administrative_area postal_code country building_number phone_number immutable not_applicable county ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
404 405 406 407 408 409 410 411 412 413 414 415 |
# File 'lib/cyber_source_merged_spec/models/ship_to9.rb', line 404 def inspect class_name = self.class.name.split('::').last "<#{class_name} email: #{@email.inspect}, title: #{@title.inspect}, first_name:"\ " #{@first_name.inspect}, middle_name: #{@middle_name.inspect}, last_name:"\ " #{@last_name.inspect}, company: #{@company.inspect}, address1: #{@address1.inspect},"\ " address2: #{@address2.inspect}, district: #{@district.inspect}, locality:"\ " #{@locality.inspect}, administrative_area: #{@administrative_area.inspect}, postal_code:"\ " #{@postal_code.inspect}, country: #{@country.inspect}, building_number:"\ " #{@building_number.inspect}, phone_number: #{@phone_number.inspect}, immutable:"\ " #{@immutable.inspect}, not_applicable: #{@not_applicable.inspect}, county:"\ " #{@county.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
392 393 394 395 396 397 398 399 400 401 |
# File 'lib/cyber_source_merged_spec/models/ship_to9.rb', line 392 def to_s class_name = self.class.name.split('::').last "<#{class_name} email: #{@email}, title: #{@title}, first_name: #{@first_name},"\ " middle_name: #{@middle_name}, last_name: #{@last_name}, company: #{@company}, address1:"\ " #{@address1}, address2: #{@address2}, district: #{@district}, locality: #{@locality},"\ " administrative_area: #{@administrative_area}, postal_code: #{@postal_code}, country:"\ " #{@country}, building_number: #{@building_number}, phone_number: #{@phone_number},"\ " immutable: #{@immutable}, not_applicable: #{@not_applicable}, county: #{@county},"\ " additional_properties: #{@additional_properties}>" end |
#to_xml_element(doc, root_name) ⇒ Object
362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 |
# File 'lib/cyber_source_merged_spec/models/ship_to9.rb', line 362 def to_xml_element(doc, root_name) root = doc.create_element(root_name) XmlUtilities.add_as_subelement(doc, root, 'email', email) 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, 'company', company) XmlUtilities.add_as_subelement(doc, root, 'address1', address1) XmlUtilities.add_as_subelement(doc, root, 'address2', address2) XmlUtilities.add_as_subelement(doc, root, 'district', district) 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, 'country', country) XmlUtilities.add_as_subelement(doc, root, 'buildingNumber', building_number) XmlUtilities.add_as_subelement(doc, root, 'phoneNumber', phone_number) XmlUtilities.add_as_subelement(doc, root, 'immutable', immutable) XmlUtilities.add_as_subelement(doc, root, 'notApplicable', not_applicable) XmlUtilities.add_as_subelement(doc, root, 'county', county) XmlUtilities.add_as_subelement(doc, root, 'additional_properties', additional_properties) root end |