Class: UspsApi::PickupConfirmation
- Defined in:
- lib/usps_api/models/pickup_confirmation.rb
Overview
PickupConfirmation Model.
Instance Attribute Summary collapse
-
#carrier_pickup_request ⇒ ScheduleCarrierPickupRequest
The Schedule Carrier Pickup Request includes all of the necessary information to schedule a package pickup from your carrier.
-
#confirmation_number ⇒ String
This is the USPS assigned confirmation number of the pick-up.
-
#pickup_date ⇒ Date
This is the scheduled pick-up date.
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(confirmation_number: SKIP, pickup_date: SKIP, carrier_pickup_request: SKIP) ⇒ PickupConfirmation
constructor
A new instance of PickupConfirmation.
-
#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(confirmation_number: SKIP, pickup_date: SKIP, carrier_pickup_request: SKIP) ⇒ PickupConfirmation
Returns a new instance of PickupConfirmation.
48 49 50 51 52 53 |
# File 'lib/usps_api/models/pickup_confirmation.rb', line 48 def initialize(confirmation_number: SKIP, pickup_date: SKIP, carrier_pickup_request: SKIP) @confirmation_number = confirmation_number unless confirmation_number == SKIP @pickup_date = pickup_date unless pickup_date == SKIP @carrier_pickup_request = carrier_pickup_request unless carrier_pickup_request == SKIP end |
Instance Attribute Details
#carrier_pickup_request ⇒ ScheduleCarrierPickupRequest
The Schedule Carrier Pickup Request includes all of the necessary information to schedule a package pickup from your carrier.
23 24 25 |
# File 'lib/usps_api/models/pickup_confirmation.rb', line 23 def carrier_pickup_request @carrier_pickup_request end |
#confirmation_number ⇒ String
This is the USPS assigned confirmation number of the pick-up.
14 15 16 |
# File 'lib/usps_api/models/pickup_confirmation.rb', line 14 def confirmation_number @confirmation_number end |
#pickup_date ⇒ Date
This is the scheduled pick-up date.
18 19 20 |
# File 'lib/usps_api/models/pickup_confirmation.rb', line 18 def pickup_date @pickup_date end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/usps_api/models/pickup_confirmation.rb', line 56 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. confirmation_number = hash.key?('confirmationNumber') ? hash['confirmationNumber'] : SKIP pickup_date = hash.key?('pickupDate') ? hash['pickupDate'] : SKIP if hash['carrierPickupRequest'] carrier_pickup_request = ScheduleCarrierPickupRequest.from_hash(hash['carrierPickupRequest']) end # Create object from extracted values. PickupConfirmation.new(confirmation_number: confirmation_number, pickup_date: pickup_date, carrier_pickup_request: carrier_pickup_request) end |
.names ⇒ Object
A mapping from model property names to API property names.
26 27 28 29 30 31 32 |
# File 'lib/usps_api/models/pickup_confirmation.rb', line 26 def self.names @_hash = {} if @_hash.nil? @_hash['confirmation_number'] = 'confirmationNumber' @_hash['pickup_date'] = 'pickupDate' @_hash['carrier_pickup_request'] = 'carrierPickupRequest' @_hash end |
.nullables ⇒ Object
An array for nullable fields
44 45 46 |
# File 'lib/usps_api/models/pickup_confirmation.rb', line 44 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
35 36 37 38 39 40 41 |
# File 'lib/usps_api/models/pickup_confirmation.rb', line 35 def self.optionals %w[ confirmation_number pickup_date carrier_pickup_request ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
81 82 83 84 85 |
# File 'lib/usps_api/models/pickup_confirmation.rb', line 81 def inspect class_name = self.class.name.split('::').last "<#{class_name} confirmation_number: #{@confirmation_number.inspect}, pickup_date:"\ " #{@pickup_date.inspect}, carrier_pickup_request: #{@carrier_pickup_request.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
74 75 76 77 78 |
# File 'lib/usps_api/models/pickup_confirmation.rb', line 74 def to_s class_name = self.class.name.split('::').last "<#{class_name} confirmation_number: #{@confirmation_number}, pickup_date: #{@pickup_date},"\ " carrier_pickup_request: #{@carrier_pickup_request}>" end |