Class: UspsApi::SchedulePickupRequestPickupLocation
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- UspsApi::SchedulePickupRequestPickupLocation
- Defined in:
- lib/usps_api/models/schedule_pickup_request_pickup_location.rb
Overview
Details of where to pickup packages.
Instance Attribute Summary collapse
-
#dog_present ⇒ TrueClass | FalseClass
Used to notify the carrier if a dog is present at the pickup location.
-
#package_location ⇒ PackageLocation
This is the location of the packages ready for pick-up at the pickup address.
-
#special_instructions ⇒ String
Additional details on where the packages can be picked-up.
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(package_location:, special_instructions: SKIP, dog_present: false) ⇒ SchedulePickupRequestPickupLocation
constructor
A new instance of SchedulePickupRequestPickupLocation.
-
#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(package_location:, special_instructions: SKIP, dog_present: false) ⇒ SchedulePickupRequestPickupLocation
Returns a new instance of SchedulePickupRequestPickupLocation.
48 49 50 51 52 53 |
# File 'lib/usps_api/models/schedule_pickup_request_pickup_location.rb', line 48 def initialize(package_location:, special_instructions: SKIP, dog_present: false) @package_location = package_location @special_instructions = special_instructions unless special_instructions == SKIP @dog_present = dog_present unless dog_present == SKIP end |
Instance Attribute Details
#dog_present ⇒ TrueClass | FalseClass
Used to notify the carrier if a dog is present at the pickup location.
24 25 26 |
# File 'lib/usps_api/models/schedule_pickup_request_pickup_location.rb', line 24 def dog_present @dog_present end |
#package_location ⇒ PackageLocation
This is the location of the packages ready for pick-up at the pickup address.
15 16 17 |
# File 'lib/usps_api/models/schedule_pickup_request_pickup_location.rb', line 15 def package_location @package_location end |
#special_instructions ⇒ String
Additional details on where the packages can be picked-up. This is required when the package location is ‘OTHER’.
20 21 22 |
# File 'lib/usps_api/models/schedule_pickup_request_pickup_location.rb', line 20 def special_instructions @special_instructions 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 |
# File 'lib/usps_api/models/schedule_pickup_request_pickup_location.rb', line 56 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. package_location = hash.key?('packageLocation') ? hash['packageLocation'] : nil special_instructions = hash.key?('specialInstructions') ? hash['specialInstructions'] : SKIP dog_present = hash['dogPresent'] ||= false # Create object from extracted values. SchedulePickupRequestPickupLocation.new(package_location: package_location, special_instructions: special_instructions, dog_present: dog_present) end |
.names ⇒ Object
A mapping from model property names to API property names.
27 28 29 30 31 32 33 |
# File 'lib/usps_api/models/schedule_pickup_request_pickup_location.rb', line 27 def self.names @_hash = {} if @_hash.nil? @_hash['package_location'] = 'packageLocation' @_hash['special_instructions'] = 'specialInstructions' @_hash['dog_present'] = 'dogPresent' @_hash end |
.nullables ⇒ Object
An array for nullable fields
44 45 46 |
# File 'lib/usps_api/models/schedule_pickup_request_pickup_location.rb', line 44 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
36 37 38 39 40 41 |
# File 'lib/usps_api/models/schedule_pickup_request_pickup_location.rb', line 36 def self.optionals %w[ special_instructions dog_present ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
80 81 82 83 84 |
# File 'lib/usps_api/models/schedule_pickup_request_pickup_location.rb', line 80 def inspect class_name = self.class.name.split('::').last "<#{class_name} package_location: #{@package_location.inspect}, special_instructions:"\ " #{@special_instructions.inspect}, dog_present: #{@dog_present.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
73 74 75 76 77 |
# File 'lib/usps_api/models/schedule_pickup_request_pickup_location.rb', line 73 def to_s class_name = self.class.name.split('::').last "<#{class_name} package_location: #{@package_location}, special_instructions:"\ " #{@special_instructions}, dog_present: #{@dog_present}>" end |