Class: VisaAcceptanceMergedSpec::ShipTo2
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- VisaAcceptanceMergedSpec::ShipTo2
- Defined in:
- lib/visa_acceptance_merged_spec/models/ship_to2.rb
Overview
ShipTo2 Model.
Instance Attribute Summary collapse
-
#administrative_area ⇒ String
State or province of the shipping address.
-
#country ⇒ String
Country of the shipping address.
-
#county ⇒ String
U.S.
-
#email ⇒ String
Email of the recipient.
-
#postal_code ⇒ String
Postal code for the shipping address.
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(administrative_area: SKIP, country: SKIP, postal_code: SKIP, email: SKIP, county: SKIP, additional_properties: nil) ⇒ ShipTo2
constructor
A new instance of ShipTo2.
-
#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(administrative_area: SKIP, country: SKIP, postal_code: SKIP, email: SKIP, county: SKIP, additional_properties: nil) ⇒ ShipTo2
Returns a new instance of ShipTo2.
98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/visa_acceptance_merged_spec/models/ship_to2.rb', line 98 def initialize(administrative_area: SKIP, country: SKIP, postal_code: SKIP, email: SKIP, county: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @administrative_area = administrative_area unless administrative_area == SKIP @country = country unless country == SKIP @postal_code = postal_code unless postal_code == SKIP @email = email unless email == SKIP @county = county unless county == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#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.
23 24 25 |
# File 'lib/visa_acceptance_merged_spec/models/ship_to2.rb', line 23 def administrative_area @administrative_area 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.
35 36 37 |
# File 'lib/visa_acceptance_merged_spec/models/ship_to2.rb', line 35 def country @country end |
#county ⇒ String
U.S. county if available.
69 70 71 |
# File 'lib/visa_acceptance_merged_spec/models/ship_to2.rb', line 69 def county @county end |
#email ⇒ String
Email of the recipient.
65 66 67 |
# File 'lib/visa_acceptance_merged_spec/models/ship_to2.rb', line 65 def email @email 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.
61 62 63 |
# File 'lib/visa_acceptance_merged_spec/models/ship_to2.rb', line 61 def postal_code @postal_code end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
# File 'lib/visa_acceptance_merged_spec/models/ship_to2.rb', line 112 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. administrative_area = hash.key?('administrativeArea') ? hash['administrativeArea'] : SKIP country = hash.key?('country') ? hash['country'] : SKIP postal_code = hash.key?('postalCode') ? hash['postalCode'] : SKIP email = hash.key?('email') ? hash['email'] : 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. ShipTo2.new(administrative_area: administrative_area, country: country, postal_code: postal_code, email: email, county: county, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
72 73 74 75 76 77 78 79 80 |
# File 'lib/visa_acceptance_merged_spec/models/ship_to2.rb', line 72 def self.names @_hash = {} if @_hash.nil? @_hash['administrative_area'] = 'administrativeArea' @_hash['country'] = 'country' @_hash['postal_code'] = 'postalCode' @_hash['email'] = 'email' @_hash['county'] = 'county' @_hash end |
.nullables ⇒ Object
An array for nullable fields
94 95 96 |
# File 'lib/visa_acceptance_merged_spec/models/ship_to2.rb', line 94 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
83 84 85 86 87 88 89 90 91 |
# File 'lib/visa_acceptance_merged_spec/models/ship_to2.rb', line 83 def self.optionals %w[ administrative_area country postal_code email county ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
148 149 150 151 152 153 |
# File 'lib/visa_acceptance_merged_spec/models/ship_to2.rb', line 148 def inspect class_name = self.class.name.split('::').last "<#{class_name} administrative_area: #{@administrative_area.inspect}, country:"\ " #{@country.inspect}, postal_code: #{@postal_code.inspect}, email: #{@email.inspect},"\ " county: #{@county.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
140 141 142 143 144 145 |
# File 'lib/visa_acceptance_merged_spec/models/ship_to2.rb', line 140 def to_s class_name = self.class.name.split('::').last "<#{class_name} administrative_area: #{@administrative_area}, country: #{@country},"\ " postal_code: #{@postal_code}, email: #{@email}, county: #{@county}, additional_properties:"\ " #{@additional_properties}>" end |