Class: UspsApi::InternationalLabelsCustomsFormPackageContents
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- UspsApi::InternationalLabelsCustomsFormPackageContents
- Defined in:
- lib/usps_api/models/international_labels_customs_form_package_contents.rb
Overview
Required repeating up to 30 times.
Instance Attribute Summary collapse
-
#countryof_origin ⇒ String
2 digit Alpha Country Code defined by ISO is required for an international address.
-
#hs_tariff_number ⇒ String
For commercial items only.
-
#item_category ⇒ String
Category of the item being shipped.
-
#item_description ⇒ String
Description of the item.
-
#item_quantity ⇒ Integer
Quantity of the item.
-
#item_subcategory ⇒ String
Subcategory of the item being shipped.
-
#item_total_value ⇒ Float
The total item value, in USD, of the items matching the ‘[itemDescription]`.
-
#item_total_weight ⇒ Float
Provide the total weight in weightUOM for the all the items matching the ‘[itemDescription]`.
-
#item_value ⇒ Float
Value of the individual item in USD.
-
#item_weight ⇒ Float
Provide the weight in weightUOM for the individual item listed with ‘[itemDescription]`.
-
#weight_uom ⇒ WeightUom1
Weight Unit of Measurement.
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(item_description: SKIP, item_quantity: SKIP, item_value: SKIP, item_total_value: SKIP, weight_uom: WeightUom1::LB, item_weight: SKIP, item_total_weight: SKIP, hs_tariff_number: SKIP, countryof_origin: SKIP, item_category: SKIP, item_subcategory: SKIP, additional_properties: nil) ⇒ InternationalLabelsCustomsFormPackageContents
constructor
A new instance of InternationalLabelsCustomsFormPackageContents.
-
#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(item_description: SKIP, item_quantity: SKIP, item_value: SKIP, item_total_value: SKIP, weight_uom: WeightUom1::LB, item_weight: SKIP, item_total_weight: SKIP, hs_tariff_number: SKIP, countryof_origin: SKIP, item_category: SKIP, item_subcategory: SKIP, additional_properties: nil) ⇒ InternationalLabelsCustomsFormPackageContents
Returns a new instance of InternationalLabelsCustomsFormPackageContents.
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
# File 'lib/usps_api/models/international_labels_customs_form_package_contents.rb', line 115 def initialize(item_description: SKIP, item_quantity: SKIP, item_value: SKIP, item_total_value: SKIP, weight_uom: WeightUom1::LB, item_weight: SKIP, item_total_weight: SKIP, hs_tariff_number: SKIP, countryof_origin: SKIP, item_category: SKIP, item_subcategory: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @item_description = item_description unless item_description == SKIP @item_quantity = item_quantity unless item_quantity == SKIP @item_value = item_value unless item_value == SKIP @item_total_value = item_total_value unless item_total_value == SKIP @weight_uom = weight_uom unless weight_uom == SKIP @item_weight = item_weight unless item_weight == SKIP @item_total_weight = item_total_weight unless item_total_weight == SKIP @hs_tariff_number = hs_tariff_number unless hs_tariff_number == SKIP @countryof_origin = countryof_origin unless countryof_origin == SKIP @item_category = item_category unless item_category == SKIP @item_subcategory = item_subcategory unless item_subcategory == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#countryof_origin ⇒ String
2 digit Alpha Country Code defined by ISO is required for an international address.
66 67 68 |
# File 'lib/usps_api/models/international_labels_customs_form_package_contents.rb', line 66 def countryof_origin @countryof_origin end |
#hs_tariff_number ⇒ String
For commercial items only. The HS tariff number is based on the Harmonized Commodity Description and Coding System developed by the World Customs Organization. Providing this value is strongly recommended for faster processing. If not supplied, USPS will attempt to look up the HS tariff number, which may result in longer response times. The value should follow the pattern: ‘^.*(?:[A-Za-zd].*)6,14$`. For more information, see: [hts.usitc.gov/current](https://hts.usitc.gov/current).
61 62 63 |
# File 'lib/usps_api/models/international_labels_customs_form_package_contents.rb', line 61 def hs_tariff_number @hs_tariff_number end |
#item_category ⇒ String
Category of the item being shipped.
70 71 72 |
# File 'lib/usps_api/models/international_labels_customs_form_package_contents.rb', line 70 def item_category @item_category end |
#item_description ⇒ String
Description of the item. It is important to note that the following descriptions, regardless of case sensitivity, are not considered valid: None, Not Applicable, N/A, Null, Gift, and Merchandise.
16 17 18 |
# File 'lib/usps_api/models/international_labels_customs_form_package_contents.rb', line 16 def item_description @item_description end |
#item_quantity ⇒ Integer
Quantity of the item. Integer value required.
20 21 22 |
# File 'lib/usps_api/models/international_labels_customs_form_package_contents.rb', line 20 def item_quantity @item_quantity end |
#item_subcategory ⇒ String
Subcategory of the item being shipped.
74 75 76 |
# File 'lib/usps_api/models/international_labels_customs_form_package_contents.rb', line 74 def item_subcategory @item_subcategory end |
#item_total_value ⇒ Float
The total item value, in USD, of the items matching the ‘[itemDescription]`.
31 32 33 |
# File 'lib/usps_api/models/international_labels_customs_form_package_contents.rb', line 31 def item_total_value @item_total_value end |
#item_total_weight ⇒ Float
Provide the total weight in weightUOM for the all the items matching the ‘[itemDescription]`.
49 50 51 |
# File 'lib/usps_api/models/international_labels_customs_form_package_contents.rb', line 49 def item_total_weight @item_total_weight end |
#item_value ⇒ Float
Value of the individual item in USD. Note: This field has been deprecated in favor of itemTotalValue and will be removed in a future release. Please transition to using itemTotalValue.
26 27 28 |
# File 'lib/usps_api/models/international_labels_customs_form_package_contents.rb', line 26 def item_value @item_value end |
#item_weight ⇒ Float
Provide the weight in weightUOM for the individual item listed with ‘[itemDescription]`. Note: This field has been deprecated in favor of itemTotalWeight and will be removed in a future release. Please transition to using itemTotalWeight.
44 45 46 |
# File 'lib/usps_api/models/international_labels_customs_form_package_contents.rb', line 44 def item_weight @item_weight end |
#weight_uom ⇒ WeightUom1
Weight Unit of Measurement.
* lb - Pounds
36 37 38 |
# File 'lib/usps_api/models/international_labels_customs_form_package_contents.rb', line 36 def weight_uom @weight_uom end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 |
# File 'lib/usps_api/models/international_labels_customs_form_package_contents.rb', line 139 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. item_description = hash.key?('itemDescription') ? hash['itemDescription'] : SKIP item_quantity = hash.key?('itemQuantity') ? hash['itemQuantity'] : SKIP item_value = hash.key?('itemValue') ? hash['itemValue'] : SKIP item_total_value = hash.key?('itemTotalValue') ? hash['itemTotalValue'] : SKIP weight_uom = hash['weightUOM'] ||= WeightUom1::LB item_weight = hash.key?('itemWeight') ? hash['itemWeight'] : SKIP item_total_weight = hash.key?('itemTotalWeight') ? hash['itemTotalWeight'] : SKIP hs_tariff_number = hash.key?('HSTariffNumber') ? hash['HSTariffNumber'] : SKIP countryof_origin = hash.key?('countryofOrigin') ? hash['countryofOrigin'] : SKIP item_category = hash.key?('itemCategory') ? hash['itemCategory'] : SKIP item_subcategory = hash.key?('itemSubcategory') ? hash['itemSubcategory'] : 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. InternationalLabelsCustomsFormPackageContents.new(item_description: item_description, item_quantity: item_quantity, item_value: item_value, item_total_value: item_total_value, weight_uom: weight_uom, item_weight: item_weight, item_total_weight: item_total_weight, hs_tariff_number: hs_tariff_number, countryof_origin: countryof_origin, item_category: item_category, item_subcategory: item_subcategory, 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 90 91 |
# File 'lib/usps_api/models/international_labels_customs_form_package_contents.rb', line 77 def self.names @_hash = {} if @_hash.nil? @_hash['item_description'] = 'itemDescription' @_hash['item_quantity'] = 'itemQuantity' @_hash['item_value'] = 'itemValue' @_hash['item_total_value'] = 'itemTotalValue' @_hash['weight_uom'] = 'weightUOM' @_hash['item_weight'] = 'itemWeight' @_hash['item_total_weight'] = 'itemTotalWeight' @_hash['hs_tariff_number'] = 'HSTariffNumber' @_hash['countryof_origin'] = 'countryofOrigin' @_hash['item_category'] = 'itemCategory' @_hash['item_subcategory'] = 'itemSubcategory' @_hash end |
.nullables ⇒ Object
An array for nullable fields
111 112 113 |
# File 'lib/usps_api/models/international_labels_customs_form_package_contents.rb', line 111 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/usps_api/models/international_labels_customs_form_package_contents.rb', line 94 def self.optionals %w[ item_description item_quantity item_value item_total_value weight_uom item_weight item_total_weight hs_tariff_number countryof_origin item_category item_subcategory ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
195 196 197 198 199 200 201 202 203 204 |
# File 'lib/usps_api/models/international_labels_customs_form_package_contents.rb', line 195 def inspect class_name = self.class.name.split('::').last "<#{class_name} item_description: #{@item_description.inspect}, item_quantity:"\ " #{@item_quantity.inspect}, item_value: #{@item_value.inspect}, item_total_value:"\ " #{@item_total_value.inspect}, weight_uom: #{@weight_uom.inspect}, item_weight:"\ " #{@item_weight.inspect}, item_total_weight: #{@item_total_weight.inspect},"\ " hs_tariff_number: #{@hs_tariff_number.inspect}, countryof_origin:"\ " #{@countryof_origin.inspect}, item_category: #{@item_category.inspect}, item_subcategory:"\ " #{@item_subcategory.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
184 185 186 187 188 189 190 191 192 |
# File 'lib/usps_api/models/international_labels_customs_form_package_contents.rb', line 184 def to_s class_name = self.class.name.split('::').last "<#{class_name} item_description: #{@item_description}, item_quantity: #{@item_quantity},"\ " item_value: #{@item_value}, item_total_value: #{@item_total_value}, weight_uom:"\ " #{@weight_uom}, item_weight: #{@item_weight}, item_total_weight: #{@item_total_weight},"\ " hs_tariff_number: #{@hs_tariff_number}, countryof_origin: #{@countryof_origin},"\ " item_category: #{@item_category}, item_subcategory: #{@item_subcategory},"\ " additional_properties: #{@additional_properties}>" end |