Class: UspsApi::TrackingNotificationRequest
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- UspsApi::TrackingNotificationRequest
- Defined in:
- lib/usps_api/models/tracking_notification_request.rb
Overview
Alows the customer to submit their e-mail address to be notified of current or future tracking activity.
Instance Attribute Summary collapse
-
#approximate_intake_date ⇒ DateTime
The ApproximateIntakeDate is the approximateIntakeDate value located in Track/Confirm Fields API response data.
-
#first_name ⇒ String
The notification recipient’s given name.
-
#last_name ⇒ String
The notification recipient’s family name.
-
#mail_piece_intake_date ⇒ DateTime
The mailPieceIntakeDate is the mailPieceIntakeDate value located in Track/Confirm Fields API response data.
-
#notifications ⇒ Array[Object]
Upto 3 Email addresses that notifications are to be sent.
-
#notify_event_types ⇒ Array[MailingEventType]
Identifies the types of mailing events to be notified about.
-
#unique_mail_piece_id ⇒ String
The uniqueMailPieceID is the uniqueMailPieceId value located in Track/Confirm Fields API response data.
-
#unique_tracking_id ⇒ String
The UniqueTrackingID is the uniqueTrackingId value located in Track/Confirm Fields API response data.
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(notifications:, unique_tracking_id: SKIP, unique_mail_piece_id: SKIP, approximate_intake_date: SKIP, mail_piece_intake_date: SKIP, notify_event_types: SKIP, first_name: SKIP, last_name: SKIP) ⇒ TrackingNotificationRequest
constructor
A new instance of TrackingNotificationRequest.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_approximate_intake_date ⇒ Object
- #to_custom_mail_piece_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(notifications:, unique_tracking_id: SKIP, unique_mail_piece_id: SKIP, approximate_intake_date: SKIP, mail_piece_intake_date: SKIP, notify_event_types: SKIP, first_name: SKIP, last_name: SKIP) ⇒ TrackingNotificationRequest
Returns a new instance of TrackingNotificationRequest.
90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/usps_api/models/tracking_notification_request.rb', line 90 def initialize(notifications:, unique_tracking_id: SKIP, unique_mail_piece_id: SKIP, approximate_intake_date: SKIP, mail_piece_intake_date: SKIP, notify_event_types: SKIP, first_name: SKIP, last_name: 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 @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 @notify_event_types = notify_event_types unless notify_event_types == SKIP @first_name = first_name unless first_name == SKIP @last_name = last_name unless last_name == SKIP @notifications = notifications end |
Instance Attribute Details
#approximate_intake_date ⇒ DateTime
The ApproximateIntakeDate is the approximateIntakeDate value located in Track/Confirm Fields API response data. Unique to each TrackId. Internal systems values extracted from the package tracking details.
32 33 34 |
# File 'lib/usps_api/models/tracking_notification_request.rb', line 32 def approximate_intake_date @approximate_intake_date end |
#first_name ⇒ String
The notification recipient’s given name.
48 49 50 |
# File 'lib/usps_api/models/tracking_notification_request.rb', line 48 def first_name @first_name end |
#last_name ⇒ String
The notification recipient’s family name.
52 53 54 |
# File 'lib/usps_api/models/tracking_notification_request.rb', line 52 def last_name @last_name end |
#mail_piece_intake_date ⇒ DateTime
The mailPieceIntakeDate is the mailPieceIntakeDate value located in Track/Confirm Fields API response data. Unique to each TrackId. The ‘expand’ field in the original tracking request must be set to “DETAIL” in order to display this value. Internal systems values extracted from the package tracking details.
40 41 42 |
# File 'lib/usps_api/models/tracking_notification_request.rb', line 40 def mail_piece_intake_date @mail_piece_intake_date end |
#notifications ⇒ Array[Object]
Upto 3 Email addresses that notifications are to be sent.
56 57 58 |
# File 'lib/usps_api/models/tracking_notification_request.rb', line 56 def notifications @notifications end |
#notify_event_types ⇒ Array[MailingEventType]
Identifies the types of mailing events to be notified about.
44 45 46 |
# File 'lib/usps_api/models/tracking_notification_request.rb', line 44 def notify_event_types @notify_event_types end |
#unique_mail_piece_id ⇒ String
The uniqueMailPieceID is the uniqueMailPieceId value located in Track/Confirm Fields API response data. Unique to each TrackID. The ‘expand’ field in the original tracking request must be set to “DETAIL” in order to display this value. Internal systems values extracted from the package tracking details.
26 27 28 |
# File 'lib/usps_api/models/tracking_notification_request.rb', line 26 def unique_mail_piece_id @unique_mail_piece_id end |
#unique_tracking_id ⇒ String
The UniqueTrackingID is the uniqueTrackingId value located in Track/Confirm Fields API response data. Unique to each TrackID. Internal systems values extracted from the package tracking details.
18 19 20 |
# File 'lib/usps_api/models/tracking_notification_request.rb', line 18 def unique_tracking_id @unique_tracking_id end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
# File 'lib/usps_api/models/tracking_notification_request.rb', line 105 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. notifications = hash.key?('notifications') ? APIHelper.deserialize_union_type( UnionTypeLookUp.get(:TrackingNotificationRequestNotifications), hash['notifications'] ) : nil unique_tracking_id = hash.key?('uniqueTrackingId') ? hash['uniqueTrackingId'] : SKIP unique_mail_piece_id = hash.key?('uniqueMailPieceId') ? hash['uniqueMailPieceId'] : SKIP approximate_intake_date = if hash.key?('approximateIntakeDate') (DateTimeHelper.from_rfc3339(hash['approximateIntakeDate']) if hash['approximateIntakeDate']) else SKIP end mail_piece_intake_date = if hash.key?('mailPieceIntakeDate') (DateTimeHelper.from_rfc3339(hash['mailPieceIntakeDate']) if hash['mailPieceIntakeDate']) else SKIP end notify_event_types = hash.key?('notifyEventTypes') ? hash['notifyEventTypes'] : SKIP first_name = hash.key?('firstName') ? hash['firstName'] : SKIP last_name = hash.key?('lastName') ? hash['lastName'] : SKIP # Create object from extracted values. TrackingNotificationRequest.new(notifications: notifications, 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, notify_event_types: notify_event_types, first_name: first_name, last_name: last_name) end |
.names ⇒ Object
A mapping from model property names to API property names.
59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/usps_api/models/tracking_notification_request.rb', line 59 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['notify_event_types'] = 'notifyEventTypes' @_hash['first_name'] = 'firstName' @_hash['last_name'] = 'lastName' @_hash['notifications'] = 'notifications' @_hash end |
.nullables ⇒ Object
An array for nullable fields
86 87 88 |
# File 'lib/usps_api/models/tracking_notification_request.rb', line 86 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/usps_api/models/tracking_notification_request.rb', line 73 def self.optionals %w[ unique_tracking_id unique_mail_piece_id approximate_intake_date mail_piece_intake_date notify_event_types first_name last_name ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
152 153 154 155 156 157 158 159 160 161 162 |
# File 'lib/usps_api/models/tracking_notification_request.rb', line 152 def self.validate(value) if value.instance_of? self return UnionTypeLookUp.get(:TrackingNotificationRequestNotifications) .validate(value.notifications) end return false unless value.instance_of? Hash UnionTypeLookUp.get(:TrackingNotificationRequestNotifications) .validate(value['notifications']) end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
175 176 177 178 179 180 181 182 183 |
# File 'lib/usps_api/models/tracking_notification_request.rb', line 175 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}, notify_event_types: #{@notify_event_types.inspect},"\ " first_name: #{@first_name.inspect}, last_name: #{@last_name.inspect}, notifications:"\ " #{@notifications.inspect}>" end |
#to_custom_approximate_intake_date ⇒ Object
142 143 144 |
# File 'lib/usps_api/models/tracking_notification_request.rb', line 142 def to_custom_approximate_intake_date DateTimeHelper.to_rfc3339(approximate_intake_date) end |
#to_custom_mail_piece_intake_date ⇒ Object
146 147 148 |
# File 'lib/usps_api/models/tracking_notification_request.rb', line 146 def to_custom_mail_piece_intake_date DateTimeHelper.to_rfc3339(mail_piece_intake_date) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
165 166 167 168 169 170 171 172 |
# File 'lib/usps_api/models/tracking_notification_request.rb', line 165 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}, notify_event_types:"\ " #{@notify_event_types}, first_name: #{@first_name}, last_name: #{@last_name},"\ " notifications: #{@notifications}>" end |