Class: UspsApi::Bedload
- Defined in:
- lib/usps_api/models/bedload.rb
Overview
Details and properties of the bedload for the appointment.
Instance Attribute Summary collapse
-
#bundles ⇒ Array[Bundle]
Details and properties of the bundles for the appointment.
-
#parcels ⇒ Array[Parcel]
Details and properties of the parcels for the appointment.
-
#sacks ⇒ Array[Sack]
Array for the sacks portion of the appointment.
-
#trays ⇒ Array[Tray]
Details and properties of the trays for the appointment.
-
#usps_container_info ⇒ UspsContainerInfo1
Details of the container and its contents.
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(usps_container_info: SKIP, sacks: SKIP, trays: SKIP, parcels: SKIP, bundles: SKIP, additional_properties: nil) ⇒ Bedload
constructor
A new instance of Bedload.
-
#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(usps_container_info: SKIP, sacks: SKIP, trays: SKIP, parcels: SKIP, bundles: SKIP, additional_properties: nil) ⇒ Bedload
Returns a new instance of Bedload.
59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/usps_api/models/bedload.rb', line 59 def initialize(usps_container_info: SKIP, sacks: SKIP, trays: SKIP, parcels: SKIP, bundles: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @usps_container_info = usps_container_info unless usps_container_info == SKIP @sacks = sacks unless sacks == SKIP @trays = trays unless trays == SKIP @parcels = parcels unless parcels == SKIP @bundles = bundles unless bundles == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#bundles ⇒ Array[Bundle]
Details and properties of the bundles for the appointment.
30 31 32 |
# File 'lib/usps_api/models/bedload.rb', line 30 def bundles @bundles end |
#parcels ⇒ Array[Parcel]
Details and properties of the parcels for the appointment.
26 27 28 |
# File 'lib/usps_api/models/bedload.rb', line 26 def parcels @parcels end |
#sacks ⇒ Array[Sack]
Array for the sacks portion of the appointment
18 19 20 |
# File 'lib/usps_api/models/bedload.rb', line 18 def sacks @sacks end |
#trays ⇒ Array[Tray]
Details and properties of the trays for the appointment.
22 23 24 |
# File 'lib/usps_api/models/bedload.rb', line 22 def trays @trays end |
#usps_container_info ⇒ UspsContainerInfo1
Details of the container and its contents.
14 15 16 |
# File 'lib/usps_api/models/bedload.rb', line 14 def usps_container_info @usps_container_info end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 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 130 131 132 133 134 |
# File 'lib/usps_api/models/bedload.rb', line 73 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. usps_container_info = UspsContainerInfo1.from_hash(hash['uspsContainerInfo']) if hash['uspsContainerInfo'] # Parameter is an array, so we need to iterate through it sacks = nil unless hash['sacks'].nil? sacks = [] hash['sacks'].each do |structure| sacks << (Sack.from_hash(structure) if structure) end end sacks = SKIP unless hash.key?('sacks') # Parameter is an array, so we need to iterate through it trays = nil unless hash['trays'].nil? trays = [] hash['trays'].each do |structure| trays << (Tray.from_hash(structure) if structure) end end trays = SKIP unless hash.key?('trays') # Parameter is an array, so we need to iterate through it parcels = nil unless hash['parcels'].nil? parcels = [] hash['parcels'].each do |structure| parcels << (Parcel.from_hash(structure) if structure) end end parcels = SKIP unless hash.key?('parcels') # Parameter is an array, so we need to iterate through it bundles = nil unless hash['bundles'].nil? bundles = [] hash['bundles'].each do |structure| bundles << (Bundle.from_hash(structure) if structure) end end bundles = SKIP unless hash.key?('bundles') # 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. Bedload.new(usps_container_info: usps_container_info, sacks: sacks, trays: trays, parcels: parcels, bundles: bundles, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
33 34 35 36 37 38 39 40 41 |
# File 'lib/usps_api/models/bedload.rb', line 33 def self.names @_hash = {} if @_hash.nil? @_hash['usps_container_info'] = 'uspsContainerInfo' @_hash['sacks'] = 'sacks' @_hash['trays'] = 'trays' @_hash['parcels'] = 'parcels' @_hash['bundles'] = 'bundles' @_hash end |
.nullables ⇒ Object
An array for nullable fields
55 56 57 |
# File 'lib/usps_api/models/bedload.rb', line 55 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
44 45 46 47 48 49 50 51 52 |
# File 'lib/usps_api/models/bedload.rb', line 44 def self.optionals %w[ usps_container_info sacks trays parcels bundles ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
145 146 147 148 149 150 |
# File 'lib/usps_api/models/bedload.rb', line 145 def inspect class_name = self.class.name.split('::').last "<#{class_name} usps_container_info: #{@usps_container_info.inspect}, sacks:"\ " #{@sacks.inspect}, trays: #{@trays.inspect}, parcels: #{@parcels.inspect}, bundles:"\ " #{@bundles.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
137 138 139 140 141 142 |
# File 'lib/usps_api/models/bedload.rb', line 137 def to_s class_name = self.class.name.split('::').last "<#{class_name} usps_container_info: #{@usps_container_info}, sacks: #{@sacks}, trays:"\ " #{@trays}, parcels: #{@parcels}, bundles: #{@bundles}, additional_properties:"\ " #{@additional_properties}>" end |