Class: UspsApi::InternationalLabelsPackageDescription
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- UspsApi::InternationalLabelsPackageDescription
- Defined in:
- lib/usps_api/models/international_labels_package_description.rb
Overview
Basic physical characteristics of a package including weight, dimensions, and destination entry facility address.
Instance Attribute Summary collapse
-
#destination_entry_facility_address ⇒ InternationalLabelsDomesticAddress
Address fields for US locations.
-
#dimensions_uom ⇒ DimensionsUom
Dimensions unit of measurement.
-
#girth ⇒ Float
The girth of the container, in dimensionsUOM.
-
#height ⇒ Float
The height of the container, in ‘dimensionsUOM`.
-
#length ⇒ Float
The length of the container, in dimensionsUOM.
-
#weight ⇒ Float
The package weight, in ‘weightUOM` (Unit Of Measure).
-
#weight_uom ⇒ WeightUom
Weight Unit of Measure * lb - Pounds.
-
#width ⇒ Float
The width of the container, in ‘dimensionsUOM`.
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(weight_uom: WeightUom::LB, weight: SKIP, dimensions_uom: DimensionsUom::ENUM_IN, length: SKIP, height: SKIP, width: SKIP, girth: SKIP, destination_entry_facility_address: SKIP, additional_properties: nil) ⇒ InternationalLabelsPackageDescription
constructor
A new instance of InternationalLabelsPackageDescription.
-
#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(weight_uom: WeightUom::LB, weight: SKIP, dimensions_uom: DimensionsUom::ENUM_IN, length: SKIP, height: SKIP, width: SKIP, girth: SKIP, destination_entry_facility_address: SKIP, additional_properties: nil) ⇒ InternationalLabelsPackageDescription
Returns a new instance of InternationalLabelsPackageDescription.
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/usps_api/models/international_labels_package_description.rb', line 110 def initialize(weight_uom: WeightUom::LB, weight: SKIP, dimensions_uom: DimensionsUom::ENUM_IN, length: SKIP, height: SKIP, width: SKIP, girth: SKIP, destination_entry_facility_address: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @weight_uom = weight_uom unless weight_uom == SKIP @weight = weight unless weight == SKIP @dimensions_uom = dimensions_uom unless dimensions_uom == SKIP @length = length unless length == SKIP @height = height unless height == SKIP @width = width unless width == SKIP @girth = girth unless girth == SKIP unless destination_entry_facility_address == SKIP @destination_entry_facility_address = destination_entry_facility_address end @additional_properties = additional_properties end |
Instance Attribute Details
#destination_entry_facility_address ⇒ InternationalLabelsDomesticAddress
Address fields for US locations
74 75 76 |
# File 'lib/usps_api/models/international_labels_package_description.rb', line 74 def destination_entry_facility_address @destination_entry_facility_address end |
#dimensions_uom ⇒ DimensionsUom
Dimensions unit of measurement.
* in - Inches
26 27 28 |
# File 'lib/usps_api/models/international_labels_package_description.rb', line 26 def dimensions_uom @dimensions_uom end |
#girth ⇒ Float
The girth of the container, in dimensionsUOM. If partial dimensions are provided, an error response will return. ‘length`, `width`, and `height` are required for accurate pricing of a rectangular package when any dimension of the item exceeds 12 inches. `girth` is required only for a non-rectangular package in addition to `length`, `width`, and `height` when any dimension of the package exceeds 12 inches. For rectangular packages, the `girth` dimension must be left blank as this dimension is to only be used for non-rectangular packages.
70 71 72 |
# File 'lib/usps_api/models/international_labels_package_description.rb', line 70 def girth @girth end |
#height ⇒ Float
The height of the container, in ‘dimensionsUOM`. If partial dimensions are provided, an error response will return. `length`, `width`, and `height` are required for accurate pricing of a rectangular package when any dimension of the item exceeds 12 inches. `girth` is required only for a non-rectangular package in addition to `length`, `width`, and `height` when any dimension of the package exceeds 12 inches. For rectangular packages, the `girth` dimension must be left blank as this dimension is to only be used for non-rectangular packages.
48 49 50 |
# File 'lib/usps_api/models/international_labels_package_description.rb', line 48 def height @height end |
#length ⇒ Float
The length of the container, in dimensionsUOM. If partial dimensions are provided, an error response will return. ‘length`, `width`, and `height` are required for accurate pricing of a rectangular package when any dimension of the item exceeds 12 inches. `girth` is required only for a non-rectangular package in addition to `length`, `width`, and `height` when any dimension of the package exceeds 12 inches. For rectangular packages, the `girth` dimension must be left blank as this dimension is to only be used for non-rectangular packages.
37 38 39 |
# File 'lib/usps_api/models/international_labels_package_description.rb', line 37 def length @length end |
#weight ⇒ Float
The package weight, in ‘weightUOM` (Unit Of Measure). Items must weigh 70 pounds (1120 ounces) or less.
21 22 23 |
# File 'lib/usps_api/models/international_labels_package_description.rb', line 21 def weight @weight end |
#weight_uom ⇒ WeightUom
Weight Unit of Measure
* lb - Pounds
16 17 18 |
# File 'lib/usps_api/models/international_labels_package_description.rb', line 16 def weight_uom @weight_uom end |
#width ⇒ Float
The width of the container, in ‘dimensionsUOM`. If partial dimensions are provided, an error response will return. `length`, `width`, and `height` are required for accurate pricing of a rectangular package when any dimension of the item exceeds 12 inches. `girth` is required only for a non-rectangular package in addition to `length`, `width`, and `height` when any dimension of the package exceeds 12 inches. For rectangular packages, the `girth` dimension must be left blank as this dimension is to only be used for non-rectangular packages.
59 60 61 |
# File 'lib/usps_api/models/international_labels_package_description.rb', line 59 def width @width end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 |
# File 'lib/usps_api/models/international_labels_package_description.rb', line 133 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. weight_uom = hash['weightUOM'] ||= WeightUom::LB weight = hash.key?('weight') ? hash['weight'] : SKIP dimensions_uom = hash['dimensionsUOM'] ||= DimensionsUom::ENUM_IN length = hash.key?('length') ? hash['length'] : SKIP height = hash.key?('height') ? hash['height'] : SKIP width = hash.key?('width') ? hash['width'] : SKIP girth = hash.key?('girth') ? hash['girth'] : SKIP if hash['destinationEntryFacilityAddress'] destination_entry_facility_address = InternationalLabelsDomesticAddress.from_hash(hash['destinationEntryFacilityAddress']) end # 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. InternationalLabelsPackageDescription.new(weight_uom: weight_uom, weight: weight, dimensions_uom: dimensions_uom, length: length, height: height, width: width, girth: girth, destination_entry_facility_address: destination_entry_facility_address, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/usps_api/models/international_labels_package_description.rb', line 77 def self.names @_hash = {} if @_hash.nil? @_hash['weight_uom'] = 'weightUOM' @_hash['weight'] = 'weight' @_hash['dimensions_uom'] = 'dimensionsUOM' @_hash['length'] = 'length' @_hash['height'] = 'height' @_hash['width'] = 'width' @_hash['girth'] = 'girth' @_hash['destination_entry_facility_address'] = 'destinationEntryFacilityAddress' @_hash end |
.nullables ⇒ Object
An array for nullable fields
106 107 108 |
# File 'lib/usps_api/models/international_labels_package_description.rb', line 106 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/usps_api/models/international_labels_package_description.rb', line 92 def self.optionals %w[ weight_uom weight dimensions_uom length height width girth destination_entry_facility_address ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
177 178 179 180 181 182 183 184 |
# File 'lib/usps_api/models/international_labels_package_description.rb', line 177 def inspect class_name = self.class.name.split('::').last "<#{class_name} weight_uom: #{@weight_uom.inspect}, weight: #{@weight.inspect},"\ " dimensions_uom: #{@dimensions_uom.inspect}, length: #{@length.inspect}, height:"\ " #{@height.inspect}, width: #{@width.inspect}, girth: #{@girth.inspect},"\ " destination_entry_facility_address: #{@destination_entry_facility_address.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
168 169 170 171 172 173 174 |
# File 'lib/usps_api/models/international_labels_package_description.rb', line 168 def to_s class_name = self.class.name.split('::').last "<#{class_name} weight_uom: #{@weight_uom}, weight: #{@weight}, dimensions_uom:"\ " #{@dimensions_uom}, length: #{@length}, height: #{@height}, width: #{@width}, girth:"\ " #{@girth}, destination_entry_facility_address: #{@destination_entry_facility_address},"\ " additional_properties: #{@additional_properties}>" end |