Class: UspsApi::ReturnLabelDetails
- Defined in:
- lib/usps_api/models/return_label_details.rb
Overview
Details on package transaction details that will be or have been issued to a customer account. Fields will only be provided if they differed from the original manifested data.
Instance Attribute Summary collapse
-
#account_number ⇒ String
The Enterprise Payment Account the adjustment was charged to.
-
#assessed_package ⇒ AssessedPackage
Assessed package details used to determine the refund amount.
-
#assessed_postage ⇒ AssessedPostage
Assessed package details used to determine the refund amount.
-
#base_postage ⇒ Float
The base transport cost.
-
#crid ⇒ String
Customer Registration ID used to identify the business location associated to a shipment.
-
#description ⇒ String
Description of the return label fee assessed to the package.
-
#destination_address ⇒ DestinationAddress
Manifest package details used to determine the refund amount.
-
#extra_services ⇒ Array[ExtraService7]
Array of extra services associated with the shipment.
-
#fees ⇒ Array[Fee4]
The claimed and assessed fees for the package.
-
#first_scan_date ⇒ DateTime
Earliest Datetime USPS scanned the package.
-
#idempotency_key ⇒ String
Unique idempotency key for the return label fee assessed to the package.
-
#label_type ⇒ String
Label type for the return label fee assessed to the package.
-
#mailing_date ⇒ DateTime
Earliest Datetime USPS scanned the package.
-
#mid ⇒ String
Mailer ID used in the barcode to identify the Mail Owner associated to a shipment.
-
#origin_address ⇒ OriginAddress
Manifest package details used to determine the refund amount.
-
#payment_transaction_type ⇒ PaymentTransactionType1
Payment transaction type for the return label fee assessed to the package.
-
#tracking_number ⇒ String
The trackingNumber of the package.
-
#transaction_amount ⇒ Float
Transaction amount for the non-label fee.
-
#transaction_date_time ⇒ DateTime
Combination of Date Of Mailing and Time Of Mailing YYYYMMDD + HHMMSS.
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(description: 'Return label scanned', idempotency_key: SKIP, payment_transaction_type: SKIP, label_type: SKIP, tracking_number: SKIP, crid: SKIP, mid: SKIP, account_number: SKIP, mailing_date: SKIP, first_scan_date: SKIP, transaction_date_time: SKIP, origin_address: SKIP, destination_address: SKIP, assessed_package: SKIP, assessed_postage: SKIP, transaction_amount: SKIP, base_postage: SKIP, fees: SKIP, extra_services: SKIP) ⇒ ReturnLabelDetails
constructor
A new instance of ReturnLabelDetails.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_first_scan_date ⇒ Object
- #to_custom_mailing_date ⇒ Object
- #to_custom_transaction_date_time ⇒ 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(description: 'Return label scanned', idempotency_key: SKIP, payment_transaction_type: SKIP, label_type: SKIP, tracking_number: SKIP, crid: SKIP, mid: SKIP, account_number: SKIP, mailing_date: SKIP, first_scan_date: SKIP, transaction_date_time: SKIP, origin_address: SKIP, destination_address: SKIP, assessed_package: SKIP, assessed_postage: SKIP, transaction_amount: SKIP, base_postage: SKIP, fees: SKIP, extra_services: SKIP) ⇒ ReturnLabelDetails
Returns a new instance of ReturnLabelDetails.
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 |
# File 'lib/usps_api/models/return_label_details.rb', line 148 def initialize(description: 'Return label scanned', idempotency_key: SKIP, payment_transaction_type: SKIP, label_type: SKIP, tracking_number: SKIP, crid: SKIP, mid: SKIP, account_number: SKIP, mailing_date: SKIP, first_scan_date: SKIP, transaction_date_time: SKIP, origin_address: SKIP, destination_address: SKIP, assessed_package: SKIP, assessed_postage: SKIP, transaction_amount: SKIP, base_postage: SKIP, fees: SKIP, extra_services: SKIP) @description = description unless description == SKIP @idempotency_key = idempotency_key unless idempotency_key == SKIP @payment_transaction_type = payment_transaction_type unless payment_transaction_type == SKIP @label_type = label_type unless label_type == SKIP @tracking_number = tracking_number unless tracking_number == SKIP @crid = crid unless crid == SKIP @mid = mid unless mid == SKIP @account_number = account_number unless account_number == SKIP @mailing_date = mailing_date unless mailing_date == SKIP @first_scan_date = first_scan_date unless first_scan_date == SKIP @transaction_date_time = transaction_date_time unless transaction_date_time == SKIP @origin_address = origin_address unless origin_address == SKIP @destination_address = destination_address unless destination_address == SKIP @assessed_package = assessed_package unless assessed_package == SKIP @assessed_postage = assessed_postage unless assessed_postage == SKIP @transaction_amount = transaction_amount unless transaction_amount == SKIP @base_postage = base_postage unless base_postage == SKIP @fees = fees unless fees == SKIP @extra_services = extra_services unless extra_services == SKIP end |
Instance Attribute Details
#account_number ⇒ String
The Enterprise Payment Account the adjustment was charged to.
47 48 49 |
# File 'lib/usps_api/models/return_label_details.rb', line 47 def account_number @account_number end |
#assessed_package ⇒ AssessedPackage
Assessed package details used to determine the refund amount.
71 72 73 |
# File 'lib/usps_api/models/return_label_details.rb', line 71 def assessed_package @assessed_package end |
#assessed_postage ⇒ AssessedPostage
Assessed package details used to determine the refund amount.
75 76 77 |
# File 'lib/usps_api/models/return_label_details.rb', line 75 def assessed_postage @assessed_postage end |
#base_postage ⇒ Float
The base transport cost
83 84 85 |
# File 'lib/usps_api/models/return_label_details.rb', line 83 def base_postage @base_postage end |
#crid ⇒ String
Customer Registration ID used to identify the business location associated to a shipment.
38 39 40 |
# File 'lib/usps_api/models/return_label_details.rb', line 38 def crid @crid end |
#description ⇒ String
Description of the return label fee assessed to the package.
17 18 19 |
# File 'lib/usps_api/models/return_label_details.rb', line 17 def description @description end |
#destination_address ⇒ DestinationAddress
Manifest package details used to determine the refund amount.
67 68 69 |
# File 'lib/usps_api/models/return_label_details.rb', line 67 def destination_address @destination_address end |
#extra_services ⇒ Array[ExtraService7]
Array of extra services associated with the shipment.
91 92 93 |
# File 'lib/usps_api/models/return_label_details.rb', line 91 def extra_services @extra_services end |
#fees ⇒ Array[Fee4]
The claimed and assessed fees for the package.
87 88 89 |
# File 'lib/usps_api/models/return_label_details.rb', line 87 def fees @fees end |
#first_scan_date ⇒ DateTime
Earliest Datetime USPS scanned the package.
55 56 57 |
# File 'lib/usps_api/models/return_label_details.rb', line 55 def first_scan_date @first_scan_date end |
#idempotency_key ⇒ String
Unique idempotency key for the return label fee assessed to the package
21 22 23 |
# File 'lib/usps_api/models/return_label_details.rb', line 21 def idempotency_key @idempotency_key end |
#label_type ⇒ String
Label type for the return label fee assessed to the package
29 30 31 |
# File 'lib/usps_api/models/return_label_details.rb', line 29 def label_type @label_type end |
#mailing_date ⇒ DateTime
Earliest Datetime USPS scanned the package.
51 52 53 |
# File 'lib/usps_api/models/return_label_details.rb', line 51 def mailing_date @mailing_date end |
#mid ⇒ String
Mailer ID used in the barcode to identify the Mail Owner associated to a shipment.
43 44 45 |
# File 'lib/usps_api/models/return_label_details.rb', line 43 def mid @mid end |
#origin_address ⇒ OriginAddress
Manifest package details used to determine the refund amount.
63 64 65 |
# File 'lib/usps_api/models/return_label_details.rb', line 63 def origin_address @origin_address end |
#payment_transaction_type ⇒ PaymentTransactionType1
Payment transaction type for the return label fee assessed to the package
25 26 27 |
# File 'lib/usps_api/models/return_label_details.rb', line 25 def payment_transaction_type @payment_transaction_type end |
#tracking_number ⇒ String
The trackingNumber of the package.
33 34 35 |
# File 'lib/usps_api/models/return_label_details.rb', line 33 def tracking_number @tracking_number end |
#transaction_amount ⇒ Float
Transaction amount for the non-label fee
79 80 81 |
# File 'lib/usps_api/models/return_label_details.rb', line 79 def transaction_amount @transaction_amount end |
#transaction_date_time ⇒ DateTime
Combination of Date Of Mailing and Time Of Mailing YYYYMMDD + HHMMSS
59 60 61 |
# File 'lib/usps_api/models/return_label_details.rb', line 59 def transaction_date_time @transaction_date_time end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 226 227 228 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 256 257 258 259 260 |
# File 'lib/usps_api/models/return_label_details.rb', line 179 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. description = hash['description'] ||= 'Return label scanned' idempotency_key = hash.key?('idempotencyKey') ? hash['idempotencyKey'] : SKIP payment_transaction_type = hash.key?('paymentTransactionType') ? hash['paymentTransactionType'] : SKIP label_type = hash.key?('labelType') ? hash['labelType'] : SKIP tracking_number = hash.key?('trackingNumber') ? hash['trackingNumber'] : SKIP crid = hash.key?('CRID') ? hash['CRID'] : SKIP mid = hash.key?('MID') ? hash['MID'] : SKIP account_number = hash.key?('accountNumber') ? hash['accountNumber'] : SKIP mailing_date = if hash.key?('mailingDate') (DateTimeHelper.from_rfc3339(hash['mailingDate']) if hash['mailingDate']) else SKIP end first_scan_date = if hash.key?('firstScanDate') (DateTimeHelper.from_rfc3339(hash['firstScanDate']) if hash['firstScanDate']) else SKIP end transaction_date_time = if hash.key?('transactionDateTime') (DateTimeHelper.from_rfc3339(hash['transactionDateTime']) if hash['transactionDateTime']) else SKIP end origin_address = OriginAddress.from_hash(hash['originAddress']) if hash['originAddress'] destination_address = DestinationAddress.from_hash(hash['destinationAddress']) if hash['destinationAddress'] assessed_package = AssessedPackage.from_hash(hash['assessedPackage']) if hash['assessedPackage'] assessed_postage = AssessedPostage.from_hash(hash['assessedPostage']) if hash['assessedPostage'] transaction_amount = hash.key?('transactionAmount') ? hash['transactionAmount'] : SKIP base_postage = hash.key?('basePostage') ? hash['basePostage'] : SKIP # Parameter is an array, so we need to iterate through it fees = nil unless hash['fees'].nil? fees = [] hash['fees'].each do |structure| fees << (Fee4.from_hash(structure) if structure) end end fees = SKIP unless hash.key?('fees') # Parameter is an array, so we need to iterate through it extra_services = nil unless hash['extraServices'].nil? extra_services = [] hash['extraServices'].each do |structure| extra_services << (ExtraService7.from_hash(structure) if structure) end end extra_services = SKIP unless hash.key?('extraServices') # Create object from extracted values. ReturnLabelDetails.new(description: description, idempotency_key: idempotency_key, payment_transaction_type: payment_transaction_type, label_type: label_type, tracking_number: tracking_number, crid: crid, mid: mid, account_number: account_number, mailing_date: mailing_date, first_scan_date: first_scan_date, transaction_date_time: transaction_date_time, origin_address: origin_address, destination_address: destination_address, assessed_package: assessed_package, assessed_postage: assessed_postage, transaction_amount: transaction_amount, base_postage: base_postage, fees: fees, extra_services: extra_services) end |
.names ⇒ Object
A mapping from model property names to API property names.
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/usps_api/models/return_label_details.rb', line 94 def self.names @_hash = {} if @_hash.nil? @_hash['description'] = 'description' @_hash['idempotency_key'] = 'idempotencyKey' @_hash['payment_transaction_type'] = 'paymentTransactionType' @_hash['label_type'] = 'labelType' @_hash['tracking_number'] = 'trackingNumber' @_hash['crid'] = 'CRID' @_hash['mid'] = 'MID' @_hash['account_number'] = 'accountNumber' @_hash['mailing_date'] = 'mailingDate' @_hash['first_scan_date'] = 'firstScanDate' @_hash['transaction_date_time'] = 'transactionDateTime' @_hash['origin_address'] = 'originAddress' @_hash['destination_address'] = 'destinationAddress' @_hash['assessed_package'] = 'assessedPackage' @_hash['assessed_postage'] = 'assessedPostage' @_hash['transaction_amount'] = 'transactionAmount' @_hash['base_postage'] = 'basePostage' @_hash['fees'] = 'fees' @_hash['extra_services'] = 'extraServices' @_hash end |
.nullables ⇒ Object
An array for nullable fields
144 145 146 |
# File 'lib/usps_api/models/return_label_details.rb', line 144 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 |
# File 'lib/usps_api/models/return_label_details.rb', line 119 def self.optionals %w[ description idempotency_key payment_transaction_type label_type tracking_number crid mid account_number mailing_date first_scan_date transaction_date_time origin_address destination_address assessed_package assessed_postage transaction_amount base_postage fees extra_services ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
288 289 290 291 292 293 294 295 296 297 298 299 300 301 |
# File 'lib/usps_api/models/return_label_details.rb', line 288 def inspect class_name = self.class.name.split('::').last "<#{class_name} description: #{@description.inspect}, idempotency_key:"\ " #{@idempotency_key.inspect}, payment_transaction_type:"\ " #{@payment_transaction_type.inspect}, label_type: #{@label_type.inspect}, tracking_number:"\ " #{@tracking_number.inspect}, crid: #{@crid.inspect}, mid: #{@mid.inspect}, account_number:"\ " #{@account_number.inspect}, mailing_date: #{@mailing_date.inspect}, first_scan_date:"\ " #{@first_scan_date.inspect}, transaction_date_time: #{@transaction_date_time.inspect},"\ " origin_address: #{@origin_address.inspect}, destination_address:"\ " #{@destination_address.inspect}, assessed_package: #{@assessed_package.inspect},"\ " assessed_postage: #{@assessed_postage.inspect}, transaction_amount:"\ " #{@transaction_amount.inspect}, base_postage: #{@base_postage.inspect}, fees:"\ " #{@fees.inspect}, extra_services: #{@extra_services.inspect}>" end |
#to_custom_first_scan_date ⇒ Object
266 267 268 |
# File 'lib/usps_api/models/return_label_details.rb', line 266 def to_custom_first_scan_date DateTimeHelper.to_rfc3339(first_scan_date) end |
#to_custom_mailing_date ⇒ Object
262 263 264 |
# File 'lib/usps_api/models/return_label_details.rb', line 262 def to_custom_mailing_date DateTimeHelper.to_rfc3339(mailing_date) end |
#to_custom_transaction_date_time ⇒ Object
270 271 272 |
# File 'lib/usps_api/models/return_label_details.rb', line 270 def to_custom_transaction_date_time DateTimeHelper.to_rfc3339(transaction_date_time) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
275 276 277 278 279 280 281 282 283 284 285 |
# File 'lib/usps_api/models/return_label_details.rb', line 275 def to_s class_name = self.class.name.split('::').last "<#{class_name} description: #{@description}, idempotency_key: #{@idempotency_key},"\ " payment_transaction_type: #{@payment_transaction_type}, label_type: #{@label_type},"\ " tracking_number: #{@tracking_number}, crid: #{@crid}, mid: #{@mid}, account_number:"\ " #{@account_number}, mailing_date: #{@mailing_date}, first_scan_date: #{@first_scan_date},"\ " transaction_date_time: #{@transaction_date_time}, origin_address: #{@origin_address},"\ " destination_address: #{@destination_address}, assessed_package: #{@assessed_package},"\ " assessed_postage: #{@assessed_postage}, transaction_amount: #{@transaction_amount},"\ " base_postage: #{@base_postage}, fees: #{@fees}, extra_services: #{@extra_services}>" end |