Class: UspsApi::InternationalLabelsDomesticLabelSenderAddress
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- UspsApi::InternationalLabelsDomesticLabelSenderAddress
- Defined in:
- lib/usps_api/models/international_labels_domestic_label_sender_address.rb
Overview
Uses for: The address of the business sending the package. Can differ from the ‘fromAddress` in the case the business is using a third-party logistics provider or mailing from off-site locations. Note: - The First and Last Name or Firm Name are always required.
Instance Attribute Summary collapse
-
#city ⇒ String
This is the city name of the address.
-
#city_abbreviation ⇒ String
This is the abbreviation of city name for the address.
-
#email ⇒ String
Email address used for redirect notification via email.
-
#firm ⇒ String
Firm corresponding to the address.
-
#first_name ⇒ String
First Name corresponding to the address.
-
#ignore_bad_address ⇒ TrueClass | FalseClass
Allows Non-Validated Origin Street Address.
-
#last_name ⇒ String
Last Name corresponding to the address.
-
#phone ⇒ String
The phone number, including the country extension and area code or the local national format, with no punctuation.
-
#platform_user_id ⇒ String
This is a third-party unique identifier for the sender used for correlation purposes.
-
#secondary_address ⇒ String
The secondary unit designator, such as apartment(APT) or suite(STE) number, defining the exact location of the address within a building.
-
#state ⇒ String
This is the two-character state code of the address.
-
#street_address ⇒ String
The number of a building along with the name of the road or street on which it is located.
-
#street_address_abbreviation ⇒ String
This is the abbreviation of street address line for the address.
-
#urbanization ⇒ String
An area, sector, or residential development within a geographic area (typically used for addresses in Puerto Rico).
-
#zip_code ⇒ String
This is the 5-digit ZIP code.
-
#zip_plus4 ⇒ String
This is the 4-digit component of the ZIP+4 code.
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.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(street_address:, city:, state:, zip_code:, street_address_abbreviation: SKIP, secondary_address: SKIP, city_abbreviation: SKIP, zip_plus4: SKIP, urbanization: SKIP, first_name: SKIP, last_name: SKIP, firm: SKIP, phone: SKIP, email: SKIP, ignore_bad_address: SKIP, platform_user_id: SKIP, additional_properties: nil) ⇒ InternationalLabelsDomesticLabelSenderAddress
constructor
A new instance of InternationalLabelsDomesticLabelSenderAddress.
-
#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(street_address:, city:, state:, zip_code:, street_address_abbreviation: SKIP, secondary_address: SKIP, city_abbreviation: SKIP, zip_plus4: SKIP, urbanization: SKIP, first_name: SKIP, last_name: SKIP, firm: SKIP, phone: SKIP, email: SKIP, ignore_bad_address: SKIP, platform_user_id: SKIP, additional_properties: nil) ⇒ InternationalLabelsDomesticLabelSenderAddress
Returns a new instance of InternationalLabelsDomesticLabelSenderAddress.
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 |
# File 'lib/usps_api/models/international_labels_domestic_label_sender_address.rb', line 142 def initialize(street_address:, city:, state:, zip_code:, street_address_abbreviation: SKIP, secondary_address: SKIP, city_abbreviation: SKIP, zip_plus4: SKIP, urbanization: SKIP, first_name: SKIP, last_name: SKIP, firm: SKIP, phone: SKIP, email: SKIP, ignore_bad_address: SKIP, platform_user_id: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @street_address = street_address unless street_address_abbreviation == SKIP @street_address_abbreviation = street_address_abbreviation end @secondary_address = secondary_address unless secondary_address == SKIP @city_abbreviation = city_abbreviation unless city_abbreviation == SKIP @city = city @state = state @zip_code = zip_code @zip_plus4 = zip_plus4 unless zip_plus4 == SKIP @urbanization = urbanization unless urbanization == SKIP @first_name = first_name unless first_name == SKIP @last_name = last_name unless last_name == SKIP @firm = firm unless firm == SKIP @phone = phone unless phone == SKIP @email = email unless email == SKIP @ignore_bad_address = ignore_bad_address unless ignore_bad_address == SKIP @platform_user_id = platform_user_id unless platform_user_id == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#city ⇒ String
This is the city name of the address.
37 38 39 |
# File 'lib/usps_api/models/international_labels_domestic_label_sender_address.rb', line 37 def city @city end |
#city_abbreviation ⇒ String
This is the abbreviation of city name for the address.
33 34 35 |
# File 'lib/usps_api/models/international_labels_domestic_label_sender_address.rb', line 33 def city_abbreviation @city_abbreviation end |
#email ⇒ String
Email address used for redirect notification via email.
77 78 79 |
# File 'lib/usps_api/models/international_labels_domestic_label_sender_address.rb', line 77 def email @email end |
#firm ⇒ String
Firm corresponding to the address.
68 69 70 |
# File 'lib/usps_api/models/international_labels_domestic_label_sender_address.rb', line 68 def firm @firm end |
#first_name ⇒ String
First Name corresponding to the address.
60 61 62 |
# File 'lib/usps_api/models/international_labels_domestic_label_sender_address.rb', line 60 def first_name @first_name end |
#ignore_bad_address ⇒ TrueClass | FalseClass
Allows Non-Validated Origin Street Address. Enter ‘true` to bypass street address validation failures/errors or `false` if only validated addresses should be allowed. Note: Integrators are recommended to always use `false` to ensure no delivery issues. In the event USPS cannot validate the street address, this tag will “bypass” address validation error when “true” is indicated to allow label creation which could impact delivery.
88 89 90 |
# File 'lib/usps_api/models/international_labels_domestic_label_sender_address.rb', line 88 def ignore_bad_address @ignore_bad_address end |
#last_name ⇒ String
Last Name corresponding to the address.
64 65 66 |
# File 'lib/usps_api/models/international_labels_domestic_label_sender_address.rb', line 64 def last_name @last_name end |
#phone ⇒ String
The phone number, including the country extension and area code or the local national format, with no punctuation.
73 74 75 |
# File 'lib/usps_api/models/international_labels_domestic_label_sender_address.rb', line 73 def phone @phone end |
#platform_user_id ⇒ String
This is a third-party unique identifier for the sender used for correlation purposes.
93 94 95 |
# File 'lib/usps_api/models/international_labels_domestic_label_sender_address.rb', line 93 def platform_user_id @platform_user_id end |
#secondary_address ⇒ String
The secondary unit designator, such as apartment(APT) or suite(STE) number, defining the exact location of the address within a building. For more information please see [Postal Explorer](pe.usps.com/text/pub28/28c2_003.htm).
29 30 31 |
# File 'lib/usps_api/models/international_labels_domestic_label_sender_address.rb', line 29 def secondary_address @secondary_address end |
#state ⇒ String
This is the two-character state code of the address.
41 42 43 |
# File 'lib/usps_api/models/international_labels_domestic_label_sender_address.rb', line 41 def state @state end |
#street_address ⇒ String
The number of a building along with the name of the road or street on which it is located.
18 19 20 |
# File 'lib/usps_api/models/international_labels_domestic_label_sender_address.rb', line 18 def street_address @street_address end |
#street_address_abbreviation ⇒ String
This is the abbreviation of street address line for the address.
22 23 24 |
# File 'lib/usps_api/models/international_labels_domestic_label_sender_address.rb', line 22 def street_address_abbreviation @street_address_abbreviation end |
#urbanization ⇒ String
An area, sector, or residential development within a geographic area (typically used for addresses in Puerto Rico).
56 57 58 |
# File 'lib/usps_api/models/international_labels_domestic_label_sender_address.rb', line 56 def urbanization @urbanization end |
#zip_code ⇒ String
This is the 5-digit ZIP code.
45 46 47 |
# File 'lib/usps_api/models/international_labels_domestic_label_sender_address.rb', line 45 def zip_code @zip_code end |
#zip_plus4 ⇒ String
This is the 4-digit component of the ZIP+4 code. Using the correct Zip+4 reduces the number of times your mail is handled and can decrease the chance of a misdelivery or error.
51 52 53 |
# File 'lib/usps_api/models/international_labels_domestic_label_sender_address.rb', line 51 def zip_plus4 @zip_plus4 end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 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 |
# File 'lib/usps_api/models/international_labels_domestic_label_sender_address.rb', line 174 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. street_address = hash.key?('streetAddress') ? hash['streetAddress'] : nil city = hash.key?('city') ? hash['city'] : nil state = hash.key?('state') ? hash['state'] : nil zip_code = hash.key?('ZIPCode') ? hash['ZIPCode'] : nil street_address_abbreviation = hash.key?('streetAddressAbbreviation') ? hash['streetAddressAbbreviation'] : SKIP secondary_address = hash.key?('secondaryAddress') ? hash['secondaryAddress'] : SKIP city_abbreviation = hash.key?('cityAbbreviation') ? hash['cityAbbreviation'] : SKIP zip_plus4 = hash.key?('ZIPPlus4') ? hash['ZIPPlus4'] : SKIP urbanization = hash.key?('urbanization') ? hash['urbanization'] : SKIP first_name = hash.key?('firstName') ? hash['firstName'] : SKIP last_name = hash.key?('lastName') ? hash['lastName'] : SKIP firm = hash.key?('firm') ? hash['firm'] : SKIP phone = hash.key?('phone') ? hash['phone'] : SKIP email = hash.key?('email') ? hash['email'] : SKIP ignore_bad_address = hash.key?('ignoreBadAddress') ? hash['ignoreBadAddress'] : SKIP platform_user_id = hash.key?('platformUserId') ? hash['platformUserId'] : 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. InternationalLabelsDomesticLabelSenderAddress.new(street_address: street_address, city: city, state: state, zip_code: zip_code, street_address_abbreviation: street_address_abbreviation, secondary_address: secondary_address, city_abbreviation: city_abbreviation, zip_plus4: zip_plus4, urbanization: urbanization, first_name: first_name, last_name: last_name, firm: firm, phone: phone, email: email, ignore_bad_address: ignore_bad_address, platform_user_id: platform_user_id, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/usps_api/models/international_labels_domestic_label_sender_address.rb', line 96 def self.names @_hash = {} if @_hash.nil? @_hash['street_address'] = 'streetAddress' @_hash['street_address_abbreviation'] = 'streetAddressAbbreviation' @_hash['secondary_address'] = 'secondaryAddress' @_hash['city_abbreviation'] = 'cityAbbreviation' @_hash['city'] = 'city' @_hash['state'] = 'state' @_hash['zip_code'] = 'ZIPCode' @_hash['zip_plus4'] = 'ZIPPlus4' @_hash['urbanization'] = 'urbanization' @_hash['first_name'] = 'firstName' @_hash['last_name'] = 'lastName' @_hash['firm'] = 'firm' @_hash['phone'] = 'phone' @_hash['email'] = 'email' @_hash['ignore_bad_address'] = 'ignoreBadAddress' @_hash['platform_user_id'] = 'platformUserId' @_hash end |
.nullables ⇒ Object
An array for nullable fields
136 137 138 139 140 |
# File 'lib/usps_api/models/international_labels_domestic_label_sender_address.rb', line 136 def self.nullables %w[ zip_plus4 ] end |
.optionals ⇒ Object
An array for optional fields
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
# File 'lib/usps_api/models/international_labels_domestic_label_sender_address.rb', line 118 def self.optionals %w[ street_address_abbreviation secondary_address city_abbreviation zip_plus4 urbanization first_name last_name firm phone email ignore_bad_address platform_user_id ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 |
# File 'lib/usps_api/models/international_labels_domestic_label_sender_address.rb', line 229 def self.validate(value) if value.instance_of? self return ( APIHelper.valid_type?(value.street_address, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.city, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.state, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.zip_code, ->(val) { val.instance_of? String }) ) end return false unless value.instance_of? Hash ( APIHelper.valid_type?(value['streetAddress'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['city'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['state'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['ZIPCode'], ->(val) { val.instance_of? String }) ) end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
270 271 272 273 274 275 276 277 278 279 280 |
# File 'lib/usps_api/models/international_labels_domestic_label_sender_address.rb', line 270 def inspect class_name = self.class.name.split('::').last "<#{class_name} street_address: #{@street_address.inspect}, street_address_abbreviation:"\ " #{@street_address_abbreviation.inspect}, secondary_address: #{@secondary_address.inspect},"\ " city_abbreviation: #{@city_abbreviation.inspect}, city: #{@city.inspect}, state:"\ " #{@state.inspect}, zip_code: #{@zip_code.inspect}, zip_plus4: #{@zip_plus4.inspect},"\ " urbanization: #{@urbanization.inspect}, first_name: #{@first_name.inspect}, last_name:"\ " #{@last_name.inspect}, firm: #{@firm.inspect}, phone: #{@phone.inspect}, email:"\ " #{@email.inspect}, ignore_bad_address: #{@ignore_bad_address.inspect}, platform_user_id:"\ " #{@platform_user_id.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
258 259 260 261 262 263 264 265 266 267 |
# File 'lib/usps_api/models/international_labels_domestic_label_sender_address.rb', line 258 def to_s class_name = self.class.name.split('::').last "<#{class_name} street_address: #{@street_address}, street_address_abbreviation:"\ " #{@street_address_abbreviation}, secondary_address: #{@secondary_address},"\ " city_abbreviation: #{@city_abbreviation}, city: #{@city}, state: #{@state}, zip_code:"\ " #{@zip_code}, zip_plus4: #{@zip_plus4}, urbanization: #{@urbanization}, first_name:"\ " #{@first_name}, last_name: #{@last_name}, firm: #{@firm}, phone: #{@phone}, email:"\ " #{@email}, ignore_bad_address: #{@ignore_bad_address}, platform_user_id:"\ " #{@platform_user_id}, additional_properties: #{@additional_properties}>" end |