Class: UspsApi::Appointment

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

Overview

Appointment with full details.

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(destination_entry:, detail_info:, consignee_facility:, shipper_appointment_request_id:, crid:, appointment_type: SKIP, recurring_appointment: SKIP, one_time_appointment: SKIP, trailer_info: SKIP, comment: SKIP, value_added_service: SKIP, consignee_appointment_id: SKIP, scheduler_id: SKIP, scheduler_corp_id: SKIP, shipper_multi_stop_id: SKIP, consignee_multi_stop_id: SKIP, shipper_stop_number: SKIP, pickup_or_delivery: SKIP, pallet_position_count: SKIP, includes_electronic_load: SKIP) ⇒ Appointment

Returns a new instance of Appointment.



146
147
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/appointment.rb', line 146

def initialize(destination_entry:, detail_info:, consignee_facility:,
               shipper_appointment_request_id:, crid:,
               appointment_type: SKIP, recurring_appointment: SKIP,
               one_time_appointment: SKIP, trailer_info: SKIP,
               comment: SKIP, value_added_service: SKIP,
               consignee_appointment_id: SKIP, scheduler_id: SKIP,
               scheduler_corp_id: SKIP, shipper_multi_stop_id: SKIP,
               consignee_multi_stop_id: SKIP, shipper_stop_number: SKIP,
               pickup_or_delivery: SKIP, pallet_position_count: SKIP,
               includes_electronic_load: SKIP)
  @appointment_type = appointment_type unless appointment_type == SKIP
  @destination_entry = destination_entry
  @recurring_appointment = recurring_appointment unless recurring_appointment == SKIP
  @one_time_appointment = one_time_appointment unless one_time_appointment == SKIP
  @detail_info = detail_info
  @trailer_info = trailer_info unless trailer_info == SKIP
  @consignee_facility = consignee_facility
  @comment = comment unless comment == SKIP
  @value_added_service = value_added_service unless value_added_service == SKIP
  @shipper_appointment_request_id = shipper_appointment_request_id
  @consignee_appointment_id = consignee_appointment_id unless consignee_appointment_id == SKIP
  @scheduler_id = scheduler_id unless scheduler_id == SKIP
  @scheduler_corp_id = scheduler_corp_id unless scheduler_corp_id == SKIP
  @crid = crid
  @shipper_multi_stop_id = shipper_multi_stop_id unless shipper_multi_stop_id == SKIP
  @consignee_multi_stop_id = consignee_multi_stop_id unless consignee_multi_stop_id == SKIP
  @shipper_stop_number = shipper_stop_number unless shipper_stop_number == SKIP
  @pickup_or_delivery = pickup_or_delivery unless pickup_or_delivery == SKIP
  @pallet_position_count = pallet_position_count unless pallet_position_count == SKIP
  @includes_electronic_load = includes_electronic_load unless includes_electronic_load == SKIP
end

Instance Attribute Details

#appointment_typeAppointmentType

The type of appointment. PALLET = 1, BEDLOAD = 2, DROP_AND_PICK = 3, SPEEDLINE = 4. Required for Dropship appointments.

Returns:



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

def appointment_type
  @appointment_type
end

#commentString

Facility Comments

Returns:

  • (String)


44
45
46
# File 'lib/usps_api/models/appointment.rb', line 44

def comment
  @comment
end

#consignee_appointment_idString

Appointment ID assigned from FAST. Required for Update actions.

Returns:

  • (String)


56
57
58
# File 'lib/usps_api/models/appointment.rb', line 56

def consignee_appointment_id
  @consignee_appointment_id
end

#consignee_facilityConsigneeFacility

Consignee Facility details.

Returns:



40
41
42
# File 'lib/usps_api/models/appointment.rb', line 40

def consignee_facility
  @consignee_facility
end

#consignee_multi_stop_idString

Assigned Appointment ID for multistop appointment

Returns:

  • (String)


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

def consignee_multi_stop_id
  @consignee_multi_stop_id
end

#cridString

CRID assigned to Scheduler of FAST Appointment

Returns:

  • (String)


68
69
70
# File 'lib/usps_api/models/appointment.rb', line 68

def crid
  @crid
end

#destination_entryDestinationEntry

Dropship is YES. Origin Entry is NO.

Returns:



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

def destination_entry
  @destination_entry
end

#detail_infoDetailInfo

Details of the appointment request.

Returns:



32
33
34
# File 'lib/usps_api/models/appointment.rb', line 32

def detail_info
  @detail_info
end

#includes_electronic_loadIncludesElectronicLoad

Indicates the Appointment is electronically processed with barcodes



92
93
94
# File 'lib/usps_api/models/appointment.rb', line 92

def includes_electronic_load
  @includes_electronic_load
end

#one_time_appointmentOneTimeAppointment

Must have either oneTimeAppointment or recurringAppointment

Returns:



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

def one_time_appointment
  @one_time_appointment
end

#pallet_position_countInteger

The number of pallet positions in the appointment

Returns:

  • (Integer)


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

def pallet_position_count
  @pallet_position_count
end

#pickup_or_deliveryPickupOrDelivery

Type of delivery from mailer

Returns:



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

def pickup_or_delivery
  @pickup_or_delivery
end

#recurring_appointmentRecurringAppointment

Must have either oneTimeAppointment or recurringAppointment



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

def recurring_appointment
  @recurring_appointment
end

#scheduler_corp_idString

Unique ID of the corporation generated by PostalOne!

Returns:

  • (String)


64
65
66
# File 'lib/usps_api/models/appointment.rb', line 64

def scheduler_corp_id
  @scheduler_corp_id
end

#scheduler_idString

Unique ID for mailer scheduler

Returns:

  • (String)


60
61
62
# File 'lib/usps_api/models/appointment.rb', line 60

def scheduler_id
  @scheduler_id
end

#shipper_appointment_request_idString

Mailer assigned ID

Returns:

  • (String)


52
53
54
# File 'lib/usps_api/models/appointment.rb', line 52

def shipper_appointment_request_id
  @shipper_appointment_request_id
end

#shipper_multi_stop_idString

ID assigned to multistop appointments

Returns:

  • (String)


72
73
74
# File 'lib/usps_api/models/appointment.rb', line 72

def shipper_multi_stop_id
  @shipper_multi_stop_id
end

#shipper_stop_numberString

Number of multistop appointments under FAST appointment

Returns:

  • (String)


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

def shipper_stop_number
  @shipper_stop_number
end

#trailer_infoTrailerInfo

Information about the trailer for the appointment.

Returns:



36
37
38
# File 'lib/usps_api/models/appointment.rb', line 36

def trailer_info
  @trailer_info
end

#value_added_serviceValueAddedService

Special appointment types offered

Returns:



48
49
50
# File 'lib/usps_api/models/appointment.rb', line 48

def value_added_service
  @value_added_service
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
# File 'lib/usps_api/models/appointment.rb', line 179

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  destination_entry =
    hash.key?('destinationEntry') ? hash['destinationEntry'] : nil
  detail_info = DetailInfo.from_hash(hash['detailInfo']) if hash['detailInfo']
  consignee_facility = ConsigneeFacility.from_hash(hash['consigneeFacility']) if
    hash['consigneeFacility']
  shipper_appointment_request_id =
    hash.key?('shipperAppointmentRequestID') ? hash['shipperAppointmentRequestID'] : nil
  crid = hash.key?('CRID') ? hash['CRID'] : nil
  appointment_type =
    hash.key?('appointmentType') ? hash['appointmentType'] : SKIP
  recurring_appointment = RecurringAppointment.from_hash(hash['recurringAppointment']) if
    hash['recurringAppointment']
  one_time_appointment = OneTimeAppointment.from_hash(hash['oneTimeAppointment']) if
    hash['oneTimeAppointment']
  trailer_info = TrailerInfo.from_hash(hash['trailerInfo']) if hash['trailerInfo']
  comment = hash.key?('comment') ? hash['comment'] : SKIP
  value_added_service =
    hash.key?('valueAddedService') ? hash['valueAddedService'] : SKIP
  consignee_appointment_id =
    hash.key?('consigneeAppointmentID') ? hash['consigneeAppointmentID'] : SKIP
  scheduler_id = hash.key?('schedulerID') ? hash['schedulerID'] : SKIP
  scheduler_corp_id =
    hash.key?('schedulerCorpID') ? hash['schedulerCorpID'] : SKIP
  shipper_multi_stop_id =
    hash.key?('shipperMultiStopID') ? hash['shipperMultiStopID'] : SKIP
  consignee_multi_stop_id =
    hash.key?('consigneeMultiStopID') ? hash['consigneeMultiStopID'] : SKIP
  shipper_stop_number =
    hash.key?('shipperStopNumber') ? hash['shipperStopNumber'] : SKIP
  pickup_or_delivery =
    hash.key?('pickupOrDelivery') ? hash['pickupOrDelivery'] : SKIP
  pallet_position_count =
    hash.key?('palletPositionCount') ? hash['palletPositionCount'] : SKIP
  includes_electronic_load =
    hash.key?('includesElectronicLoad') ? hash['includesElectronicLoad'] : SKIP

  # Create object from extracted values.
  Appointment.new(destination_entry: destination_entry,
                  detail_info: detail_info,
                  consignee_facility: consignee_facility,
                  shipper_appointment_request_id: shipper_appointment_request_id,
                  crid: crid,
                  appointment_type: appointment_type,
                  recurring_appointment: recurring_appointment,
                  one_time_appointment: one_time_appointment,
                  trailer_info: trailer_info,
                  comment: comment,
                  value_added_service: value_added_service,
                  consignee_appointment_id: consignee_appointment_id,
                  scheduler_id: scheduler_id,
                  scheduler_corp_id: scheduler_corp_id,
                  shipper_multi_stop_id: shipper_multi_stop_id,
                  consignee_multi_stop_id: consignee_multi_stop_id,
                  shipper_stop_number: shipper_stop_number,
                  pickup_or_delivery: pickup_or_delivery,
                  pallet_position_count: pallet_position_count,
                  includes_electronic_load: includes_electronic_load)
end

.namesObject

A mapping from model property names to API property names.



95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/usps_api/models/appointment.rb', line 95

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['appointment_type'] = 'appointmentType'
  @_hash['destination_entry'] = 'destinationEntry'
  @_hash['recurring_appointment'] = 'recurringAppointment'
  @_hash['one_time_appointment'] = 'oneTimeAppointment'
  @_hash['detail_info'] = 'detailInfo'
  @_hash['trailer_info'] = 'trailerInfo'
  @_hash['consignee_facility'] = 'consigneeFacility'
  @_hash['comment'] = 'comment'
  @_hash['value_added_service'] = 'valueAddedService'
  @_hash['shipper_appointment_request_id'] = 'shipperAppointmentRequestID'
  @_hash['consignee_appointment_id'] = 'consigneeAppointmentID'
  @_hash['scheduler_id'] = 'schedulerID'
  @_hash['scheduler_corp_id'] = 'schedulerCorpID'
  @_hash['crid'] = 'CRID'
  @_hash['shipper_multi_stop_id'] = 'shipperMultiStopID'
  @_hash['consignee_multi_stop_id'] = 'consigneeMultiStopID'
  @_hash['shipper_stop_number'] = 'shipperStopNumber'
  @_hash['pickup_or_delivery'] = 'pickupOrDelivery'
  @_hash['pallet_position_count'] = 'palletPositionCount'
  @_hash['includes_electronic_load'] = 'includesElectronicLoad'
  @_hash
end

.nullablesObject

An array for nullable fields



142
143
144
# File 'lib/usps_api/models/appointment.rb', line 142

def self.nullables
  []
end

.optionalsObject

An array for optional fields



121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/usps_api/models/appointment.rb', line 121

def self.optionals
  %w[
    appointment_type
    recurring_appointment
    one_time_appointment
    trailer_info
    comment
    value_added_service
    consignee_appointment_id
    scheduler_id
    scheduler_corp_id
    shipper_multi_stop_id
    consignee_multi_stop_id
    shipper_stop_number
    pickup_or_delivery
    pallet_position_count
    includes_electronic_load
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
# File 'lib/usps_api/models/appointment.rb', line 260

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} appointment_type: #{@appointment_type.inspect}, destination_entry:"\
  " #{@destination_entry.inspect}, recurring_appointment: #{@recurring_appointment.inspect},"\
  " one_time_appointment: #{@one_time_appointment.inspect}, detail_info:"\
  " #{@detail_info.inspect}, trailer_info: #{@trailer_info.inspect}, consignee_facility:"\
  " #{@consignee_facility.inspect}, comment: #{@comment.inspect}, value_added_service:"\
  " #{@value_added_service.inspect}, shipper_appointment_request_id:"\
  " #{@shipper_appointment_request_id.inspect}, consignee_appointment_id:"\
  " #{@consignee_appointment_id.inspect}, scheduler_id: #{@scheduler_id.inspect},"\
  " scheduler_corp_id: #{@scheduler_corp_id.inspect}, crid: #{@crid.inspect},"\
  " shipper_multi_stop_id: #{@shipper_multi_stop_id.inspect}, consignee_multi_stop_id:"\
  " #{@consignee_multi_stop_id.inspect}, shipper_stop_number: #{@shipper_stop_number.inspect},"\
  " pickup_or_delivery: #{@pickup_or_delivery.inspect}, pallet_position_count:"\
  " #{@pallet_position_count.inspect}, includes_electronic_load:"\
  " #{@includes_electronic_load.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
# File 'lib/usps_api/models/appointment.rb', line 243

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} appointment_type: #{@appointment_type}, destination_entry:"\
  " #{@destination_entry}, recurring_appointment: #{@recurring_appointment},"\
  " one_time_appointment: #{@one_time_appointment}, detail_info: #{@detail_info},"\
  " trailer_info: #{@trailer_info}, consignee_facility: #{@consignee_facility}, comment:"\
  " #{@comment}, value_added_service: #{@value_added_service}, shipper_appointment_request_id:"\
  " #{@shipper_appointment_request_id}, consignee_appointment_id:"\
  " #{@consignee_appointment_id}, scheduler_id: #{@scheduler_id}, scheduler_corp_id:"\
  " #{@scheduler_corp_id}, crid: #{@crid}, shipper_multi_stop_id: #{@shipper_multi_stop_id},"\
  " consignee_multi_stop_id: #{@consignee_multi_stop_id}, shipper_stop_number:"\
  " #{@shipper_stop_number}, pickup_or_delivery: #{@pickup_or_delivery},"\
  " pallet_position_count: #{@pallet_position_count}, includes_electronic_load:"\
  " #{@includes_electronic_load}>"
end