Class: UspsApi::SlotAvailability
- Defined in:
- lib/usps_api/models/slot_availability.rb
Overview
Request object for checking on slot availability
Instance Attribute Summary collapse
-
#apply_tiers ⇒ ApplyTiers
The applyTiers used for the search.
-
#appointment_end_date ⇒ DateTime
The end date of the date range of the query.
-
#appointment_start_date ⇒ DateTime
The start date of the date range of the query.
-
#appointment_type ⇒ AppointmentType1
The type of appointment.
-
#appt_time ⇒ String
Appointment time if on recurring appt selection path.
-
#appt_tracking_id ⇒ String
ShipperApptRequestID in xml, CustomerSequenceId on one time and recurring selection paths.
-
#comments ⇒ String
Comments if on recurring appt selection path.
-
#consignee_facility ⇒ ConsigneeFacility1
Consignee Facility details.
-
#day_frequency ⇒ DayFrequency
Appointment daily frequency if on recurring appt selection path.
-
#destination_entry ⇒ DestinationEntry
Dropship is YES.
-
#detail_info ⇒ DetailInfo1
Details of the appointment for the availability request.
-
#dropship_key ⇒ String
The dropship key for the appointment.
-
#mail_class ⇒ MailClass1
1 FIRST CLASS MAIL, 2 PERIODICALS, 3 USPS MARKETING MAIL (PREVIOUSLY STANDARD MAIL), 4 PACKAGE SERVICES, 6 PARCEL SELECT, 7 PRIORITY MAIL.
-
#one_time_appt ⇒ TrueClass | FalseClass
Determine query path for the search.
-
#perishable_ind ⇒ TrueClass | FalseClass
Is it perishable.
-
#preferred_appt ⇒ DateTime
Preferred appointment if on one time appt selection path.
-
#recurring_appt ⇒ TrueClass | FalseClass
Determine query path for the search.
-
#scheduler_content_id ⇒ String
value set in recurring appt selection path.
-
#scheduler_corp_id ⇒ String
Unique ID of the corporation generated by PostalOne!.
-
#scheduler_crid ⇒ String
CRID assigned to Scheduler of FAST Appointment.
-
#scheduler_id ⇒ String
Unique ID for mailer scheduler.
-
#shipper_appt_request_id ⇒ String
value set in recurring appt selection path.
-
#shipper_multi_stop_id ⇒ String
value set in one time appt selection path.
-
#trailer_info ⇒ TrailerInfo1
Information about the trailer for the appointment.
-
#user_crid ⇒ String
CRID of the user.
-
#week_frequency ⇒ WeekFrequency
Appointment weekly frequency if on recurring appt selection path.
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(mail_class:, dropship_key:, destination_entry:, consignee_facility:, detail_info:, one_time_appt: SKIP, recurring_appt: SKIP, appointment_type: SKIP, appointment_start_date: SKIP, appointment_end_date: SKIP, apply_tiers: SKIP, perishable_ind: SKIP, user_crid: SKIP, scheduler_id: SKIP, scheduler_corp_id: SKIP, scheduler_crid: SKIP, preferred_appt: SKIP, appt_time: SKIP, day_frequency: SKIP, week_frequency: SKIP, appt_tracking_id: SKIP, comments: SKIP, scheduler_content_id: SKIP, shipper_appt_request_id: SKIP, shipper_multi_stop_id: SKIP, trailer_info: SKIP, additional_properties: nil) ⇒ SlotAvailability
constructor
A new instance of SlotAvailability.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_appointment_end_date ⇒ Object
- #to_custom_appointment_start_date ⇒ Object
- #to_custom_preferred_appt ⇒ 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(mail_class:, dropship_key:, destination_entry:, consignee_facility:, detail_info:, one_time_appt: SKIP, recurring_appt: SKIP, appointment_type: SKIP, appointment_start_date: SKIP, appointment_end_date: SKIP, apply_tiers: SKIP, perishable_ind: SKIP, user_crid: SKIP, scheduler_id: SKIP, scheduler_corp_id: SKIP, scheduler_crid: SKIP, preferred_appt: SKIP, appt_time: SKIP, day_frequency: SKIP, week_frequency: SKIP, appt_tracking_id: SKIP, comments: SKIP, scheduler_content_id: SKIP, shipper_appt_request_id: SKIP, shipper_multi_stop_id: SKIP, trailer_info: SKIP, additional_properties: nil) ⇒ SlotAvailability
Returns a new instance of SlotAvailability.
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 |
# File 'lib/usps_api/models/slot_availability.rb', line 189 def initialize(mail_class:, dropship_key:, destination_entry:, consignee_facility:, detail_info:, one_time_appt: SKIP, recurring_appt: SKIP, appointment_type: SKIP, appointment_start_date: SKIP, appointment_end_date: SKIP, apply_tiers: SKIP, perishable_ind: SKIP, user_crid: SKIP, scheduler_id: SKIP, scheduler_corp_id: SKIP, scheduler_crid: SKIP, preferred_appt: SKIP, appt_time: SKIP, day_frequency: SKIP, week_frequency: SKIP, appt_tracking_id: SKIP, comments: SKIP, scheduler_content_id: SKIP, shipper_appt_request_id: SKIP, shipper_multi_stop_id: SKIP, trailer_info: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @one_time_appt = one_time_appt unless one_time_appt == SKIP @recurring_appt = recurring_appt unless recurring_appt == SKIP @mail_class = mail_class @dropship_key = dropship_key @appointment_type = appointment_type unless appointment_type == SKIP @appointment_start_date = appointment_start_date unless appointment_start_date == SKIP @appointment_end_date = appointment_end_date unless appointment_end_date == SKIP @destination_entry = destination_entry @apply_tiers = apply_tiers unless apply_tiers == SKIP @perishable_ind = perishable_ind unless perishable_ind == SKIP @user_crid = user_crid unless user_crid == SKIP @scheduler_id = scheduler_id unless scheduler_id == SKIP @scheduler_corp_id = scheduler_corp_id unless scheduler_corp_id == SKIP @scheduler_crid = scheduler_crid unless scheduler_crid == SKIP @consignee_facility = consignee_facility @detail_info = detail_info @preferred_appt = preferred_appt unless preferred_appt == SKIP @appt_time = appt_time unless appt_time == SKIP @day_frequency = day_frequency unless day_frequency == SKIP @week_frequency = week_frequency unless week_frequency == SKIP @appt_tracking_id = appt_tracking_id unless appt_tracking_id == SKIP @comments = comments unless comments == SKIP @scheduler_content_id = scheduler_content_id unless scheduler_content_id == SKIP @shipper_appt_request_id = shipper_appt_request_id unless shipper_appt_request_id == SKIP @shipper_multi_stop_id = shipper_multi_stop_id unless shipper_multi_stop_id == SKIP @trailer_info = trailer_info unless trailer_info == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#apply_tiers ⇒ ApplyTiers
The applyTiers used for the search. YES or NO
54 55 56 |
# File 'lib/usps_api/models/slot_availability.rb', line 54 def apply_tiers @apply_tiers end |
#appointment_end_date ⇒ DateTime
The end date of the date range of the query. Maximum of 21 days in the future. Required for recurring appointments.
46 47 48 |
# File 'lib/usps_api/models/slot_availability.rb', line 46 def appointment_end_date @appointment_end_date end |
#appointment_start_date ⇒ DateTime
The start date of the date range of the query. Cannot be in the past. Required for recurring appointments.
40 41 42 |
# File 'lib/usps_api/models/slot_availability.rb', line 40 def appointment_start_date @appointment_start_date end |
#appointment_type ⇒ AppointmentType1
The type of appointment. PALLET = 1, BEDLOAD = 2, DROP_AND_PICK = 3, SPEEDLINE = 4
35 36 37 |
# File 'lib/usps_api/models/slot_availability.rb', line 35 def appointment_type @appointment_type end |
#appt_time ⇒ String
Appointment time if on recurring appt selection path
90 91 92 |
# File 'lib/usps_api/models/slot_availability.rb', line 90 def appt_time @appt_time end |
#appt_tracking_id ⇒ String
ShipperApptRequestID in xml, CustomerSequenceId on one time and recurring selection paths
103 104 105 |
# File 'lib/usps_api/models/slot_availability.rb', line 103 def appt_tracking_id @appt_tracking_id end |
#comments ⇒ String
Comments if on recurring appt selection path
107 108 109 |
# File 'lib/usps_api/models/slot_availability.rb', line 107 def comments @comments end |
#consignee_facility ⇒ ConsigneeFacility1
Consignee Facility details.
78 79 80 |
# File 'lib/usps_api/models/slot_availability.rb', line 78 def consignee_facility @consignee_facility end |
#day_frequency ⇒ DayFrequency
Appointment daily frequency if on recurring appt selection path
94 95 96 |
# File 'lib/usps_api/models/slot_availability.rb', line 94 def day_frequency @day_frequency end |
#destination_entry ⇒ DestinationEntry
Dropship is YES. Origin Entry is NO.
50 51 52 |
# File 'lib/usps_api/models/slot_availability.rb', line 50 def destination_entry @destination_entry end |
#detail_info ⇒ DetailInfo1
Details of the appointment for the availability request.
82 83 84 |
# File 'lib/usps_api/models/slot_availability.rb', line 82 def detail_info @detail_info end |
#dropship_key ⇒ String
The dropship key for the appointment.
30 31 32 |
# File 'lib/usps_api/models/slot_availability.rb', line 30 def dropship_key @dropship_key end |
#mail_class ⇒ MailClass1
1 FIRST CLASS MAIL, 2 PERIODICALS, 3 USPS MARKETING MAIL (PREVIOUSLY STANDARD MAIL), 4 PACKAGE SERVICES, 6 PARCEL SELECT, 7 PRIORITY MAIL
26 27 28 |
# File 'lib/usps_api/models/slot_availability.rb', line 26 def mail_class @mail_class end |
#one_time_appt ⇒ TrueClass | FalseClass
Determine query path for the search. Either oneTimeAppt or recurringAppt must be set to true.
16 17 18 |
# File 'lib/usps_api/models/slot_availability.rb', line 16 def one_time_appt @one_time_appt end |
#perishable_ind ⇒ TrueClass | FalseClass
Is it perishable
58 59 60 |
# File 'lib/usps_api/models/slot_availability.rb', line 58 def perishable_ind @perishable_ind end |
#preferred_appt ⇒ DateTime
Preferred appointment if on one time appt selection path
86 87 88 |
# File 'lib/usps_api/models/slot_availability.rb', line 86 def preferred_appt @preferred_appt end |
#recurring_appt ⇒ TrueClass | FalseClass
Determine query path for the search. Either oneTimeAppt or recurringAppt must be set to true.
21 22 23 |
# File 'lib/usps_api/models/slot_availability.rb', line 21 def recurring_appt @recurring_appt end |
#scheduler_content_id ⇒ String
value set in recurring appt selection path
111 112 113 |
# File 'lib/usps_api/models/slot_availability.rb', line 111 def scheduler_content_id @scheduler_content_id end |
#scheduler_corp_id ⇒ String
Unique ID of the corporation generated by PostalOne!
70 71 72 |
# File 'lib/usps_api/models/slot_availability.rb', line 70 def scheduler_corp_id @scheduler_corp_id end |
#scheduler_crid ⇒ String
CRID assigned to Scheduler of FAST Appointment
74 75 76 |
# File 'lib/usps_api/models/slot_availability.rb', line 74 def scheduler_crid @scheduler_crid end |
#scheduler_id ⇒ String
Unique ID for mailer scheduler
66 67 68 |
# File 'lib/usps_api/models/slot_availability.rb', line 66 def scheduler_id @scheduler_id end |
#shipper_appt_request_id ⇒ String
value set in recurring appt selection path
115 116 117 |
# File 'lib/usps_api/models/slot_availability.rb', line 115 def shipper_appt_request_id @shipper_appt_request_id end |
#shipper_multi_stop_id ⇒ String
value set in one time appt selection path
119 120 121 |
# File 'lib/usps_api/models/slot_availability.rb', line 119 def shipper_multi_stop_id @shipper_multi_stop_id end |
#trailer_info ⇒ TrailerInfo1
Information about the trailer for the appointment.
123 124 125 |
# File 'lib/usps_api/models/slot_availability.rb', line 123 def trailer_info @trailer_info end |
#user_crid ⇒ String
CRID of the user
62 63 64 |
# File 'lib/usps_api/models/slot_availability.rb', line 62 def user_crid @user_crid end |
#week_frequency ⇒ WeekFrequency
Appointment weekly frequency if on recurring appt selection path
98 99 100 |
# File 'lib/usps_api/models/slot_availability.rb', line 98 def week_frequency @week_frequency end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 261 262 263 264 265 266 267 268 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 |
# File 'lib/usps_api/models/slot_availability.rb', line 234 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. mail_class = hash.key?('mailClass') ? hash['mailClass'] : nil dropship_key = hash.key?('dropshipKey') ? hash['dropshipKey'] : nil destination_entry = hash.key?('destinationEntry') ? hash['destinationEntry'] : nil consignee_facility = ConsigneeFacility1.from_hash(hash['consigneeFacility']) if hash['consigneeFacility'] detail_info = DetailInfo1.from_hash(hash['detailInfo']) if hash['detailInfo'] one_time_appt = hash.key?('oneTimeAppt') ? hash['oneTimeAppt'] : SKIP recurring_appt = hash.key?('recurringAppt') ? hash['recurringAppt'] : SKIP appointment_type = hash.key?('appointmentType') ? hash['appointmentType'] : SKIP appointment_start_date = if hash.key?('appointmentStartDate') (DateTimeHelper.from_rfc3339(hash['appointmentStartDate']) if hash['appointmentStartDate']) else SKIP end appointment_end_date = if hash.key?('appointmentEndDate') (DateTimeHelper.from_rfc3339(hash['appointmentEndDate']) if hash['appointmentEndDate']) else SKIP end apply_tiers = hash.key?('applyTiers') ? hash['applyTiers'] : SKIP perishable_ind = hash.key?('perishableInd') ? hash['perishableInd'] : SKIP user_crid = hash.key?('userCRID') ? hash['userCRID'] : SKIP scheduler_id = hash.key?('schedulerID') ? hash['schedulerID'] : SKIP scheduler_corp_id = hash.key?('schedulerCorpID') ? hash['schedulerCorpID'] : SKIP scheduler_crid = hash.key?('schedulerCRID') ? hash['schedulerCRID'] : SKIP preferred_appt = if hash.key?('preferredAppt') (DateTimeHelper.from_rfc3339(hash['preferredAppt']) if hash['preferredAppt']) else SKIP end appt_time = hash.key?('apptTime') ? hash['apptTime'] : SKIP day_frequency = hash.key?('dayFrequency') ? hash['dayFrequency'] : SKIP week_frequency = hash.key?('weekFrequency') ? hash['weekFrequency'] : SKIP appt_tracking_id = hash.key?('apptTrackingID') ? hash['apptTrackingID'] : SKIP comments = hash.key?('comments') ? hash['comments'] : SKIP scheduler_content_id = hash.key?('schedulerContentID') ? hash['schedulerContentID'] : SKIP shipper_appt_request_id = hash.key?('shipperApptRequestID') ? hash['shipperApptRequestID'] : SKIP shipper_multi_stop_id = hash.key?('shipperMultiStopID') ? hash['shipperMultiStopID'] : SKIP trailer_info = TrailerInfo1.from_hash(hash['trailerInfo']) if hash['trailerInfo'] # 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. SlotAvailability.new(mail_class: mail_class, dropship_key: dropship_key, destination_entry: destination_entry, consignee_facility: consignee_facility, detail_info: detail_info, one_time_appt: one_time_appt, recurring_appt: recurring_appt, appointment_type: appointment_type, appointment_start_date: appointment_start_date, appointment_end_date: appointment_end_date, apply_tiers: apply_tiers, perishable_ind: perishable_ind, user_crid: user_crid, scheduler_id: scheduler_id, scheduler_corp_id: scheduler_corp_id, scheduler_crid: scheduler_crid, preferred_appt: preferred_appt, appt_time: appt_time, day_frequency: day_frequency, week_frequency: week_frequency, appt_tracking_id: appt_tracking_id, comments: comments, scheduler_content_id: scheduler_content_id, shipper_appt_request_id: shipper_appt_request_id, shipper_multi_stop_id: shipper_multi_stop_id, trailer_info: trailer_info, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
# File 'lib/usps_api/models/slot_availability.rb', line 126 def self.names @_hash = {} if @_hash.nil? @_hash['one_time_appt'] = 'oneTimeAppt' @_hash['recurring_appt'] = 'recurringAppt' @_hash['mail_class'] = 'mailClass' @_hash['dropship_key'] = 'dropshipKey' @_hash['appointment_type'] = 'appointmentType' @_hash['appointment_start_date'] = 'appointmentStartDate' @_hash['appointment_end_date'] = 'appointmentEndDate' @_hash['destination_entry'] = 'destinationEntry' @_hash['apply_tiers'] = 'applyTiers' @_hash['perishable_ind'] = 'perishableInd' @_hash['user_crid'] = 'userCRID' @_hash['scheduler_id'] = 'schedulerID' @_hash['scheduler_corp_id'] = 'schedulerCorpID' @_hash['scheduler_crid'] = 'schedulerCRID' @_hash['consignee_facility'] = 'consigneeFacility' @_hash['detail_info'] = 'detailInfo' @_hash['preferred_appt'] = 'preferredAppt' @_hash['appt_time'] = 'apptTime' @_hash['day_frequency'] = 'dayFrequency' @_hash['week_frequency'] = 'weekFrequency' @_hash['appt_tracking_id'] = 'apptTrackingID' @_hash['comments'] = 'comments' @_hash['scheduler_content_id'] = 'schedulerContentID' @_hash['shipper_appt_request_id'] = 'shipperApptRequestID' @_hash['shipper_multi_stop_id'] = 'shipperMultiStopID' @_hash['trailer_info'] = 'trailerInfo' @_hash end |
.nullables ⇒ Object
An array for nullable fields
185 186 187 |
# File 'lib/usps_api/models/slot_availability.rb', line 185 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
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 |
# File 'lib/usps_api/models/slot_availability.rb', line 158 def self.optionals %w[ one_time_appt recurring_appt appointment_type appointment_start_date appointment_end_date apply_tiers perishable_ind user_crid scheduler_id scheduler_corp_id scheduler_crid preferred_appt appt_time day_frequency week_frequency appt_tracking_id comments scheduler_content_id shipper_appt_request_id shipper_multi_stop_id trailer_info ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 |
# File 'lib/usps_api/models/slot_availability.rb', line 353 def inspect class_name = self.class.name.split('::').last "<#{class_name} one_time_appt: #{@one_time_appt.inspect}, recurring_appt:"\ " #{@recurring_appt.inspect}, mail_class: #{@mail_class.inspect}, dropship_key:"\ " #{@dropship_key.inspect}, appointment_type: #{@appointment_type.inspect},"\ " appointment_start_date: #{@appointment_start_date.inspect}, appointment_end_date:"\ " #{@appointment_end_date.inspect}, destination_entry: #{@destination_entry.inspect},"\ " apply_tiers: #{@apply_tiers.inspect}, perishable_ind: #{@perishable_ind.inspect},"\ " user_crid: #{@user_crid.inspect}, scheduler_id: #{@scheduler_id.inspect},"\ " scheduler_corp_id: #{@scheduler_corp_id.inspect}, scheduler_crid:"\ " #{@scheduler_crid.inspect}, consignee_facility: #{@consignee_facility.inspect},"\ " detail_info: #{@detail_info.inspect}, preferred_appt: #{@preferred_appt.inspect},"\ " appt_time: #{@appt_time.inspect}, day_frequency: #{@day_frequency.inspect},"\ " week_frequency: #{@week_frequency.inspect}, appt_tracking_id:"\ " #{@appt_tracking_id.inspect}, comments: #{@comments.inspect}, scheduler_content_id:"\ " #{@scheduler_content_id.inspect}, shipper_appt_request_id:"\ " #{@shipper_appt_request_id.inspect}, shipper_multi_stop_id:"\ " #{@shipper_multi_stop_id.inspect}, trailer_info: #{@trailer_info.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_custom_appointment_end_date ⇒ Object
326 327 328 |
# File 'lib/usps_api/models/slot_availability.rb', line 326 def to_custom_appointment_end_date DateTimeHelper.to_rfc3339(appointment_end_date) end |
#to_custom_appointment_start_date ⇒ Object
322 323 324 |
# File 'lib/usps_api/models/slot_availability.rb', line 322 def to_custom_appointment_start_date DateTimeHelper.to_rfc3339(appointment_start_date) end |
#to_custom_preferred_appt ⇒ Object
330 331 332 |
# File 'lib/usps_api/models/slot_availability.rb', line 330 def to_custom_preferred_appt DateTimeHelper.to_rfc3339(preferred_appt) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 |
# File 'lib/usps_api/models/slot_availability.rb', line 335 def to_s class_name = self.class.name.split('::').last "<#{class_name} one_time_appt: #{@one_time_appt}, recurring_appt: #{@recurring_appt},"\ " mail_class: #{@mail_class}, dropship_key: #{@dropship_key}, appointment_type:"\ " #{@appointment_type}, appointment_start_date: #{@appointment_start_date},"\ " appointment_end_date: #{@appointment_end_date}, destination_entry: #{@destination_entry},"\ " apply_tiers: #{@apply_tiers}, perishable_ind: #{@perishable_ind}, user_crid:"\ " #{@user_crid}, scheduler_id: #{@scheduler_id}, scheduler_corp_id: #{@scheduler_corp_id},"\ " scheduler_crid: #{@scheduler_crid}, consignee_facility: #{@consignee_facility},"\ " detail_info: #{@detail_info}, preferred_appt: #{@preferred_appt}, appt_time:"\ " #{@appt_time}, day_frequency: #{@day_frequency}, week_frequency: #{@week_frequency},"\ " appt_tracking_id: #{@appt_tracking_id}, comments: #{@comments}, scheduler_content_id:"\ " #{@scheduler_content_id}, shipper_appt_request_id: #{@shipper_appt_request_id},"\ " shipper_multi_stop_id: #{@shipper_multi_stop_id}, trailer_info: #{@trailer_info},"\ " additional_properties: #{@additional_properties}>" end |