Class: UspsApi::ProofOfDeliveryRequest
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- UspsApi::ProofOfDeliveryRequest
- Defined in:
- lib/usps_api/models/proof_of_delivery_request.rb
Overview
Proof of Delivery is a letter that includes the recipient’s name and a copy of their signature.
Instance Attribute Summary collapse
-
#approximate_intake_date ⇒ DateTime
Approximate Intake Date (mp-date) value, unique to each TrackID, located in Tracking Information Fields API response data.
-
#city ⇒ String
This is the city name of the address.
-
#crid ⇒ String
Unique 10-byte numeric value that’s associated to each user.
-
#email ⇒ Array[String]
Upto 3 Email addresses may be provided to receive the proof of delivery documentation.
-
#fax_number ⇒ String
Recipient fax number.
-
#first_name ⇒ String
Recipient first name.
-
#last_name ⇒ String
Recipient last name.
-
#mail_piece_intake_date ⇒ String
Mail piece intake date (mp-date) value, unique to each TrackID, located in Tracking Information Fields API response data.
-
#request_type ⇒ String
readonly
Enter a notification request type.
-
#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 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.
-
#table_code ⇒ String
Table code value located in Tracking Information Fields API response data.
-
#unique_mail_piece_id ⇒ String
Unique mail piece ID (mp-suffix) value, unique to each TrackID, located in Tracking Information Fields API response data.
-
#unique_tracking_id ⇒ String
Unique mail piece ID (mp-suffix) value, unique to each TrackID, located in Tracking Information Fields API response data.
-
#zip_code ⇒ String
This is the 5-digit ZIP code.
-
#zip_plus4 ⇒ Object
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.
Instance Method Summary collapse
-
#initialize(unique_mail_piece_id:, mail_piece_intake_date:, table_code:, first_name:, last_name:, email:, unique_tracking_id: SKIP, approximate_intake_date: SKIP, fax_number: SKIP, street_address: SKIP, secondary_address: SKIP, city: SKIP, state: SKIP, zip_code: SKIP, zip_plus4: SKIP, crid: SKIP, additional_properties: nil) ⇒ ProofOfDeliveryRequest
constructor
A new instance of ProofOfDeliveryRequest.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_approximate_intake_date ⇒ Object
-
#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(unique_mail_piece_id:, mail_piece_intake_date:, table_code:, first_name:, last_name:, email:, unique_tracking_id: SKIP, approximate_intake_date: SKIP, fax_number: SKIP, street_address: SKIP, secondary_address: SKIP, city: SKIP, state: SKIP, zip_code: SKIP, zip_plus4: SKIP, crid: SKIP, additional_properties: nil) ⇒ ProofOfDeliveryRequest
Returns a new instance of ProofOfDeliveryRequest.
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 |
# File 'lib/usps_api/models/proof_of_delivery_request.rb', line 156 def initialize(unique_mail_piece_id:, mail_piece_intake_date:, table_code:, first_name:, last_name:, email:, unique_tracking_id: SKIP, approximate_intake_date: SKIP, fax_number: SKIP, street_address: SKIP, secondary_address: SKIP, city: SKIP, state: SKIP, zip_code: SKIP, zip_plus4: SKIP, crid: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @unique_tracking_id = unique_tracking_id unless unique_tracking_id == SKIP @unique_mail_piece_id = unique_mail_piece_id @approximate_intake_date = approximate_intake_date unless approximate_intake_date == SKIP @mail_piece_intake_date = mail_piece_intake_date @table_code = table_code @request_type = 'email' @first_name = first_name @last_name = last_name @email = email @fax_number = fax_number unless fax_number == SKIP @street_address = street_address unless street_address == SKIP @secondary_address = secondary_address unless secondary_address == SKIP @city = city unless city == SKIP @state = state unless state == SKIP @zip_code = zip_code unless zip_code == SKIP @zip_plus4 = zip_plus4 unless zip_plus4 == SKIP @crid = crid unless crid == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#approximate_intake_date ⇒ DateTime
Approximate Intake Date (mp-date) value, unique to each TrackID, located in Tracking Information Fields API response data. The ‘expand’ field in the original tracking request must be set to “DETAIL” in order to display this value.
33 34 35 |
# File 'lib/usps_api/models/proof_of_delivery_request.rb', line 33 def approximate_intake_date @approximate_intake_date end |
#city ⇒ String
This is the city name of the address.
90 91 92 |
# File 'lib/usps_api/models/proof_of_delivery_request.rb', line 90 def city @city end |
#crid ⇒ String
Unique 10-byte numeric value that’s associated to each user. A Customer Registration Identification number (CRID) is a USPS-generated numeric code that uniquely identifies a business at a location.
110 111 112 |
# File 'lib/usps_api/models/proof_of_delivery_request.rb', line 110 def crid @crid end |
#email ⇒ Array[String]
Upto 3 Email addresses may be provided to receive the proof of delivery documentation.
70 71 72 |
# File 'lib/usps_api/models/proof_of_delivery_request.rb', line 70 def email @email end |
#fax_number ⇒ String
Recipient fax number
74 75 76 |
# File 'lib/usps_api/models/proof_of_delivery_request.rb', line 74 def fax_number @fax_number end |
#first_name ⇒ String
Recipient first name.
61 62 63 |
# File 'lib/usps_api/models/proof_of_delivery_request.rb', line 61 def first_name @first_name end |
#last_name ⇒ String
Recipient last name.
65 66 67 |
# File 'lib/usps_api/models/proof_of_delivery_request.rb', line 65 def last_name @last_name end |
#mail_piece_intake_date ⇒ String
Mail piece intake date (mp-date) value, unique to each TrackID, located in Tracking Information Fields API response data. The ‘expand’ field in the original tracking request must be set to “DETAIL” in order to display this value. Accepted formats:
-
Date and time: ‘2024-04-04 14:03:12:000`
-
ISO 8601 date only (yyyy-mm-dd): ‘2024-04-04`
-
Compact numeric (mmddyyyy), month and day must include leading 0:
‘04042024`
-
Slash-delimited (mm/dd/yyyy), month and day must include leading 0:
‘04/04/2024`
47 48 49 |
# File 'lib/usps_api/models/proof_of_delivery_request.rb', line 47 def mail_piece_intake_date @mail_piece_intake_date end |
#request_type ⇒ String (readonly)
Enter a notification request type. Currently, email is the only request type available this time.
57 58 59 |
# File 'lib/usps_api/models/proof_of_delivery_request.rb', line 57 def request_type @request_type 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).
86 87 88 |
# File 'lib/usps_api/models/proof_of_delivery_request.rb', line 86 def secondary_address @secondary_address end |
#state ⇒ String
This is two-character state code of the address.
94 95 96 |
# File 'lib/usps_api/models/proof_of_delivery_request.rb', line 94 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.
79 80 81 |
# File 'lib/usps_api/models/proof_of_delivery_request.rb', line 79 def street_address @street_address end |
#table_code ⇒ String
Table code value located in Tracking Information Fields API response data. Unique to each TrackID.
52 53 54 |
# File 'lib/usps_api/models/proof_of_delivery_request.rb', line 52 def table_code @table_code end |
#unique_mail_piece_id ⇒ String
Unique mail piece ID (mp-suffix) value, unique to each TrackID, located in Tracking Information Fields API response data. The ‘expand’ field in the original tracking request must be set to “DETAIL” in order to display this value.
26 27 28 |
# File 'lib/usps_api/models/proof_of_delivery_request.rb', line 26 def unique_mail_piece_id @unique_mail_piece_id end |
#unique_tracking_id ⇒ String
Unique mail piece ID (mp-suffix) value, unique to each TrackID, located in Tracking Information Fields API response data. The ‘expand’ field in the original tracking request must be set to “DETAIL” in order to display this value.
19 20 21 |
# File 'lib/usps_api/models/proof_of_delivery_request.rb', line 19 def unique_tracking_id @unique_tracking_id end |
#zip_code ⇒ String
This is the 5-digit ZIP code.
98 99 100 |
# File 'lib/usps_api/models/proof_of_delivery_request.rb', line 98 def zip_code @zip_code end |
#zip_plus4 ⇒ Object
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.
104 105 106 |
# File 'lib/usps_api/models/proof_of_delivery_request.rb', line 104 def zip_plus4 @zip_plus4 end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 |
# File 'lib/usps_api/models/proof_of_delivery_request.rb', line 186 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. unique_mail_piece_id = hash.key?('uniqueMailPieceID') ? hash['uniqueMailPieceID'] : nil mail_piece_intake_date = hash.key?('mailPieceIntakeDate') ? hash['mailPieceIntakeDate'] : nil table_code = hash.key?('tableCode') ? hash['tableCode'] : nil first_name = hash.key?('firstName') ? hash['firstName'] : nil last_name = hash.key?('lastName') ? hash['lastName'] : nil email = hash.key?('email') ? hash['email'] : nil unique_tracking_id = hash.key?('uniqueTrackingID') ? hash['uniqueTrackingID'] : SKIP approximate_intake_date = if hash.key?('approximateIntakeDate') (DateTimeHelper.from_rfc3339(hash['approximateIntakeDate']) if hash['approximateIntakeDate']) else SKIP end fax_number = hash.key?('faxNumber') ? hash['faxNumber'] : SKIP street_address = hash.key?('streetAddress') ? hash['streetAddress'] : SKIP secondary_address = hash.key?('secondaryAddress') ? hash['secondaryAddress'] : SKIP city = hash.key?('city') ? hash['city'] : SKIP state = hash.key?('state') ? hash['state'] : SKIP zip_code = hash.key?('ZIPCode') ? hash['ZIPCode'] : SKIP zip_plus4 = hash.key?('ZIPPlus4') ? hash['ZIPPlus4'] : SKIP crid = hash.key?('CRID') ? hash['CRID'] : 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. ProofOfDeliveryRequest.new(unique_mail_piece_id: unique_mail_piece_id, mail_piece_intake_date: mail_piece_intake_date, table_code: table_code, first_name: first_name, last_name: last_name, email: email, unique_tracking_id: unique_tracking_id, approximate_intake_date: approximate_intake_date, fax_number: fax_number, street_address: street_address, secondary_address: secondary_address, city: city, state: state, zip_code: zip_code, zip_plus4: zip_plus4, crid: crid, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
# File 'lib/usps_api/models/proof_of_delivery_request.rb', line 113 def self.names @_hash = {} if @_hash.nil? @_hash['unique_tracking_id'] = 'uniqueTrackingID' @_hash['unique_mail_piece_id'] = 'uniqueMailPieceID' @_hash['approximate_intake_date'] = 'approximateIntakeDate' @_hash['mail_piece_intake_date'] = 'mailPieceIntakeDate' @_hash['table_code'] = 'tableCode' @_hash['request_type'] = 'requestType' @_hash['first_name'] = 'firstName' @_hash['last_name'] = 'lastName' @_hash['email'] = 'email' @_hash['fax_number'] = 'faxNumber' @_hash['street_address'] = 'streetAddress' @_hash['secondary_address'] = 'secondaryAddress' @_hash['city'] = 'city' @_hash['state'] = 'state' @_hash['zip_code'] = 'ZIPCode' @_hash['zip_plus4'] = 'ZIPPlus4' @_hash['crid'] = 'CRID' @_hash end |
.nullables ⇒ Object
An array for nullable fields
152 153 154 |
# File 'lib/usps_api/models/proof_of_delivery_request.rb', line 152 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
136 137 138 139 140 141 142 143 144 145 146 147 148 149 |
# File 'lib/usps_api/models/proof_of_delivery_request.rb', line 136 def self.optionals %w[ unique_tracking_id approximate_intake_date fax_number street_address secondary_address city state zip_code zip_plus4 crid ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
260 261 262 263 264 265 266 267 268 269 270 271 272 |
# File 'lib/usps_api/models/proof_of_delivery_request.rb', line 260 def inspect class_name = self.class.name.split('::').last "<#{class_name} unique_tracking_id: #{@unique_tracking_id.inspect}, unique_mail_piece_id:"\ " #{@unique_mail_piece_id.inspect}, approximate_intake_date:"\ " #{@approximate_intake_date.inspect}, mail_piece_intake_date:"\ " #{@mail_piece_intake_date.inspect}, table_code: #{@table_code.inspect}, request_type:"\ " #{@request_type.inspect}, first_name: #{@first_name.inspect}, last_name:"\ " #{@last_name.inspect}, email: #{@email.inspect}, fax_number: #{@fax_number.inspect},"\ " street_address: #{@street_address.inspect}, secondary_address:"\ " #{@secondary_address.inspect}, city: #{@city.inspect}, state: #{@state.inspect}, zip_code:"\ " #{@zip_code.inspect}, zip_plus4: #{@zip_plus4.inspect}, crid: #{@crid.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_custom_approximate_intake_date ⇒ Object
242 243 244 |
# File 'lib/usps_api/models/proof_of_delivery_request.rb', line 242 def to_custom_approximate_intake_date DateTimeHelper.to_rfc3339(approximate_intake_date) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
247 248 249 250 251 252 253 254 255 256 257 |
# File 'lib/usps_api/models/proof_of_delivery_request.rb', line 247 def to_s class_name = self.class.name.split('::').last "<#{class_name} unique_tracking_id: #{@unique_tracking_id}, unique_mail_piece_id:"\ " #{@unique_mail_piece_id}, approximate_intake_date: #{@approximate_intake_date},"\ " mail_piece_intake_date: #{@mail_piece_intake_date}, table_code: #{@table_code},"\ " request_type: #{@request_type}, first_name: #{@first_name}, last_name: #{@last_name},"\ " email: #{@email}, fax_number: #{@fax_number}, street_address: #{@street_address},"\ " secondary_address: #{@secondary_address}, city: #{@city}, state: #{@state}, zip_code:"\ " #{@zip_code}, zip_plus4: #{@zip_plus4}, crid: #{@crid}, additional_properties:"\ " #{@additional_properties}>" end |