Class: UspsApi::PricesRateDetails
- Defined in:
- lib/usps_api/models/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 ⇒ DestinationEntryFacilityType11
Destination Entry Facility type for the provided rate, this value can be used in the 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 ⇒ PriceType
The type of price applied.
-
#processing_category ⇒ ProcessingCategory11
Processing category for the provided rate, this value can be used in the 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 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.
-
#weight ⇒ Float
The calculated weight for the package based on user input.
-
#zone ⇒ String
Indicates the calculated zone between the provided ‘originZIPCode` and `destinationZIPCode` for a given `mailClass`, `mailingDate`, and `weight`.
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, product_name: SKIP, product_definition: SKIP, processing_category: SKIP, rate_indicator: SKIP, destination_entry_facility_type: SKIP, additional_properties: nil) ⇒ PricesRateDetails
constructor
A new instance of PricesRateDetails.
-
#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, product_name: SKIP, product_definition: SKIP, processing_category: SKIP, rate_indicator: SKIP, destination_entry_facility_type: SKIP, additional_properties: nil) ⇒ PricesRateDetails
Returns a new instance of PricesRateDetails.
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 |
# File 'lib/usps_api/models/prices_rate_details.rb', line 180 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, product_name: SKIP, product_definition: SKIP, processing_category: SKIP, rate_indicator: SKIP, destination_entry_facility_type: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @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 @product_name = product_name unless product_name == SKIP @product_definition = product_definition unless product_definition == 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 @additional_properties = additional_properties end |
Instance Attribute Details
#description ⇒ String
The description of the price.
18 19 20 |
# File 'lib/usps_api/models/prices_rate_details.rb', line 18 def description @description end |
#destination_entry_facility_type ⇒ DestinationEntryFacilityType11
Destination Entry Facility type for the provided rate, this value can be used in the labels API to ensure the provided rate is applied.
-
‘NONE` - None, translates to PTR code `N`
-
‘AREA_DISTRIBUTION_CENTER` - Area Distribution Center, translates to PTR
code ‘A`
-
‘AUXILIARY_SERVICE_FACILITY` - Auxiliary Service Facility, translates to
PTR code ‘F`
-
‘DESTINATION_DELIVERY_UNIT` - Destination Delivery Unit, translates to
PTR code ‘D`
-
‘DESTINATION_NETWORK_DISTRIBUTION_CENTER` - Destination Network
Distribution Center, translates to PTR code ‘B`
-
‘DESTINATION_SECTIONAL_CENTER_FACILITY` - Destination Sectional Center
Facility, translates to PTR code ‘S`
-
‘DESTINATION_SERVICE_HUB` - Destination Service Hub, translates to PTR
code ‘H`
-
‘DESTINATION_REGIONAL_PROCESSING_DISTRIBUTION_CENTER` - Destination
Regional Processing Distribution Center, translates to PTR code ‘B` Note:
-
Effective 01/18/2026: ‘DESTINATION_NETWORK_DISTRIBUTION_CENTER` with
‘PARCEL_SELECT` is no longer eligible.
-
Effective 01/18/2026: (NSA Only)
‘DESTINATION_REGIONAL_PROCESSING_DISTRIBUTION_CENTER` with `PARCEL_SELECT` is available as an option.
128 129 130 |
# File 'lib/usps_api/models/prices_rate_details.rb', line 128 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/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/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/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/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/prices_rate_details.rb', line 30 def price @price end |
#price_type ⇒ PriceType
The type of price applied.
* Valid Options for Domestic Prices include: 'RETAIL','COMMERCIAL',
‘CONTRACT’ & ‘NSA’ (deprecated)
* Valid Options for International Prices include: 'RETAIL', 'COMMERCIAL',
‘COMMERCIAL_BASE’, ‘COMMERCIAL_PLUS’, ‘CONTRACT’ & ‘NSA’ (deprecated)
26 27 28 |
# File 'lib/usps_api/models/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 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`
-
‘NON_MACHINABLE` - Non-machinable parcel, translates to PTR code `5`
-
‘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` Note:
-
‘IRREGULAR` is deprecated and will convert to `NONSTANDARD` as of
01/19/2025.
-
‘NON_MACHINABLE` is deprecated and will convert to `NONSTANDARD` as of
01/19/2025.
97 98 99 |
# File 'lib/usps_api/models/prices_rate_details.rb', line 97 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
73 74 75 |
# File 'lib/usps_api/models/prices_rate_details.rb', line 73 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
68 69 70 |
# File 'lib/usps_api/models/prices_rate_details.rb', line 68 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 labels API to ensure the provided rate is applied.
102 103 104 |
# File 'lib/usps_api/models/prices_rate_details.rb', line 102 def rate_indicator @rate_indicator end |
#sku ⇒ String
The stock keeping unit for the designated rate.
14 15 16 |
# File 'lib/usps_api/models/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/prices_rate_details.rb', line 49 def start_date @start_date 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/prices_rate_details.rb', line 35 def weight @weight end |
#zone ⇒ String
Indicates the calculated zone between the provided ‘originZIPCode` and `destinationZIPCode` for a given `mailClass`, `mailingDate`, and `weight`.
63 64 65 |
# File 'lib/usps_api/models/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.
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 260 261 262 263 264 265 266 267 268 269 270 271 |
# File 'lib/usps_api/models/prices_rate_details.rb', line 213 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 product_name = hash.key?('productName') ? hash['productName'] : SKIP product_definition = hash.key?('productDefinition') ? hash['productDefinition'] : 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 # 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. PricesRateDetails.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, product_name: product_name, product_definition: product_definition, processing_category: processing_category, rate_indicator: rate_indicator, destination_entry_facility_type: destination_entry_facility_type, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
# File 'lib/usps_api/models/prices_rate_details.rb', line 131 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['product_name'] = 'productName' @_hash['product_definition'] = 'productDefinition' @_hash['processing_category'] = 'processingCategory' @_hash['rate_indicator'] = 'rateIndicator' @_hash['destination_entry_facility_type'] = 'destinationEntryFacilityType' @_hash end |
.nullables ⇒ Object
An array for nullable fields
176 177 178 |
# File 'lib/usps_api/models/prices_rate_details.rb', line 176 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 |
# File 'lib/usps_api/models/prices_rate_details.rb', line 154 def self.optionals %w[ sku description price_type price weight dim_weight fees start_date end_date mail_class zone product_name product_definition processing_category rate_indicator destination_entry_facility_type ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
286 287 288 289 290 291 292 293 294 295 296 297 |
# File 'lib/usps_api/models/prices_rate_details.rb', line 286 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}, product_name: #{@product_name.inspect}, product_definition:"\ " #{@product_definition.inspect}, processing_category: #{@processing_category.inspect},"\ " rate_indicator: #{@rate_indicator.inspect}, destination_entry_facility_type:"\ " #{@destination_entry_facility_type.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
274 275 276 277 278 279 280 281 282 283 |
# File 'lib/usps_api/models/prices_rate_details.rb', line 274 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}, product_name: #{@product_name}, product_definition: #{@product_definition},"\ " processing_category: #{@processing_category}, rate_indicator: #{@rate_indicator},"\ " destination_entry_facility_type: #{@destination_entry_facility_type},"\ " additional_properties: #{@additional_properties}>" end |