Class: UspsApi::InternationalPricesRateDetails
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- UspsApi::InternationalPricesRateDetails
- Defined in:
- lib/usps_api/models/international_prices_rate_details.rb
Overview
Informative details about the price.
Instance Attribute Summary collapse
-
#description ⇒ String
The description of the price.
-
#destination_entry_facility_type ⇒ DestinationEntryFacilityType2
Destination Entry Facility type for the provided rate, this value can be used in the international labels API to ensure the provided rate is applied.
-
#dim_weight ⇒ Float
The calculated dimensional weight for the package based on user provided dimensions.
-
#end_date ⇒ String
Effective end date of the rate.
-
#fees ⇒ Array[Fee1]
The fees associated with the package.
-
#mail_class ⇒ String
The mail class of the price.
-
#price ⇒ Float
The postage price.
-
#price_type ⇒ PriceType11
The type of price applied.
-
#processing_category ⇒ ProcessingCategory11
Processing category for the provided rate, this value can be used in the international labels API to ensure the provided rate is applied.
-
#product_definition ⇒ String
A business friendly description for a product that can be displayed to a customer on a shipping portal.
-
#product_name ⇒ String
A business friendly name for a product that can be displayed to a customer on a shipping portal.
-
#rate_indicator ⇒ String
Two-digit rate indicator code for the provided rate, this value can be used in the international labels API to ensure the provided rate is applied.
-
#sku ⇒ String
The stock keeping unit for the designated rate.
-
#start_date ⇒ Date
Effective start date of the rate.
-
#warnings ⇒ Array[ContainersContainerWarnings]
A list of warnings associated with the rate calculation.
-
#weight ⇒ Float
The calculated weight for the package based on user input.
-
#zone ⇒ String
Indicates the price group for a given ‘destinationCountryCode`, `mailClass`, `mailingDate`, and `rateIndicator`.
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(sku: SKIP, description: SKIP, price_type: SKIP, price: SKIP, weight: SKIP, dim_weight: SKIP, fees: SKIP, start_date: SKIP, end_date: SKIP, mail_class: SKIP, zone: SKIP, processing_category: SKIP, rate_indicator: SKIP, destination_entry_facility_type: SKIP, warnings: SKIP, product_name: SKIP, product_definition: SKIP) ⇒ InternationalPricesRateDetails
constructor
A new instance of InternationalPricesRateDetails.
-
#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(sku: SKIP, description: SKIP, price_type: SKIP, price: SKIP, weight: SKIP, dim_weight: SKIP, fees: SKIP, start_date: SKIP, end_date: SKIP, mail_class: SKIP, zone: SKIP, processing_category: SKIP, rate_indicator: SKIP, destination_entry_facility_type: SKIP, warnings: SKIP, product_name: SKIP, product_definition: SKIP) ⇒ InternationalPricesRateDetails
Returns a new instance of InternationalPricesRateDetails.
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 |
# File 'lib/usps_api/models/international_prices_rate_details.rb', line 169 def initialize(sku: SKIP, description: SKIP, price_type: SKIP, price: SKIP, weight: SKIP, dim_weight: SKIP, fees: SKIP, start_date: SKIP, end_date: SKIP, mail_class: SKIP, zone: SKIP, processing_category: SKIP, rate_indicator: SKIP, destination_entry_facility_type: SKIP, warnings: SKIP, product_name: SKIP, product_definition: SKIP) @sku = sku unless sku == SKIP @description = description unless description == SKIP @price_type = price_type unless price_type == SKIP @price = price unless price == SKIP @weight = weight unless weight == SKIP @dim_weight = dim_weight unless dim_weight == SKIP @fees = fees unless fees == SKIP @start_date = start_date unless start_date == SKIP @end_date = end_date unless end_date == SKIP @mail_class = mail_class unless mail_class == SKIP @zone = zone unless zone == SKIP @processing_category = processing_category unless processing_category == SKIP @rate_indicator = rate_indicator unless rate_indicator == SKIP unless destination_entry_facility_type == SKIP @destination_entry_facility_type = destination_entry_facility_type end @warnings = warnings unless warnings == SKIP @product_name = product_name unless product_name == SKIP @product_definition = product_definition unless product_definition == SKIP end |
Instance Attribute Details
#description ⇒ String
The description of the price.
18 19 20 |
# File 'lib/usps_api/models/international_prices_rate_details.rb', line 18 def description @description end |
#destination_entry_facility_type ⇒ DestinationEntryFacilityType2
Destination Entry Facility type for the provided rate, this value can be used in the international labels API to ensure the provided rate is applied.
-
‘NONE` - None, translates to PTR code `N`
-
‘INTERNATIONAL_SERVICE_CENTER` - International Service Center,
translates to PTR code ‘I`
101 102 103 |
# File 'lib/usps_api/models/international_prices_rate_details.rb', line 101 def destination_entry_facility_type @destination_entry_facility_type end |
#dim_weight ⇒ Float
The calculated dimensional weight for the package based on user provided dimensions. The greater of dimWeight and weight will be used to calculated the rate.
41 42 43 |
# File 'lib/usps_api/models/international_prices_rate_details.rb', line 41 def dim_weight @dim_weight end |
#end_date ⇒ String
Effective end date of the rate. If blank the rate doesn’t have an end date as of yet.
54 55 56 |
# File 'lib/usps_api/models/international_prices_rate_details.rb', line 54 def end_date @end_date end |
#fees ⇒ Array[Fee1]
The fees associated with the package.
45 46 47 |
# File 'lib/usps_api/models/international_prices_rate_details.rb', line 45 def fees @fees end |
#mail_class ⇒ String
The mail class of the price.
58 59 60 |
# File 'lib/usps_api/models/international_prices_rate_details.rb', line 58 def mail_class @mail_class end |
#price ⇒ Float
The postage price.
30 31 32 |
# File 'lib/usps_api/models/international_prices_rate_details.rb', line 30 def price @price end |
#price_type ⇒ PriceType11
The type of price applied.
* Valid Options for Domestic Prices include: 'RETAIL','COMMERCIAL' &
‘CONTRACT’
* Valid Options for International Prices include: 'RETAIL', 'COMMERCIAL',
‘COMMERCIAL_BASE’, ‘COMMERCIAL_PLUS’ & ‘CONTRACT’
26 27 28 |
# File 'lib/usps_api/models/international_prices_rate_details.rb', line 26 def price_type @price_type end |
#processing_category ⇒ ProcessingCategory11
Processing category for the provided rate, this value can be used in the international labels API to ensure the provided rate is applied.
-
‘CARDS` - Cards, translates to PTR code `0`
-
‘LETTERS` - Letters, translates to PTR code `1`
-
‘FLATS` - Flats, translates to PTR code `2`
-
‘MACHINABLE` - Machinable Parcel, translates to PTR code `3`
-
‘IRREGULAR` - Irregular Parcel, translates to PTR code `4` - This option
is deprecated in favor of ‘NONSTANDARD` and will no longer be returned as of 01/19/2025.
-
‘NON_MACHINABLE` - Non-machinable parcel, translates to PTR code `5` -
This option is deprecated in favor of ‘NONSTANDARD` and will no longer be returned as of 01/19/2025.
-
‘NONSTANDARD` - Nonstandard Parcel, translates to PTR code `5`
-
‘CATALOGS` - Catalogs, translates to PTR code `C`
-
‘OPEN_AND_DISTRIBUTE` - Open and Distribute, translates to PTR code `O`
-
‘RETURNS` - Returns, translates to PTR code `R`
-
‘SOFT_PACK_MACHINABLE` - Soft Pack Machinable, translates to PTR code
‘S`
-
‘SOFT_PACK_NON_MACHINABLE` - Soft Package Non-machinable, translates to
PTR code ‘T`
86 87 88 |
# File 'lib/usps_api/models/international_prices_rate_details.rb', line 86 def processing_category @processing_category end |
#product_definition ⇒ String
A business friendly description for a product that can be displayed to a customer on a shipping portal
115 116 117 |
# File 'lib/usps_api/models/international_prices_rate_details.rb', line 115 def product_definition @product_definition end |
#product_name ⇒ String
A business friendly name for a product that can be displayed to a customer on a shipping portal
110 111 112 |
# File 'lib/usps_api/models/international_prices_rate_details.rb', line 110 def product_name @product_name end |
#rate_indicator ⇒ String
Two-digit rate indicator code for the provided rate, this value can be used in the international labels API to ensure the provided rate is applied.
92 93 94 |
# File 'lib/usps_api/models/international_prices_rate_details.rb', line 92 def rate_indicator @rate_indicator end |
#sku ⇒ String
The stock keeping unit for the designated rate.
14 15 16 |
# File 'lib/usps_api/models/international_prices_rate_details.rb', line 14 def sku @sku end |
#start_date ⇒ Date
Effective start date of the rate.
49 50 51 |
# File 'lib/usps_api/models/international_prices_rate_details.rb', line 49 def start_date @start_date end |
#warnings ⇒ Array[ContainersContainerWarnings]
A list of warnings associated with the rate calculation.
105 106 107 |
# File 'lib/usps_api/models/international_prices_rate_details.rb', line 105 def warnings @warnings end |
#weight ⇒ Float
The calculated weight for the package based on user input. The greater of dimWeight and weight will be used to calculated the rate.
35 36 37 |
# File 'lib/usps_api/models/international_prices_rate_details.rb', line 35 def weight @weight end |
#zone ⇒ String
Indicates the price group for a given ‘destinationCountryCode`, `mailClass`, `mailingDate`, and `rateIndicator`.
63 64 65 |
# File 'lib/usps_api/models/international_prices_rate_details.rb', line 63 def zone @zone end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 |
# File 'lib/usps_api/models/international_prices_rate_details.rb', line 198 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. sku = hash.key?('SKU') ? hash['SKU'] : SKIP description = hash.key?('description') ? hash['description'] : SKIP price_type = hash.key?('priceType') ? hash['priceType'] : SKIP price = hash.key?('price') ? hash['price'] : SKIP weight = hash.key?('weight') ? hash['weight'] : SKIP dim_weight = hash.key?('dimWeight') ? hash['dimWeight'] : SKIP # Parameter is an array, so we need to iterate through it fees = nil unless hash['fees'].nil? fees = [] hash['fees'].each do |structure| fees << (Fee1.from_hash(structure) if structure) end end fees = SKIP unless hash.key?('fees') start_date = hash.key?('startDate') ? hash['startDate'] : SKIP end_date = hash.key?('endDate') ? hash['endDate'] : SKIP mail_class = hash.key?('mailClass') ? hash['mailClass'] : SKIP zone = hash.key?('zone') ? hash['zone'] : SKIP processing_category = hash.key?('processingCategory') ? hash['processingCategory'] : SKIP rate_indicator = hash.key?('rateIndicator') ? hash['rateIndicator'] : SKIP destination_entry_facility_type = hash.key?('destinationEntryFacilityType') ? hash['destinationEntryFacilityType'] : SKIP # Parameter is an array, so we need to iterate through it warnings = nil unless hash['warnings'].nil? warnings = [] hash['warnings'].each do |structure| warnings << (ContainersContainerWarnings.from_hash(structure) if structure) end end warnings = SKIP unless hash.key?('warnings') product_name = hash.key?('productName') ? hash['productName'] : SKIP product_definition = hash.key?('productDefinition') ? hash['productDefinition'] : SKIP # Create object from extracted values. InternationalPricesRateDetails.new(sku: sku, description: description, price_type: price_type, price: price, weight: weight, dim_weight: dim_weight, fees: fees, start_date: start_date, end_date: end_date, mail_class: mail_class, zone: zone, processing_category: processing_category, rate_indicator: rate_indicator, destination_entry_facility_type: destination_entry_facility_type, warnings: warnings, product_name: product_name, product_definition: product_definition) end |
.names ⇒ Object
A mapping from model property names to API property names.
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
# File 'lib/usps_api/models/international_prices_rate_details.rb', line 118 def self.names @_hash = {} if @_hash.nil? @_hash['sku'] = 'SKU' @_hash['description'] = 'description' @_hash['price_type'] = 'priceType' @_hash['price'] = 'price' @_hash['weight'] = 'weight' @_hash['dim_weight'] = 'dimWeight' @_hash['fees'] = 'fees' @_hash['start_date'] = 'startDate' @_hash['end_date'] = 'endDate' @_hash['mail_class'] = 'mailClass' @_hash['zone'] = 'zone' @_hash['processing_category'] = 'processingCategory' @_hash['rate_indicator'] = 'rateIndicator' @_hash['destination_entry_facility_type'] = 'destinationEntryFacilityType' @_hash['warnings'] = 'warnings' @_hash['product_name'] = 'productName' @_hash['product_definition'] = 'productDefinition' @_hash end |
.nullables ⇒ Object
An array for nullable fields
165 166 167 |
# File 'lib/usps_api/models/international_prices_rate_details.rb', line 165 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
# File 'lib/usps_api/models/international_prices_rate_details.rb', line 142 def self.optionals %w[ sku description price_type price weight dim_weight fees start_date end_date mail_class zone processing_category rate_indicator destination_entry_facility_type warnings product_name product_definition ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
274 275 276 277 278 279 280 281 282 283 284 |
# File 'lib/usps_api/models/international_prices_rate_details.rb', line 274 def inspect class_name = self.class.name.split('::').last "<#{class_name} sku: #{@sku.inspect}, description: #{@description.inspect}, price_type:"\ " #{@price_type.inspect}, price: #{@price.inspect}, weight: #{@weight.inspect}, dim_weight:"\ " #{@dim_weight.inspect}, fees: #{@fees.inspect}, start_date: #{@start_date.inspect},"\ " end_date: #{@end_date.inspect}, mail_class: #{@mail_class.inspect}, zone:"\ " #{@zone.inspect}, processing_category: #{@processing_category.inspect}, rate_indicator:"\ " #{@rate_indicator.inspect}, destination_entry_facility_type:"\ " #{@destination_entry_facility_type.inspect}, warnings: #{@warnings.inspect}, product_name:"\ " #{@product_name.inspect}, product_definition: #{@product_definition.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
262 263 264 265 266 267 268 269 270 271 |
# File 'lib/usps_api/models/international_prices_rate_details.rb', line 262 def to_s class_name = self.class.name.split('::').last "<#{class_name} sku: #{@sku}, description: #{@description}, price_type: #{@price_type},"\ " price: #{@price}, weight: #{@weight}, dim_weight: #{@dim_weight}, fees: #{@fees},"\ " start_date: #{@start_date}, end_date: #{@end_date}, mail_class: #{@mail_class}, zone:"\ " #{@zone}, processing_category: #{@processing_category}, rate_indicator:"\ " #{@rate_indicator}, destination_entry_facility_type: #{@destination_entry_facility_type},"\ " warnings: #{@warnings}, product_name: #{@product_name}, product_definition:"\ " #{@product_definition}>" end |