Class: UspsApi::CancellationResponse
- Defined in:
- lib/usps_api/models/cancellation_response.rb
Overview
Cancellation Response details.
Instance Attribute Summary collapse
-
#cancel_comments ⇒ String
Comments the user enters upon appointment cancellation.
-
#cancel_number ⇒ String
The cancellation number of an appointment.
-
#cancel_reason_code ⇒ CancelReasonCode1
The reason the appointment was cancelled.
-
#consignee_appointment_id ⇒ String
FAST appointment ID.
-
#crid ⇒ String
The CRID of the appointment scheduler.
-
#destination_entry ⇒ DestinationEntry
Dropship is YES.
-
#shipper_appointment_request_id ⇒ String
Mailer assigned ID.
-
#system_id ⇒ String
Identifies the submitting application.
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(consignee_appointment_id:, shipper_appointment_request_id:, crid:, destination_entry:, cancel_reason_code:, cancel_comments:, system_id: 'FastAPI', cancel_number: SKIP, additional_properties: nil) ⇒ CancellationResponse
constructor
A new instance of CancellationResponse.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#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(consignee_appointment_id:, shipper_appointment_request_id:, crid:, destination_entry:, cancel_reason_code:, cancel_comments:, system_id: 'FastAPI', cancel_number: SKIP, additional_properties: nil) ⇒ CancellationResponse
Returns a new instance of CancellationResponse.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/usps_api/models/cancellation_response.rb', line 75 def initialize(consignee_appointment_id:, shipper_appointment_request_id:, crid:, destination_entry:, cancel_reason_code:, cancel_comments:, system_id: 'FastAPI', cancel_number: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @consignee_appointment_id = consignee_appointment_id @shipper_appointment_request_id = shipper_appointment_request_id @crid = crid @system_id = system_id unless system_id == SKIP @destination_entry = destination_entry @cancel_reason_code = cancel_reason_code @cancel_comments = cancel_comments @cancel_number = cancel_number unless cancel_number == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#cancel_comments ⇒ String
Comments the user enters upon appointment cancellation
42 43 44 |
# File 'lib/usps_api/models/cancellation_response.rb', line 42 def cancel_comments @cancel_comments end |
#cancel_number ⇒ String
The cancellation number of an appointment. Used in response only.
46 47 48 |
# File 'lib/usps_api/models/cancellation_response.rb', line 46 def cancel_number @cancel_number end |
#cancel_reason_code ⇒ CancelReasonCode1
The reason the appointment was cancelled. Only set when the appointment is cancelled A = Appointment made in error, D = Delivery appointment Cancelled per request of consignee, E = Product combined into another existing appointment, M = Major change in expected delivery window, P = Product not available
38 39 40 |
# File 'lib/usps_api/models/cancellation_response.rb', line 38 def cancel_reason_code @cancel_reason_code end |
#consignee_appointment_id ⇒ String
FAST appointment ID.
14 15 16 |
# File 'lib/usps_api/models/cancellation_response.rb', line 14 def consignee_appointment_id @consignee_appointment_id end |
#crid ⇒ String
The CRID of the appointment scheduler.
22 23 24 |
# File 'lib/usps_api/models/cancellation_response.rb', line 22 def crid @crid end |
#destination_entry ⇒ DestinationEntry
Dropship is YES. Origin Entry is NO.
30 31 32 |
# File 'lib/usps_api/models/cancellation_response.rb', line 30 def destination_entry @destination_entry end |
#shipper_appointment_request_id ⇒ String
Mailer assigned ID.
18 19 20 |
# File 'lib/usps_api/models/cancellation_response.rb', line 18 def shipper_appointment_request_id @shipper_appointment_request_id end |
#system_id ⇒ String
Identifies the submitting application.
26 27 28 |
# File 'lib/usps_api/models/cancellation_response.rb', line 26 def system_id @system_id end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
94 95 96 97 98 99 100 101 102 103 104 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 |
# File 'lib/usps_api/models/cancellation_response.rb', line 94 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. consignee_appointment_id = hash.key?('consigneeAppointmentID') ? hash['consigneeAppointmentID'] : nil shipper_appointment_request_id = hash.key?('shipperAppointmentRequestID') ? hash['shipperAppointmentRequestID'] : nil crid = hash.key?('CRID') ? hash['CRID'] : nil destination_entry = hash.key?('destinationEntry') ? hash['destinationEntry'] : nil cancel_reason_code = hash.key?('cancelReasonCode') ? hash['cancelReasonCode'] : nil cancel_comments = hash.key?('cancelComments') ? hash['cancelComments'] : nil system_id = hash['systemID'] ||= 'FastAPI' cancel_number = hash.key?('cancelNumber') ? hash['cancelNumber'] : SKIP # 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. CancellationResponse.new(consignee_appointment_id: consignee_appointment_id, shipper_appointment_request_id: shipper_appointment_request_id, crid: crid, destination_entry: destination_entry, cancel_reason_code: cancel_reason_code, cancel_comments: cancel_comments, system_id: system_id, cancel_number: cancel_number, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/usps_api/models/cancellation_response.rb', line 49 def self.names @_hash = {} if @_hash.nil? @_hash['consignee_appointment_id'] = 'consigneeAppointmentID' @_hash['shipper_appointment_request_id'] = 'shipperAppointmentRequestID' @_hash['crid'] = 'CRID' @_hash['system_id'] = 'systemID' @_hash['destination_entry'] = 'destinationEntry' @_hash['cancel_reason_code'] = 'cancelReasonCode' @_hash['cancel_comments'] = 'cancelComments' @_hash['cancel_number'] = 'cancelNumber' @_hash end |
.nullables ⇒ Object
An array for nullable fields
71 72 73 |
# File 'lib/usps_api/models/cancellation_response.rb', line 71 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
63 64 65 66 67 68 |
# File 'lib/usps_api/models/cancellation_response.rb', line 63 def self.optionals %w[ system_id cancel_number ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
142 143 144 145 146 147 148 149 150 |
# File 'lib/usps_api/models/cancellation_response.rb', line 142 def inspect class_name = self.class.name.split('::').last "<#{class_name} consignee_appointment_id: #{@consignee_appointment_id.inspect},"\ " shipper_appointment_request_id: #{@shipper_appointment_request_id.inspect}, crid:"\ " #{@crid.inspect}, system_id: #{@system_id.inspect}, destination_entry:"\ " #{@destination_entry.inspect}, cancel_reason_code: #{@cancel_reason_code.inspect},"\ " cancel_comments: #{@cancel_comments.inspect}, cancel_number: #{@cancel_number.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
132 133 134 135 136 137 138 139 |
# File 'lib/usps_api/models/cancellation_response.rb', line 132 def to_s class_name = self.class.name.split('::').last "<#{class_name} consignee_appointment_id: #{@consignee_appointment_id},"\ " shipper_appointment_request_id: #{@shipper_appointment_request_id}, crid: #{@crid},"\ " system_id: #{@system_id}, destination_entry: #{@destination_entry}, cancel_reason_code:"\ " #{@cancel_reason_code}, cancel_comments: #{@cancel_comments}, cancel_number:"\ " #{@cancel_number}, additional_properties: #{@additional_properties}>" end |