Class: UspsApi::InternationalBaseRatesQuery
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- UspsApi::InternationalBaseRatesQuery
- Defined in:
- lib/usps_api/models/international_base_rates_query.rb
Overview
Search parameters for base rates.
Instance Attribute Summary collapse
-
#account_number ⇒ String
The Enterprise Payment Account, Permit number or PC Postage meter number associated with a contract.
-
#account_type ⇒ AccountType1
The type of payment account linked to a contract rate.
-
#destination_country_code ⇒ String
The ISO 3166-1 alpha-2 code representing the shipping destination.
-
#destination_entry_facility_type ⇒ DestinationEntryFacilityType2
Types of Facilities * NONE - Translate to Destination Rate Indicator N * INTERNATIONAL_SERVICE_CENTER - Translate to Destination Rate Indicator I.
-
#foreign_postal_code ⇒ String
The foreign postal code for the package.
-
#height ⇒ Float
The package height in inches.
-
#length ⇒ Float
The package length in inches.
-
#mail_class ⇒ MailClass4
The mail service requested.
-
#mailing_date ⇒ Date
The date the package or letter/flat will be mailed.
-
#origin_zip_code ⇒ String
The originating ZIP Code for the package.
-
#price_type ⇒ InternationalPriceType
Price type can be * ‘RETAIL’ * ‘COMMERCIAL’ * ‘COMMERCIAL_BASE’ * ‘COMMERCIAL_PLUS’ * ‘CONTRACT’.
-
#processing_category ⇒ ProcessingCategory5
Value designates if shipment is ‘MACHINABLE`, `NONSTANDARD, or `FLATS`.
-
#rate_indicator ⇒ RateIndicator2
Use to specify USPS® containers/packaging or container attributes that may affect postage.
-
#weight ⇒ Float
The calculated weight for the package based on user input.
-
#width ⇒ Float
The package width in inches.
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(origin_zip_code:, weight:, length:, width:, height:, mail_class:, processing_category:, rate_indicator:, destination_entry_facility_type:, price_type:, destination_country_code:, mailing_date: SKIP, foreign_postal_code: SKIP, account_type: SKIP, account_number: SKIP) ⇒ InternationalBaseRatesQuery
constructor
A new instance of InternationalBaseRatesQuery.
-
#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(origin_zip_code:, weight:, length:, width:, height:, mail_class:, processing_category:, rate_indicator:, destination_entry_facility_type:, price_type:, destination_country_code:, mailing_date: SKIP, foreign_postal_code: SKIP, account_type: SKIP, account_number: SKIP) ⇒ InternationalBaseRatesQuery
Returns a new instance of InternationalBaseRatesQuery.
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 |
# File 'lib/usps_api/models/international_base_rates_query.rb', line 153 def initialize(origin_zip_code:, weight:, length:, width:, height:, mail_class:, processing_category:, rate_indicator:, destination_entry_facility_type:, price_type:, destination_country_code:, mailing_date: SKIP, foreign_postal_code: SKIP, account_type: SKIP, account_number: SKIP) @origin_zip_code = origin_zip_code @weight = weight @length = length @width = width @height = height @mail_class = mail_class @processing_category = processing_category @rate_indicator = rate_indicator @destination_entry_facility_type = destination_entry_facility_type @price_type = price_type @mailing_date = mailing_date unless mailing_date == SKIP @foreign_postal_code = foreign_postal_code unless foreign_postal_code == SKIP @destination_country_code = destination_country_code @account_type = account_type unless account_type == SKIP @account_number = account_number unless account_number == SKIP end |
Instance Attribute Details
#account_number ⇒ String
The Enterprise Payment Account, Permit number or PC Postage meter number associated with a contract.
114 115 116 |
# File 'lib/usps_api/models/international_base_rates_query.rb', line 114 def account_number @account_number end |
#account_type ⇒ AccountType1
The type of payment account linked to a contract rate. Note:
-
‘METER` pricing is only available to PC Postage providers.
109 110 111 |
# File 'lib/usps_api/models/international_base_rates_query.rb', line 109 def account_type @account_type end |
#destination_country_code ⇒ String
The ISO 3166-1 alpha-2 code representing the shipping destination.
103 104 105 |
# File 'lib/usps_api/models/international_base_rates_query.rb', line 103 def destination_country_code @destination_country_code end |
#destination_entry_facility_type ⇒ DestinationEntryFacilityType2
Types of Facilities
* NONE - Translate to Destination Rate Indicator N
* INTERNATIONAL_SERVICE_CENTER - Translate to Destination Rate Indicator
I
80 81 82 |
# File 'lib/usps_api/models/international_base_rates_query.rb', line 80 def destination_entry_facility_type @destination_entry_facility_type end |
#foreign_postal_code ⇒ String
The foreign postal code for the package. Note:
-
Different shipping destinations may require a postal code for shipping.
For more details, review the [Individual Country Listing](pe.usps.com/text/imm/immctry.htm) for your shipping destination
99 100 101 |
# File 'lib/usps_api/models/international_base_rates_query.rb', line 99 def foreign_postal_code @foreign_postal_code end |
#height ⇒ Float
The package height in inches.
33 34 35 |
# File 'lib/usps_api/models/international_base_rates_query.rb', line 33 def height @height end |
#length ⇒ Float
The package length in inches. The maximum dimension is always length.
24 25 26 |
# File 'lib/usps_api/models/international_base_rates_query.rb', line 24 def length @length end |
#mail_class ⇒ MailClass4
The mail service requested.
* 'FIRST-CLASS_PACKAGE_INTERNATIONAL_SERVICE'
* 'PRIORITY_MAIL_INTERNATIONAL'
* 'PRIORITY_MAIL_EXPRESS_INTERNATIONAL'
* 'GLOBAL_EXPRESS_GUARANTEED' - Global Express Guaranteed Service is
suspended as of September 29, 2024.
42 43 44 |
# File 'lib/usps_api/models/international_base_rates_query.rb', line 42 def mail_class @mail_class end |
#mailing_date ⇒ Date
The date the package or letter/flat will be mailed. The mailing date may be today plus 0 to 7 days in advance.
90 91 92 |
# File 'lib/usps_api/models/international_base_rates_query.rb', line 90 def mailing_date @mailing_date end |
#origin_zip_code ⇒ String
The originating ZIP Code for the package.
14 15 16 |
# File 'lib/usps_api/models/international_base_rates_query.rb', line 14 def origin_zip_code @origin_zip_code end |
#price_type ⇒ InternationalPriceType
Price type can be * ‘RETAIL’ * ‘COMMERCIAL’ * ‘COMMERCIAL_BASE’ * ‘COMMERCIAL_PLUS’ * ‘CONTRACT’
85 86 87 |
# File 'lib/usps_api/models/international_base_rates_query.rb', line 85 def price_type @price_type end |
#processing_category ⇒ ProcessingCategory5
Value designates if shipment is ‘MACHINABLE`, `NONSTANDARD, or `FLATS`. Note:
-
‘NON_MACHINABLE` is deprecated and will convert to `NONSTANDARD` as of
01/19/2025.
49 50 51 |
# File 'lib/usps_api/models/international_base_rates_query.rb', line 49 def processing_category @processing_category end |
#rate_indicator ⇒ RateIndicator2
Use to specify USPS® containers/packaging or container attributes that may affect postage.
* E4 - Priority Mail Express Flat Rate Envelope - Post Office To
Addressee
* E6 - Priority Mail Express Legal Flat Rate Envelope
* FA - Legal Flat Rate Envelope
* FB - Medium Flat Rate Box/Large Flat Rate Bag
* FE - Flat Rate Envelope
* FP - Padded Flat Rate Envelope
* FS - Small Flat Rate Box
* PA - Priority Mail Express International Single Piece
* PL - Large Flat Rate Box
* SP - Single Piece
* EP - ECOMPRO Single Piece
* HA - ECOMPRO Legal Flat Rate Envelope
* HB - ECOMPRO Medium Flat Rate Box
* HE - ECOMPRO Flat Rate Envelope
* HL - ECOMPRO Large Flat Rate Box
* HP - ECOMPRO Padded Flat Rate Envelope
* HS - ECOMPRO Small Flat Rate Box
* LE - Single-piece parcel
73 74 75 |
# File 'lib/usps_api/models/international_base_rates_query.rb', line 73 def rate_indicator @rate_indicator 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. Weight unit of measurement is in pounds.
20 21 22 |
# File 'lib/usps_api/models/international_base_rates_query.rb', line 20 def weight @weight end |
#width ⇒ Float
The package width in inches. The second longest dimension is always width.
29 30 31 |
# File 'lib/usps_api/models/international_base_rates_query.rb', line 29 def width @width end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
177 178 179 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 211 212 213 214 215 216 217 |
# File 'lib/usps_api/models/international_base_rates_query.rb', line 177 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. origin_zip_code = hash.key?('originZIPCode') ? hash['originZIPCode'] : nil weight = hash.key?('weight') ? hash['weight'] : nil length = hash.key?('length') ? hash['length'] : nil width = hash.key?('width') ? hash['width'] : nil height = hash.key?('height') ? hash['height'] : nil mail_class = hash.key?('mailClass') ? hash['mailClass'] : nil processing_category = hash.key?('processingCategory') ? hash['processingCategory'] : nil rate_indicator = hash.key?('rateIndicator') ? hash['rateIndicator'] : nil destination_entry_facility_type = hash.key?('destinationEntryFacilityType') ? hash['destinationEntryFacilityType'] : nil price_type = hash.key?('priceType') ? hash['priceType'] : nil destination_country_code = hash.key?('destinationCountryCode') ? hash['destinationCountryCode'] : nil mailing_date = hash.key?('mailingDate') ? hash['mailingDate'] : SKIP foreign_postal_code = hash.key?('foreignPostalCode') ? hash['foreignPostalCode'] : SKIP account_type = hash.key?('accountType') ? hash['accountType'] : SKIP account_number = hash.key?('accountNumber') ? hash['accountNumber'] : SKIP # Create object from extracted values. InternationalBaseRatesQuery.new(origin_zip_code: origin_zip_code, weight: weight, length: length, width: width, height: height, mail_class: mail_class, processing_category: processing_category, rate_indicator: rate_indicator, destination_entry_facility_type: destination_entry_facility_type, price_type: price_type, destination_country_code: destination_country_code, mailing_date: mailing_date, foreign_postal_code: foreign_postal_code, account_type: account_type, account_number: account_number) end |
.names ⇒ Object
A mapping from model property names to API property names.
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_base_rates_query.rb', line 117 def self.names @_hash = {} if @_hash.nil? @_hash['origin_zip_code'] = 'originZIPCode' @_hash['weight'] = 'weight' @_hash['length'] = 'length' @_hash['width'] = 'width' @_hash['height'] = 'height' @_hash['mail_class'] = 'mailClass' @_hash['processing_category'] = 'processingCategory' @_hash['rate_indicator'] = 'rateIndicator' @_hash['destination_entry_facility_type'] = 'destinationEntryFacilityType' @_hash['price_type'] = 'priceType' @_hash['mailing_date'] = 'mailingDate' @_hash['foreign_postal_code'] = 'foreignPostalCode' @_hash['destination_country_code'] = 'destinationCountryCode' @_hash['account_type'] = 'accountType' @_hash['account_number'] = 'accountNumber' @_hash end |
.nullables ⇒ Object
An array for nullable fields
149 150 151 |
# File 'lib/usps_api/models/international_base_rates_query.rb', line 149 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
139 140 141 142 143 144 145 146 |
# File 'lib/usps_api/models/international_base_rates_query.rb', line 139 def self.optionals %w[ mailing_date foreign_postal_code account_type account_number ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
232 233 234 235 236 237 238 239 240 241 242 243 |
# File 'lib/usps_api/models/international_base_rates_query.rb', line 232 def inspect class_name = self.class.name.split('::').last "<#{class_name} origin_zip_code: #{@origin_zip_code.inspect}, weight: #{@weight.inspect},"\ " length: #{@length.inspect}, width: #{@width.inspect}, height: #{@height.inspect},"\ " mail_class: #{@mail_class.inspect}, processing_category: #{@processing_category.inspect},"\ " rate_indicator: #{@rate_indicator.inspect}, destination_entry_facility_type:"\ " #{@destination_entry_facility_type.inspect}, price_type: #{@price_type.inspect},"\ " mailing_date: #{@mailing_date.inspect}, foreign_postal_code:"\ " #{@foreign_postal_code.inspect}, destination_country_code:"\ " #{@destination_country_code.inspect}, account_type: #{@account_type.inspect},"\ " account_number: #{@account_number.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
220 221 222 223 224 225 226 227 228 229 |
# File 'lib/usps_api/models/international_base_rates_query.rb', line 220 def to_s class_name = self.class.name.split('::').last "<#{class_name} origin_zip_code: #{@origin_zip_code}, weight: #{@weight}, length:"\ " #{@length}, width: #{@width}, height: #{@height}, mail_class: #{@mail_class},"\ " processing_category: #{@processing_category}, rate_indicator: #{@rate_indicator},"\ " destination_entry_facility_type: #{@destination_entry_facility_type}, price_type:"\ " #{@price_type}, mailing_date: #{@mailing_date}, foreign_postal_code:"\ " #{@foreign_postal_code}, destination_country_code: #{@destination_country_code},"\ " account_type: #{@account_type}, account_number: #{@account_number}>" end |