Class: UspsApi::TrackingInformationFields

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/usps_api/models/tracking_information_fields.rb

Overview

Detailed tracking information for the requested tracking number.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(tracking_number: SKIP, additional_info: SKIP, adp_scripting: SKIP, archive_restore_info: SKIP, associated_label: SKIP, carrier_release: SKIP, mail_class: SKIP, destination_city: SKIP, destination_country_code: SKIP, destination_state: SKIP, destination_zip: SKIP, edited_label_id: SKIP, email_enabled: SKIP, end_of_day: SKIP, e_sof_eligible: SKIP, expected_delivery_time_stamp: SKIP, expected_delivery_type: SKIP, guaranteed_delivery_time_stamp: SKIP, guaranteed_details: SKIP, item_shape: SKIP, kahala_indicator: SKIP, mail_type: SKIP, approximate_intake_date: SKIP, mail_piece_intake_date: SKIP, unique_tracking_id: SKIP, unique_mail_piece_id: SKIP, on_time: SKIP, origin_city: SKIP, origin_country: SKIP, origin_state: SKIP, origin_zip: SKIP, proof_of_delivery_enabled: SKIP, predicted_delivery_time_stamp: SKIP, predicted_delivery_date: SKIP, predicted_delivery_window_start_time: SKIP, predicted_delivery_window_end_time: SKIP, related_return_receipt_id: SKIP, redelivery_enabled: SKIP, enabled_notification_requests: SKIP, restore_enabled: SKIP, return_date_notice: SKIP, rra_menabled: SKIP, rre_enabled: SKIP, services: SKIP, service_type_code: SKIP, status: SKIP, status_category: SKIP, status_summary: SKIP, table_code: SKIP, tracking_proof_of_delivery_enabled: SKIP, valueof_article: SKIP, access_control: SKIP, extend_retention_purchased_code: SKIP, extend_retention_extra_service_code_options: SKIP, tracking_events: SKIP, additional_properties: nil) ⇒ TrackingInformationFields

Returns a new instance of TrackingInformationFields.



400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
# File 'lib/usps_api/models/tracking_information_fields.rb', line 400

def initialize(tracking_number: SKIP, additional_info: SKIP,
               adp_scripting: SKIP, archive_restore_info: SKIP,
               associated_label: SKIP, carrier_release: SKIP,
               mail_class: SKIP, destination_city: SKIP,
               destination_country_code: SKIP, destination_state: SKIP,
               destination_zip: SKIP, edited_label_id: SKIP,
               email_enabled: SKIP, end_of_day: SKIP, e_sof_eligible: SKIP,
               expected_delivery_time_stamp: SKIP,
               expected_delivery_type: SKIP,
               guaranteed_delivery_time_stamp: SKIP,
               guaranteed_details: SKIP, item_shape: SKIP,
               kahala_indicator: SKIP, mail_type: SKIP,
               approximate_intake_date: SKIP, mail_piece_intake_date: SKIP,
               unique_tracking_id: SKIP, unique_mail_piece_id: SKIP,
               on_time: SKIP, origin_city: SKIP, origin_country: SKIP,
               origin_state: SKIP, origin_zip: SKIP,
               proof_of_delivery_enabled: SKIP,
               predicted_delivery_time_stamp: SKIP,
               predicted_delivery_date: SKIP,
               predicted_delivery_window_start_time: SKIP,
               predicted_delivery_window_end_time: SKIP,
               related_return_receipt_id: SKIP, redelivery_enabled: SKIP,
               enabled_notification_requests: SKIP, restore_enabled: SKIP,
               return_date_notice: SKIP, rra_menabled: SKIP,
               rre_enabled: SKIP, services: SKIP, service_type_code: SKIP,
               status: SKIP, status_category: SKIP, status_summary: SKIP,
               table_code: SKIP, tracking_proof_of_delivery_enabled: SKIP,
               valueof_article: SKIP, access_control: SKIP,
               extend_retention_purchased_code: SKIP,
               extend_retention_extra_service_code_options: SKIP,
               tracking_events: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @tracking_number = tracking_number unless tracking_number == SKIP
  @additional_info = additional_info unless additional_info == SKIP
  @adp_scripting = adp_scripting unless adp_scripting == SKIP
  @archive_restore_info = archive_restore_info unless archive_restore_info == SKIP
  @associated_label = associated_label unless associated_label == SKIP
  @carrier_release = carrier_release unless carrier_release == SKIP
  @mail_class = mail_class unless mail_class == SKIP
  @destination_city = destination_city unless destination_city == SKIP
  @destination_country_code = destination_country_code unless destination_country_code == SKIP
  @destination_state = destination_state unless destination_state == SKIP
  @destination_zip = destination_zip unless destination_zip == SKIP
  @edited_label_id = edited_label_id unless edited_label_id == SKIP
  @email_enabled = email_enabled unless email_enabled == SKIP
  @end_of_day = end_of_day unless end_of_day == SKIP
  @e_sof_eligible = e_sof_eligible unless e_sof_eligible == SKIP
  unless expected_delivery_time_stamp == SKIP
    @expected_delivery_time_stamp =
      expected_delivery_time_stamp
  end
  @expected_delivery_type = expected_delivery_type unless expected_delivery_type == SKIP
  unless guaranteed_delivery_time_stamp == SKIP
    @guaranteed_delivery_time_stamp =
      guaranteed_delivery_time_stamp
  end
  @guaranteed_details = guaranteed_details unless guaranteed_details == SKIP
  @item_shape = item_shape unless item_shape == SKIP
  @kahala_indicator = kahala_indicator unless kahala_indicator == SKIP
  @mail_type = mail_type unless mail_type == SKIP
  @approximate_intake_date = approximate_intake_date unless approximate_intake_date == SKIP
  @mail_piece_intake_date = mail_piece_intake_date unless mail_piece_intake_date == SKIP
  @unique_tracking_id = unique_tracking_id unless unique_tracking_id == SKIP
  @unique_mail_piece_id = unique_mail_piece_id unless unique_mail_piece_id == SKIP
  @on_time = on_time unless on_time == SKIP
  @origin_city = origin_city unless origin_city == SKIP
  @origin_country = origin_country unless origin_country == SKIP
  @origin_state = origin_state unless origin_state == SKIP
  @origin_zip = origin_zip unless origin_zip == SKIP
  unless proof_of_delivery_enabled == SKIP
    @proof_of_delivery_enabled =
      proof_of_delivery_enabled
  end
  unless predicted_delivery_time_stamp == SKIP
    @predicted_delivery_time_stamp =
      predicted_delivery_time_stamp
  end
  @predicted_delivery_date = predicted_delivery_date unless predicted_delivery_date == SKIP
  unless predicted_delivery_window_start_time == SKIP
    @predicted_delivery_window_start_time =
      predicted_delivery_window_start_time
  end
  unless predicted_delivery_window_end_time == SKIP
    @predicted_delivery_window_end_time =
      predicted_delivery_window_end_time
  end
  unless related_return_receipt_id == SKIP
    @related_return_receipt_id =
      related_return_receipt_id
  end
  @redelivery_enabled = redelivery_enabled unless redelivery_enabled == SKIP
  unless enabled_notification_requests == SKIP
    @enabled_notification_requests =
      enabled_notification_requests
  end
  @restore_enabled = restore_enabled unless restore_enabled == SKIP
  @return_date_notice = return_date_notice unless return_date_notice == SKIP
  @rra_menabled = rra_menabled unless rra_menabled == SKIP
  @rre_enabled = rre_enabled unless rre_enabled == SKIP
  @services = services unless services == SKIP
  @service_type_code = service_type_code unless service_type_code == SKIP
  @status = status unless status == SKIP
  @status_category = status_category unless status_category == SKIP
  @status_summary = status_summary unless status_summary == SKIP
  @table_code = table_code unless table_code == SKIP
  unless tracking_proof_of_delivery_enabled == SKIP
    @tracking_proof_of_delivery_enabled =
      tracking_proof_of_delivery_enabled
  end
  @valueof_article = valueof_article unless valueof_article == SKIP
  @access_control = access_control unless access_control == SKIP
  unless extend_retention_purchased_code == SKIP
    @extend_retention_purchased_code =
      extend_retention_purchased_code
  end
  unless extend_retention_extra_service_code_options == SKIP
    @extend_retention_extra_service_code_options =
      extend_retention_extra_service_code_options
  end
  @tracking_events = tracking_events unless tracking_events == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#access_controlAccessControl

Details on if the Tracking request was free or charged based on MID access through an IP Agreement.

  • ‘FREE` - The Tracking request was free.

  • ‘IP_AGREEMENT` - The tracking request was charged based on MID access

through an IP Agreement.

Returns:



251
252
253
# File 'lib/usps_api/models/tracking_information_fields.rb', line 251

def access_control
  @access_control
end

#additional_infoString

Additional package information.

Returns:

  • (String)


20
21
22
# File 'lib/usps_api/models/tracking_information_fields.rb', line 20

def additional_info
  @additional_info
end

#adp_scriptingString

Additional ADP scripting specific to the ADP Type code.

Returns:

  • (String)


24
25
26
# File 'lib/usps_api/models/tracking_information_fields.rb', line 24

def adp_scripting
  @adp_scripting
end

#approximate_intake_dateString

Unique mail piece ID (mp-date) value, unique to each TrackID

Returns:

  • (String)


114
115
116
# File 'lib/usps_api/models/tracking_information_fields.rb', line 114

def approximate_intake_date
  @approximate_intake_date
end

#archive_restore_infoString

Information regarding availability of Restore service function.

Returns:

  • (String)


28
29
30
# File 'lib/usps_api/models/tracking_information_fields.rb', line 28

def archive_restore_info
  @archive_restore_info
end

#associated_labelString

Additional Label on the mail piece, example is: EA123456785US. This is not currently populated.

Returns:

  • (String)


33
34
35
# File 'lib/usps_api/models/tracking_information_fields.rb', line 33

def associated_label
  @associated_label
end

#carrier_releaseTrueClass | FalseClass

Indicating the item qualifies for the customer to electronically authorize shipment release.

Returns:

  • (TrueClass | FalseClass)


38
39
40
# File 'lib/usps_api/models/tracking_information_fields.rb', line 38

def carrier_release
  @carrier_release
end

#destination_cityString

The destination city.

Returns:

  • (String)


49
50
51
# File 'lib/usps_api/models/tracking_information_fields.rb', line 49

def destination_city
  @destination_city
end

#destination_country_codeString

The destination country code.

Returns:

  • (String)


53
54
55
# File 'lib/usps_api/models/tracking_information_fields.rb', line 53

def destination_country_code
  @destination_country_code
end

#destination_stateString

The destination country code.

Returns:

  • (String)


57
58
59
# File 'lib/usps_api/models/tracking_information_fields.rb', line 57

def destination_state
  @destination_state
end

#destination_zipString

The destination ZIP Code™.

Returns:

  • (String)


61
62
63
# File 'lib/usps_api/models/tracking_information_fields.rb', line 61

def destination_zip
  @destination_zip
end

#e_sof_eligibleTrueClass | FalseClass

Indicates if the mail piece is signature on file eligible.

Returns:

  • (TrueClass | FalseClass)


80
81
82
# File 'lib/usps_api/models/tracking_information_fields.rb', line 80

def e_sof_eligible
  @e_sof_eligible
end

#edited_label_idString

The edited label identifier or Full Label identifier, example: EA123456795US.

Returns:

  • (String)


66
67
68
# File 'lib/usps_api/models/tracking_information_fields.rb', line 66

def edited_label_id
  @edited_label_id
end

#email_enabledTrueClass | FalseClass

Signifies if USPS® Tracking by Email service is enabled.

Returns:

  • (TrueClass | FalseClass)


70
71
72
# File 'lib/usps_api/models/tracking_information_fields.rb', line 70

def email_enabled
  @email_enabled
end

#enabled_notification_requestsEnabledNotificationRequests

USPS® Text Tracking is a mechanism by which customers can be notified of the status of their package.



183
184
185
# File 'lib/usps_api/models/tracking_information_fields.rb', line 183

def enabled_notification_requests
  @enabled_notification_requests
end

#end_of_dayString

Populated with the end of day time provided by TRP when TRP API indicates the window is “End of Day” or when the piece is eligible for the PTR default end of day.

Returns:

  • (String)


76
77
78
# File 'lib/usps_api/models/tracking_information_fields.rb', line 76

def end_of_day
  @end_of_day
end

#expected_delivery_time_stampDateTime

The expected delivery date.

Returns:

  • (DateTime)


84
85
86
# File 'lib/usps_api/models/tracking_information_fields.rb', line 84

def expected_delivery_time_stamp
  @expected_delivery_time_stamp
end

#expected_delivery_typeString

Populates Expected Delivery byif there is an expected delivery date.

Returns:

  • (String)


88
89
90
# File 'lib/usps_api/models/tracking_information_fields.rb', line 88

def expected_delivery_type
  @expected_delivery_type
end

#extend_retention_extra_service_code_optionsArray[Object]

Contain a list of available extended retention ESCs eligible for a mail piece.

Returns:

  • (Array[Object])


261
262
263
# File 'lib/usps_api/models/tracking_information_fields.rb', line 261

def extend_retention_extra_service_code_options
  @extend_retention_extra_service_code_options
end

#extend_retention_purchased_codeString

Populates the Extended Retention extra service charge purchased on the mail piece.

Returns:

  • (String)


256
257
258
# File 'lib/usps_api/models/tracking_information_fields.rb', line 256

def extend_retention_purchased_code
  @extend_retention_purchased_code
end

#guaranteed_delivery_time_stampDateTime

Guaranteed Delivery Date Global Express Mail only: certain countries provide a guarantee delivery.

Returns:

  • (DateTime)


93
94
95
# File 'lib/usps_api/models/tracking_information_fields.rb', line 93

def guaranteed_delivery_time_stamp
  @guaranteed_delivery_time_stamp
end

#guaranteed_detailsString

Special messaging related to the guarantee.

Returns:

  • (String)


97
98
99
# File 'lib/usps_api/models/tracking_information_fields.rb', line 97

def guaranteed_details
  @guaranteed_details
end

#item_shapeItemShape

Indicates the shape of the item.

Returns:



101
102
103
# File 'lib/usps_api/models/tracking_information_fields.rb', line 101

def item_shape
  @item_shape
end

#kahala_indicatorTrueClass | FalseClass

Kahala Posts Group (KPG) member indicator

Returns:

  • (TrueClass | FalseClass)


105
106
107
# File 'lib/usps_api/models/tracking_information_fields.rb', line 105

def kahala_indicator
  @kahala_indicator
end

#mail_classMailClass7

Mail Class of the mail piece (human readable). This will also include the service standard message if it exists. Note: Global Express Guaranteed Service is suspended as of September 29, 2024.

Returns:



45
46
47
# File 'lib/usps_api/models/tracking_information_fields.rb', line 45

def mail_class
  @mail_class
end

#mail_piece_intake_dateDateTime

Unique mail piece ID (mp-date) value, unique to each TrackID

Returns:

  • (DateTime)


118
119
120
# File 'lib/usps_api/models/tracking_information_fields.rb', line 118

def mail_piece_intake_date
  @mail_piece_intake_date
end

#mail_typeMailType

Type of Mail: if kahalaIndicator is true mailTypeCode is IM (International mail)

Returns:



110
111
112
# File 'lib/usps_api/models/tracking_information_fields.rb', line 110

def mail_type
  @mail_type
end

#on_timeTrueClass | FalseClass

Indicating if the item will be delivered on time as specified in the Expected or Guaranteed delivery date.

Returns:

  • (TrueClass | FalseClass)


131
132
133
# File 'lib/usps_api/models/tracking_information_fields.rb', line 131

def on_time
  @on_time
end

#origin_cityString

The mail item origin city.

Returns:

  • (String)


135
136
137
# File 'lib/usps_api/models/tracking_information_fields.rb', line 135

def origin_city
  @origin_city
end

#origin_countryString

The mail item origin country.

Returns:

  • (String)


139
140
141
# File 'lib/usps_api/models/tracking_information_fields.rb', line 139

def origin_country
  @origin_country
end

#origin_stateString

The mail item origin state or province.

Returns:

  • (String)


143
144
145
# File 'lib/usps_api/models/tracking_information_fields.rb', line 143

def origin_state
  @origin_state
end

#origin_zipString

The mail item origin ZIP Code™.

Returns:

  • (String)


147
148
149
# File 'lib/usps_api/models/tracking_information_fields.rb', line 147

def origin_zip
  @origin_zip
end

#predicted_delivery_dateDate

The predicted delivery date.

Returns:

  • (Date)


159
160
161
# File 'lib/usps_api/models/tracking_information_fields.rb', line 159

def predicted_delivery_date
  @predicted_delivery_date
end

#predicted_delivery_time_stampDateTime

The predicted delivery date.

Returns:

  • (DateTime)


155
156
157
# File 'lib/usps_api/models/tracking_information_fields.rb', line 155

def predicted_delivery_time_stamp
  @predicted_delivery_time_stamp
end

#predicted_delivery_window_end_timeString

The predicted delivery window end time.

Returns:

  • (String)


167
168
169
# File 'lib/usps_api/models/tracking_information_fields.rb', line 167

def predicted_delivery_window_end_time
  @predicted_delivery_window_end_time
end

#predicted_delivery_window_start_timeString

The predicted delivery window start time.

Returns:

  • (String)


163
164
165
# File 'lib/usps_api/models/tracking_information_fields.rb', line 163

def predicted_delivery_window_start_time
  @predicted_delivery_window_start_time
end

#proof_of_delivery_enabledTrueClass | FalseClass

Signifies if Proof of Delivery service is enabled.

Returns:

  • (TrueClass | FalseClass)


151
152
153
# File 'lib/usps_api/models/tracking_information_fields.rb', line 151

def proof_of_delivery_enabled
  @proof_of_delivery_enabled
end

#redelivery_enabledTrueClass | FalseClass

Field indicating if the item qualifies for redelivery.

Returns:

  • (TrueClass | FalseClass)


178
179
180
# File 'lib/usps_api/models/tracking_information_fields.rb', line 178

def redelivery_enabled
  @redelivery_enabled
end

The related label ID between a tracking barcode, the core product, and a PS3811, Green Card Return Reciept. This field can contain either the core product label ID or the Green Card label ID. There is only a one to one relationship.

Returns:

  • (String)


174
175
176
# File 'lib/usps_api/models/tracking_information_fields.rb', line 174

def related_return_receipt_id
  @related_return_receipt_id
end

#restore_enabledTrueClass | FalseClass

Signifies if Restore tracking information service is enabled.

Returns:

  • (TrueClass | FalseClass)


187
188
189
# File 'lib/usps_api/models/tracking_information_fields.rb', line 187

def restore_enabled
  @restore_enabled
end

#return_date_noticeDate

Field indicating the date the item will be Returned to Sender.

Returns:

  • (Date)


191
192
193
# File 'lib/usps_api/models/tracking_information_fields.rb', line 191

def return_date_notice
  @return_date_notice
end

#rra_menabledTrueClass | FalseClass

Signifies if Return Receipt After Mailing service is enabled

Returns:

  • (TrueClass | FalseClass)


195
196
197
# File 'lib/usps_api/models/tracking_information_fields.rb', line 195

def rra_menabled
  @rra_menabled
end

#rre_enabledTrueClass | FalseClass

Signifies if Return Receipt Electronic service is enabled

Returns:

  • (TrueClass | FalseClass)


199
200
201
# File 'lib/usps_api/models/tracking_information_fields.rb', line 199

def rre_enabled
  @rre_enabled
end

#service_type_codeString

The service Type Code of the mail piece. Refer to the lookup table for all the possible values. USPS® [Pub 199](postalpro.usps.com/pub199) Appendix I: Intelligent Mail Package Barcode Service Type Codes

Returns:

  • (String)


213
214
215
# File 'lib/usps_api/models/tracking_information_fields.rb', line 213

def service_type_code
  @service_type_code
end

#servicesArray[String]

Additional services purchased. Refer to the lookup table for all the possible values.

USPS® [Pub 199](http://postalpro.usps.com/pub199) Appendix J-Table 7

Extra Service Codes

Returns:

  • (Array[String])


206
207
208
# File 'lib/usps_api/models/tracking_information_fields.rb', line 206

def services
  @services
end

#statusString

The item status. Refer to the lookup table for all the possible values. USPS® [Pub 199](postalpro.usps.com/pub199) Appendix G-4: USPS Domestic Tracking Scan Events and Appendix G-5: Scan Event Codes - International Mail

Returns:

  • (String)


220
221
222
# File 'lib/usps_api/models/tracking_information_fields.rb', line 220

def status
  @status
end

#status_categoryString

The item status category. Refer to the lookup table for all the possible values. USPS® [Pub 199](postalpro.usps.com/pub199) Appendix G-4: USPS Domestic Tracking Scan Events and Appendix G-5: Scan Event Codes

  • International Mail

Returns:

  • (String)


227
228
229
# File 'lib/usps_api/models/tracking_information_fields.rb', line 227

def status_category
  @status_category
end

#status_summaryString

The status summary.

Returns:

  • (String)


231
232
233
# File 'lib/usps_api/models/tracking_information_fields.rb', line 231

def status_summary
  @status_summary
end

#table_codeString

USPS internal description of mail piece.

Returns:

  • (String)


235
236
237
# File 'lib/usps_api/models/tracking_information_fields.rb', line 235

def table_code
  @table_code
end

#tracking_eventsArray[TrackingEvent]

The detailed tracking event information for the requested tracking number in reverse chronological order

Returns:



266
267
268
# File 'lib/usps_api/models/tracking_information_fields.rb', line 266

def tracking_events
  @tracking_events
end

#tracking_numberString

The human-readble representation of package barcode data, commonly known as its tracking number

Returns:

  • (String)


16
17
18
# File 'lib/usps_api/models/tracking_information_fields.rb', line 16

def tracking_number
  @tracking_number
end

#tracking_proof_of_delivery_enabledTrueClass | FalseClass

Signifies if Tracking Proof of Delivery service is enabled.

Returns:

  • (TrueClass | FalseClass)


239
240
241
# File 'lib/usps_api/models/tracking_information_fields.rb', line 239

def tracking_proof_of_delivery_enabled
  @tracking_proof_of_delivery_enabled
end

#unique_mail_piece_idString

Unique mail piece ID (mp-suffix) value, unique to each TrackID

Returns:

  • (String)


126
127
128
# File 'lib/usps_api/models/tracking_information_fields.rb', line 126

def unique_mail_piece_id
  @unique_mail_piece_id
end

#unique_tracking_idString

Unique mail piece ID (mp-suffix) value, unique to each TrackID

Returns:

  • (String)


122
123
124
# File 'lib/usps_api/models/tracking_information_fields.rb', line 122

def unique_tracking_id
  @unique_tracking_id
end

#valueof_articleString

The value of article

Returns:

  • (String)


243
244
245
# File 'lib/usps_api/models/tracking_information_fields.rb', line 243

def valueof_article
  @valueof_article
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
# File 'lib/usps_api/models/tracking_information_fields.rb', line 526

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  tracking_number =
    hash.key?('trackingNumber') ? hash['trackingNumber'] : SKIP
  additional_info =
    hash.key?('additionalInfo') ? hash['additionalInfo'] : SKIP
  adp_scripting = hash.key?('ADPScripting') ? hash['ADPScripting'] : SKIP
  archive_restore_info =
    hash.key?('archiveRestoreInfo') ? hash['archiveRestoreInfo'] : SKIP
  associated_label =
    hash.key?('associatedLabel') ? hash['associatedLabel'] : SKIP
  carrier_release =
    hash.key?('carrierRelease') ? hash['carrierRelease'] : SKIP
  mail_class = hash.key?('mailClass') ? hash['mailClass'] : SKIP
  destination_city =
    hash.key?('destinationCity') ? hash['destinationCity'] : SKIP
  destination_country_code =
    hash.key?('destinationCountryCode') ? hash['destinationCountryCode'] : SKIP
  destination_state =
    hash.key?('destinationState') ? hash['destinationState'] : SKIP
  destination_zip =
    hash.key?('destinationZIP') ? hash['destinationZIP'] : SKIP
  edited_label_id =
    hash.key?('editedLabelId') ? hash['editedLabelId'] : SKIP
  email_enabled = hash.key?('emailEnabled') ? hash['emailEnabled'] : SKIP
  end_of_day = hash.key?('endOfDay') ? hash['endOfDay'] : SKIP
  e_sof_eligible = hash.key?('eSOFEligible') ? hash['eSOFEligible'] : SKIP
  expected_delivery_time_stamp = if hash.key?('expectedDeliveryTimeStamp')
                                   (DateTimeHelper.from_rfc3339(hash['expectedDeliveryTimeStamp']) if hash['expectedDeliveryTimeStamp'])
                                 else
                                   SKIP
                                 end
  expected_delivery_type =
    hash.key?('expectedDeliveryType') ? hash['expectedDeliveryType'] : SKIP
  guaranteed_delivery_time_stamp = if hash.key?('guaranteedDeliveryTimeStamp')
                                     (DateTimeHelper.from_rfc3339(hash['guaranteedDeliveryTimeStamp']) if hash['guaranteedDeliveryTimeStamp'])
                                   else
                                     SKIP
                                   end
  guaranteed_details =
    hash.key?('guaranteedDetails') ? hash['guaranteedDetails'] : SKIP
  item_shape = hash.key?('itemShape') ? hash['itemShape'] : SKIP
  kahala_indicator =
    hash.key?('kahalaIndicator') ? hash['kahalaIndicator'] : SKIP
  mail_type = hash.key?('mailType') ? hash['mailType'] : SKIP
  approximate_intake_date =
    hash.key?('approximateIntakeDate') ? hash['approximateIntakeDate'] : SKIP
  mail_piece_intake_date = if hash.key?('mailPieceIntakeDate')
                             (DateTimeHelper.from_rfc3339(hash['mailPieceIntakeDate']) if hash['mailPieceIntakeDate'])
                           else
                             SKIP
                           end
  unique_tracking_id =
    hash.key?('uniqueTrackingId') ? hash['uniqueTrackingId'] : SKIP
  unique_mail_piece_id =
    hash.key?('uniqueMailPieceId') ? hash['uniqueMailPieceId'] : SKIP
  on_time = hash.key?('onTime') ? hash['onTime'] : SKIP
  origin_city = hash.key?('originCity') ? hash['originCity'] : SKIP
  origin_country = hash.key?('originCountry') ? hash['originCountry'] : SKIP
  origin_state = hash.key?('originState') ? hash['originState'] : SKIP
  origin_zip = hash.key?('originZIP') ? hash['originZIP'] : SKIP
  proof_of_delivery_enabled =
    hash.key?('proofOfDeliveryEnabled') ? hash['proofOfDeliveryEnabled'] : SKIP
  predicted_delivery_time_stamp = if hash.key?('predictedDeliveryTimeStamp')
                                    (DateTimeHelper.from_rfc3339(hash['predictedDeliveryTimeStamp']) if hash['predictedDeliveryTimeStamp'])
                                  else
                                    SKIP
                                  end
  predicted_delivery_date =
    hash.key?('predictedDeliveryDate') ? hash['predictedDeliveryDate'] : SKIP
  predicted_delivery_window_start_time =
    hash.key?('predictedDeliveryWindowStartTime') ? hash['predictedDeliveryWindowStartTime'] : SKIP
  predicted_delivery_window_end_time =
    hash.key?('predictedDeliveryWindowEndTime') ? hash['predictedDeliveryWindowEndTime'] : SKIP
  related_return_receipt_id =
    hash.key?('relatedReturnReceiptID') ? hash['relatedReturnReceiptID'] : SKIP
  redelivery_enabled =
    hash.key?('redeliveryEnabled') ? hash['redeliveryEnabled'] : SKIP
  if hash['enabledNotificationRequests']
    enabled_notification_requests = EnabledNotificationRequests.from_hash(hash['enabledNotificationRequests'])
  end
  restore_enabled =
    hash.key?('restoreEnabled') ? hash['restoreEnabled'] : SKIP
  return_date_notice =
    hash.key?('returnDateNotice') ? hash['returnDateNotice'] : SKIP
  rra_menabled = hash.key?('RRAMenabled') ? hash['RRAMenabled'] : SKIP
  rre_enabled = hash.key?('RREEnabled') ? hash['RREEnabled'] : SKIP
  services = hash.key?('services') ? hash['services'] : SKIP
  service_type_code =
    hash.key?('serviceTypeCode') ? hash['serviceTypeCode'] : SKIP
  status = hash.key?('status') ? hash['status'] : SKIP
  status_category =
    hash.key?('statusCategory') ? hash['statusCategory'] : SKIP
  status_summary = hash.key?('statusSummary') ? hash['statusSummary'] : SKIP
  table_code = hash.key?('tableCode') ? hash['tableCode'] : SKIP
  tracking_proof_of_delivery_enabled =
    hash.key?('trackingProofOfDeliveryEnabled') ? hash['trackingProofOfDeliveryEnabled'] : SKIP
  valueof_article =
    hash.key?('valueofArticle') ? hash['valueofArticle'] : SKIP
  access_control = hash.key?('accessControl') ? hash['accessControl'] : SKIP
  extend_retention_purchased_code =
    hash.key?('extendRetentionPurchasedCode') ? hash['extendRetentionPurchasedCode'] : SKIP
  extend_retention_extra_service_code_options =
    hash.key?('extendRetentionExtraServiceCodeOptions') ? hash['extendRetentionExtraServiceCodeOptions'] : SKIP
  # Parameter is an array, so we need to iterate through it
  tracking_events = nil
  unless hash['trackingEvents'].nil?
    tracking_events = []
    hash['trackingEvents'].each do |structure|
      tracking_events << (TrackingEvent.from_hash(structure) if structure)
    end
  end

  tracking_events = SKIP unless hash.key?('trackingEvents')

  # 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.
  TrackingInformationFields.new(tracking_number: tracking_number,
                                additional_info: additional_info,
                                adp_scripting: adp_scripting,
                                archive_restore_info: archive_restore_info,
                                associated_label: associated_label,
                                carrier_release: carrier_release,
                                mail_class: mail_class,
                                destination_city: destination_city,
                                destination_country_code: destination_country_code,
                                destination_state: destination_state,
                                destination_zip: destination_zip,
                                edited_label_id: edited_label_id,
                                email_enabled: email_enabled,
                                end_of_day: end_of_day,
                                e_sof_eligible: e_sof_eligible,
                                expected_delivery_time_stamp: expected_delivery_time_stamp,
                                expected_delivery_type: expected_delivery_type,
                                guaranteed_delivery_time_stamp: guaranteed_delivery_time_stamp,
                                guaranteed_details: guaranteed_details,
                                item_shape: item_shape,
                                kahala_indicator: kahala_indicator,
                                mail_type: mail_type,
                                approximate_intake_date: approximate_intake_date,
                                mail_piece_intake_date: mail_piece_intake_date,
                                unique_tracking_id: unique_tracking_id,
                                unique_mail_piece_id: unique_mail_piece_id,
                                on_time: on_time,
                                origin_city: origin_city,
                                origin_country: origin_country,
                                origin_state: origin_state,
                                origin_zip: origin_zip,
                                proof_of_delivery_enabled: proof_of_delivery_enabled,
                                predicted_delivery_time_stamp: predicted_delivery_time_stamp,
                                predicted_delivery_date: predicted_delivery_date,
                                predicted_delivery_window_start_time: predicted_delivery_window_start_time,
                                predicted_delivery_window_end_time: predicted_delivery_window_end_time,
                                related_return_receipt_id: related_return_receipt_id,
                                redelivery_enabled: redelivery_enabled,
                                enabled_notification_requests: enabled_notification_requests,
                                restore_enabled: restore_enabled,
                                return_date_notice: return_date_notice,
                                rra_menabled: rra_menabled,
                                rre_enabled: rre_enabled,
                                services: services,
                                service_type_code: service_type_code,
                                status: status,
                                status_category: status_category,
                                status_summary: status_summary,
                                table_code: table_code,
                                tracking_proof_of_delivery_enabled: tracking_proof_of_delivery_enabled,
                                valueof_article: valueof_article,
                                access_control: access_control,
                                extend_retention_purchased_code: extend_retention_purchased_code,
                                extend_retention_extra_service_code_options: extend_retention_extra_service_code_options,
                                tracking_events: tracking_events,
                                additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
# File 'lib/usps_api/models/tracking_information_fields.rb', line 269

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['tracking_number'] = 'trackingNumber'
  @_hash['additional_info'] = 'additionalInfo'
  @_hash['adp_scripting'] = 'ADPScripting'
  @_hash['archive_restore_info'] = 'archiveRestoreInfo'
  @_hash['associated_label'] = 'associatedLabel'
  @_hash['carrier_release'] = 'carrierRelease'
  @_hash['mail_class'] = 'mailClass'
  @_hash['destination_city'] = 'destinationCity'
  @_hash['destination_country_code'] = 'destinationCountryCode'
  @_hash['destination_state'] = 'destinationState'
  @_hash['destination_zip'] = 'destinationZIP'
  @_hash['edited_label_id'] = 'editedLabelId'
  @_hash['email_enabled'] = 'emailEnabled'
  @_hash['end_of_day'] = 'endOfDay'
  @_hash['e_sof_eligible'] = 'eSOFEligible'
  @_hash['expected_delivery_time_stamp'] = 'expectedDeliveryTimeStamp'
  @_hash['expected_delivery_type'] = 'expectedDeliveryType'
  @_hash['guaranteed_delivery_time_stamp'] = 'guaranteedDeliveryTimeStamp'
  @_hash['guaranteed_details'] = 'guaranteedDetails'
  @_hash['item_shape'] = 'itemShape'
  @_hash['kahala_indicator'] = 'kahalaIndicator'
  @_hash['mail_type'] = 'mailType'
  @_hash['approximate_intake_date'] = 'approximateIntakeDate'
  @_hash['mail_piece_intake_date'] = 'mailPieceIntakeDate'
  @_hash['unique_tracking_id'] = 'uniqueTrackingId'
  @_hash['unique_mail_piece_id'] = 'uniqueMailPieceId'
  @_hash['on_time'] = 'onTime'
  @_hash['origin_city'] = 'originCity'
  @_hash['origin_country'] = 'originCountry'
  @_hash['origin_state'] = 'originState'
  @_hash['origin_zip'] = 'originZIP'
  @_hash['proof_of_delivery_enabled'] = 'proofOfDeliveryEnabled'
  @_hash['predicted_delivery_time_stamp'] = 'predictedDeliveryTimeStamp'
  @_hash['predicted_delivery_date'] = 'predictedDeliveryDate'
  @_hash['predicted_delivery_window_start_time'] =
    'predictedDeliveryWindowStartTime'
  @_hash['predicted_delivery_window_end_time'] =
    'predictedDeliveryWindowEndTime'
  @_hash['related_return_receipt_id'] = 'relatedReturnReceiptID'
  @_hash['redelivery_enabled'] = 'redeliveryEnabled'
  @_hash['enabled_notification_requests'] = 'enabledNotificationRequests'
  @_hash['restore_enabled'] = 'restoreEnabled'
  @_hash['return_date_notice'] = 'returnDateNotice'
  @_hash['rra_menabled'] = 'RRAMenabled'
  @_hash['rre_enabled'] = 'RREEnabled'
  @_hash['services'] = 'services'
  @_hash['service_type_code'] = 'serviceTypeCode'
  @_hash['status'] = 'status'
  @_hash['status_category'] = 'statusCategory'
  @_hash['status_summary'] = 'statusSummary'
  @_hash['table_code'] = 'tableCode'
  @_hash['tracking_proof_of_delivery_enabled'] =
    'trackingProofOfDeliveryEnabled'
  @_hash['valueof_article'] = 'valueofArticle'
  @_hash['access_control'] = 'accessControl'
  @_hash['extend_retention_purchased_code'] =
    'extendRetentionPurchasedCode'
  @_hash['extend_retention_extra_service_code_options'] =
    'extendRetentionExtraServiceCodeOptions'
  @_hash['tracking_events'] = 'trackingEvents'
  @_hash
end

.nullablesObject

An array for nullable fields



396
397
398
# File 'lib/usps_api/models/tracking_information_fields.rb', line 396

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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
361
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
390
391
392
393
# File 'lib/usps_api/models/tracking_information_fields.rb', line 335

def self.optionals
  %w[
    tracking_number
    additional_info
    adp_scripting
    archive_restore_info
    associated_label
    carrier_release
    mail_class
    destination_city
    destination_country_code
    destination_state
    destination_zip
    edited_label_id
    email_enabled
    end_of_day
    e_sof_eligible
    expected_delivery_time_stamp
    expected_delivery_type
    guaranteed_delivery_time_stamp
    guaranteed_details
    item_shape
    kahala_indicator
    mail_type
    approximate_intake_date
    mail_piece_intake_date
    unique_tracking_id
    unique_mail_piece_id
    on_time
    origin_city
    origin_country
    origin_state
    origin_zip
    proof_of_delivery_enabled
    predicted_delivery_time_stamp
    predicted_delivery_date
    predicted_delivery_window_start_time
    predicted_delivery_window_end_time
    related_return_receipt_id
    redelivery_enabled
    enabled_notification_requests
    restore_enabled
    return_date_notice
    rra_menabled
    rre_enabled
    services
    service_type_code
    status
    status_category
    status_summary
    table_code
    tracking_proof_of_delivery_enabled
    valueof_article
    access_control
    extend_retention_purchased_code
    extend_retention_extra_service_code_options
    tracking_events
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



727
728
729
730
731
732
733
# File 'lib/usps_api/models/tracking_information_fields.rb', line 727

def self.validate(value)
  return true if value.instance_of? self

  return false unless value.instance_of? Hash

  true
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
# File 'lib/usps_api/models/tracking_information_fields.rb', line 773

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} tracking_number: #{@tracking_number.inspect}, additional_info:"\
  " #{@additional_info.inspect}, adp_scripting: #{@adp_scripting.inspect},"\
  " archive_restore_info: #{@archive_restore_info.inspect}, associated_label:"\
  " #{@associated_label.inspect}, carrier_release: #{@carrier_release.inspect}, mail_class:"\
  " #{@mail_class.inspect}, destination_city: #{@destination_city.inspect},"\
  " destination_country_code: #{@destination_country_code.inspect}, destination_state:"\
  " #{@destination_state.inspect}, destination_zip: #{@destination_zip.inspect},"\
  " edited_label_id: #{@edited_label_id.inspect}, email_enabled: #{@email_enabled.inspect},"\
  " end_of_day: #{@end_of_day.inspect}, e_sof_eligible: #{@e_sof_eligible.inspect},"\
  " expected_delivery_time_stamp: #{@expected_delivery_time_stamp.inspect},"\
  " expected_delivery_type: #{@expected_delivery_type.inspect},"\
  " guaranteed_delivery_time_stamp: #{@guaranteed_delivery_time_stamp.inspect},"\
  " guaranteed_details: #{@guaranteed_details.inspect}, item_shape: #{@item_shape.inspect},"\
  " kahala_indicator: #{@kahala_indicator.inspect}, mail_type: #{@mail_type.inspect},"\
  " approximate_intake_date: #{@approximate_intake_date.inspect}, mail_piece_intake_date:"\
  " #{@mail_piece_intake_date.inspect}, unique_tracking_id: #{@unique_tracking_id.inspect},"\
  " unique_mail_piece_id: #{@unique_mail_piece_id.inspect}, on_time: #{@on_time.inspect},"\
  " origin_city: #{@origin_city.inspect}, origin_country: #{@origin_country.inspect},"\
  " origin_state: #{@origin_state.inspect}, origin_zip: #{@origin_zip.inspect},"\
  " proof_of_delivery_enabled: #{@proof_of_delivery_enabled.inspect},"\
  " predicted_delivery_time_stamp: #{@predicted_delivery_time_stamp.inspect},"\
  " predicted_delivery_date: #{@predicted_delivery_date.inspect},"\
  " predicted_delivery_window_start_time: #{@predicted_delivery_window_start_time.inspect},"\
  " predicted_delivery_window_end_time: #{@predicted_delivery_window_end_time.inspect},"\
  " related_return_receipt_id: #{@related_return_receipt_id.inspect}, redelivery_enabled:"\
  " #{@redelivery_enabled.inspect}, enabled_notification_requests:"\
  " #{@enabled_notification_requests.inspect}, restore_enabled: #{@restore_enabled.inspect},"\
  " return_date_notice: #{@return_date_notice.inspect}, rra_menabled:"\
  " #{@rra_menabled.inspect}, rre_enabled: #{@rre_enabled.inspect}, services:"\
  " #{@services.inspect}, service_type_code: #{@service_type_code.inspect}, status:"\
  " #{@status.inspect}, status_category: #{@status_category.inspect}, status_summary:"\
  " #{@status_summary.inspect}, table_code: #{@table_code.inspect},"\
  " tracking_proof_of_delivery_enabled: #{@tracking_proof_of_delivery_enabled.inspect},"\
  " valueof_article: #{@valueof_article.inspect}, access_control: #{@access_control.inspect},"\
  " extend_retention_purchased_code: #{@extend_retention_purchased_code.inspect},"\
  ' extend_retention_extra_service_code_options:'\
  " #{@extend_retention_extra_service_code_options.inspect}, tracking_events:"\
  " #{@tracking_events.inspect}, additional_properties: #{@additional_properties}>"
end

#to_custom_expected_delivery_time_stampObject



709
710
711
# File 'lib/usps_api/models/tracking_information_fields.rb', line 709

def to_custom_expected_delivery_time_stamp
  DateTimeHelper.to_rfc3339(expected_delivery_time_stamp)
end

#to_custom_guaranteed_delivery_time_stampObject



713
714
715
# File 'lib/usps_api/models/tracking_information_fields.rb', line 713

def to_custom_guaranteed_delivery_time_stamp
  DateTimeHelper.to_rfc3339(guaranteed_delivery_time_stamp)
end

#to_custom_mail_piece_intake_dateObject



717
718
719
# File 'lib/usps_api/models/tracking_information_fields.rb', line 717

def to_custom_mail_piece_intake_date
  DateTimeHelper.to_rfc3339(mail_piece_intake_date)
end

#to_custom_predicted_delivery_time_stampObject



721
722
723
# File 'lib/usps_api/models/tracking_information_fields.rb', line 721

def to_custom_predicted_delivery_time_stamp
  DateTimeHelper.to_rfc3339(predicted_delivery_time_stamp)
end

#to_sObject

Provides a human-readable string representation of the object.



736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
# File 'lib/usps_api/models/tracking_information_fields.rb', line 736

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} tracking_number: #{@tracking_number}, additional_info: #{@additional_info},"\
  " adp_scripting: #{@adp_scripting}, archive_restore_info: #{@archive_restore_info},"\
  " associated_label: #{@associated_label}, carrier_release: #{@carrier_release}, mail_class:"\
  " #{@mail_class}, destination_city: #{@destination_city}, destination_country_code:"\
  " #{@destination_country_code}, destination_state: #{@destination_state}, destination_zip:"\
  " #{@destination_zip}, edited_label_id: #{@edited_label_id}, email_enabled:"\
  " #{@email_enabled}, end_of_day: #{@end_of_day}, e_sof_eligible: #{@e_sof_eligible},"\
  " expected_delivery_time_stamp: #{@expected_delivery_time_stamp}, expected_delivery_type:"\
  " #{@expected_delivery_type}, guaranteed_delivery_time_stamp:"\
  " #{@guaranteed_delivery_time_stamp}, guaranteed_details: #{@guaranteed_details},"\
  " item_shape: #{@item_shape}, kahala_indicator: #{@kahala_indicator}, mail_type:"\
  " #{@mail_type}, approximate_intake_date: #{@approximate_intake_date},"\
  " mail_piece_intake_date: #{@mail_piece_intake_date}, unique_tracking_id:"\
  " #{@unique_tracking_id}, unique_mail_piece_id: #{@unique_mail_piece_id}, on_time:"\
  " #{@on_time}, origin_city: #{@origin_city}, origin_country: #{@origin_country},"\
  " origin_state: #{@origin_state}, origin_zip: #{@origin_zip}, proof_of_delivery_enabled:"\
  " #{@proof_of_delivery_enabled}, predicted_delivery_time_stamp:"\
  " #{@predicted_delivery_time_stamp}, predicted_delivery_date: #{@predicted_delivery_date},"\
  " predicted_delivery_window_start_time: #{@predicted_delivery_window_start_time},"\
  " predicted_delivery_window_end_time: #{@predicted_delivery_window_end_time},"\
  " related_return_receipt_id: #{@related_return_receipt_id}, redelivery_enabled:"\
  " #{@redelivery_enabled}, enabled_notification_requests: #{@enabled_notification_requests},"\
  " restore_enabled: #{@restore_enabled}, return_date_notice: #{@return_date_notice},"\
  " rra_menabled: #{@rra_menabled}, rre_enabled: #{@rre_enabled}, services: #{@services},"\
  " service_type_code: #{@service_type_code}, status: #{@status}, status_category:"\
  " #{@status_category}, status_summary: #{@status_summary}, table_code: #{@table_code},"\
  " tracking_proof_of_delivery_enabled: #{@tracking_proof_of_delivery_enabled},"\
  " valueof_article: #{@valueof_article}, access_control: #{@access_control},"\
  " extend_retention_purchased_code: #{@extend_retention_purchased_code},"\
  ' extend_retention_extra_service_code_options:'\
  " #{@extend_retention_extra_service_code_options}, tracking_events: #{@tracking_events},"\
  " additional_properties: #{@additional_properties}>"
end