Class: UspsApi::InternationalPricesTotalRatesQuery
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- UspsApi::InternationalPricesTotalRatesQuery
- Defined in:
- lib/usps_api/models/international_prices_total_rates_query.rb
Overview
Search parameters for base rate and extra service rate.
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_city ⇒ String
When ‘requestDutiesTaxesFees` is `true` then `destinationCity` may be required based on the country of import.
-
#destination_country_code ⇒ String
The ISO 3166-1 alpha-2 code representing the shipping destination.
-
#destination_state ⇒ String
When ‘requestDutiesTaxesFees` is `true` then `destinationState` may be required based on the country of import.
-
#extra_services ⇒ Array[ExtraService21]
A list of Extra Services to be included in the total rates search.
-
#foreign_postal_code ⇒ String
The foreign postal code for the package.
-
#height ⇒ Float
The package height in inches.
-
#item_value ⇒ Float
The value of the all items in the package.
-
#items ⇒ Array[InternationalPricesDeliveryDutiesTaxesAndFeesItem]
A list of items utilized for pricing when ‘requestDutiesTaxesFees` is `true`.
-
#length ⇒ Float
The package length in inches.
-
#mail_class ⇒ MailClass21
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’.
-
#request_duties_taxes_fees ⇒ TrueClass | FalseClass
When ‘true` the returned `rateOption` elements will include the duties and taxes cost for each item and package fees.
-
#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:, destination_country_code:, weight:, length:, width:, height:, foreign_postal_code: SKIP, mailing_date: SKIP, price_type: SKIP, mail_class: SKIP, account_type: SKIP, account_number: SKIP, request_duties_taxes_fees: false, destination_city: SKIP, destination_state: SKIP, items: SKIP, item_value: SKIP, extra_services: SKIP) ⇒ InternationalPricesTotalRatesQuery
constructor
A new instance of InternationalPricesTotalRatesQuery.
-
#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:, destination_country_code:, weight:, length:, width:, height:, foreign_postal_code: SKIP, mailing_date: SKIP, price_type: SKIP, mail_class: SKIP, account_type: SKIP, account_number: SKIP, request_duties_taxes_fees: false, destination_city: SKIP, destination_state: SKIP, items: SKIP, item_value: SKIP, extra_services: SKIP) ⇒ InternationalPricesTotalRatesQuery
Returns a new instance of InternationalPricesTotalRatesQuery.
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 182 183 184 185 |
# File 'lib/usps_api/models/international_prices_total_rates_query.rb', line 157 def initialize(origin_zip_code:, destination_country_code:, weight:, length:, width:, height:, foreign_postal_code: SKIP, mailing_date: SKIP, price_type: SKIP, mail_class: SKIP, account_type: SKIP, account_number: SKIP, request_duties_taxes_fees: false, destination_city: SKIP, destination_state: SKIP, items: SKIP, item_value: SKIP, extra_services: SKIP) @origin_zip_code = origin_zip_code @foreign_postal_code = foreign_postal_code unless foreign_postal_code == SKIP @destination_country_code = destination_country_code @weight = weight @mailing_date = mailing_date unless mailing_date == SKIP @length = length @width = width @height = height @price_type = price_type unless price_type == SKIP @mail_class = mail_class unless mail_class == SKIP @account_type = account_type unless account_type == SKIP @account_number = account_number unless account_number == SKIP unless request_duties_taxes_fees == SKIP @request_duties_taxes_fees = request_duties_taxes_fees end @destination_city = destination_city unless destination_city == SKIP @destination_state = destination_state unless destination_state == SKIP @items = items unless items == SKIP @item_value = item_value unless item_value == SKIP @extra_services = extra_services unless extra_services == SKIP end |
Instance Attribute Details
#account_number ⇒ String
The Enterprise Payment Account, Permit number or PC Postage meter number associated with a contract.
77 78 79 |
# File 'lib/usps_api/models/international_prices_total_rates_query.rb', line 77 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.
72 73 74 |
# File 'lib/usps_api/models/international_prices_total_rates_query.rb', line 72 def account_type @account_type end |
#destination_city ⇒ String
When ‘requestDutiesTaxesFees` is `true` then `destinationCity` may be required based on the country of import.
87 88 89 |
# File 'lib/usps_api/models/international_prices_total_rates_query.rb', line 87 def destination_city @destination_city end |
#destination_country_code ⇒ String
The ISO 3166-1 alpha-2 code representing the shipping destination.
27 28 29 |
# File 'lib/usps_api/models/international_prices_total_rates_query.rb', line 27 def destination_country_code @destination_country_code end |
#destination_state ⇒ String
When ‘requestDutiesTaxesFees` is `true` then `destinationState` may be required based on the country of import.
92 93 94 |
# File 'lib/usps_api/models/international_prices_total_rates_query.rb', line 92 def destination_state @destination_state end |
#extra_services ⇒ Array[ExtraService21]
A list of Extra Services to be included in the total rates search. If no extra services are specified all applicable extra services for the mail class will be returned.
108 109 110 |
# File 'lib/usps_api/models/international_prices_total_rates_query.rb', line 108 def extra_services @extra_services 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
23 24 25 |
# File 'lib/usps_api/models/international_prices_total_rates_query.rb', line 23 def foreign_postal_code @foreign_postal_code end |
#height ⇒ Float
The package height in inches.
51 52 53 |
# File 'lib/usps_api/models/international_prices_total_rates_query.rb', line 51 def height @height end |
#item_value ⇒ Float
The value of the all items in the package. Required for Insurance and Registered Mail.
102 103 104 |
# File 'lib/usps_api/models/international_prices_total_rates_query.rb', line 102 def item_value @item_value end |
#items ⇒ Array[InternationalPricesDeliveryDutiesTaxesAndFeesItem]
A list of items utilized for pricing when ‘requestDutiesTaxesFees` is `true`.
97 98 99 |
# File 'lib/usps_api/models/international_prices_total_rates_query.rb', line 97 def items @items end |
#length ⇒ Float
The package length in inches. The maximum dimension is always length.
42 43 44 |
# File 'lib/usps_api/models/international_prices_total_rates_query.rb', line 42 def length @length end |
#mail_class ⇒ MailClass21
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.
* 'ALL'
66 67 68 |
# File 'lib/usps_api/models/international_prices_total_rates_query.rb', line 66 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.
38 39 40 |
# File 'lib/usps_api/models/international_prices_total_rates_query.rb', line 38 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_prices_total_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’
56 57 58 |
# File 'lib/usps_api/models/international_prices_total_rates_query.rb', line 56 def price_type @price_type end |
#request_duties_taxes_fees ⇒ TrueClass | FalseClass
When ‘true` the returned `rateOption` elements will include the duties and taxes cost for each item and package fees.
82 83 84 |
# File 'lib/usps_api/models/international_prices_total_rates_query.rb', line 82 def request_duties_taxes_fees @request_duties_taxes_fees 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.
33 34 35 |
# File 'lib/usps_api/models/international_prices_total_rates_query.rb', line 33 def weight @weight end |
#width ⇒ Float
The package width in inches. The second longest dimension is always width.
47 48 49 |
# File 'lib/usps_api/models/international_prices_total_rates_query.rb', line 47 def width @width end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 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 |
# File 'lib/usps_api/models/international_prices_total_rates_query.rb', line 188 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. origin_zip_code = hash.key?('originZIPCode') ? hash['originZIPCode'] : nil destination_country_code = hash.key?('destinationCountryCode') ? hash['destinationCountryCode'] : 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 foreign_postal_code = hash.key?('foreignPostalCode') ? hash['foreignPostalCode'] : SKIP mailing_date = hash.key?('mailingDate') ? hash['mailingDate'] : SKIP price_type = hash.key?('priceType') ? hash['priceType'] : SKIP mail_class = hash.key?('mailClass') ? hash['mailClass'] : SKIP account_type = hash.key?('accountType') ? hash['accountType'] : SKIP account_number = hash.key?('accountNumber') ? hash['accountNumber'] : SKIP request_duties_taxes_fees = hash['requestDutiesTaxesFees'] ||= false destination_city = hash.key?('destinationCity') ? hash['destinationCity'] : SKIP destination_state = hash.key?('destinationState') ? hash['destinationState'] : SKIP # Parameter is an array, so we need to iterate through it items = nil unless hash['items'].nil? items = [] hash['items'].each do |structure| items << (InternationalPricesDeliveryDutiesTaxesAndFeesItem.from_hash(structure) if structure) end end items = SKIP unless hash.key?('items') item_value = hash.key?('itemValue') ? hash['itemValue'] : SKIP extra_services = hash.key?('extraServices') ? hash['extraServices'] : SKIP # Create object from extracted values. InternationalPricesTotalRatesQuery.new(origin_zip_code: origin_zip_code, destination_country_code: destination_country_code, weight: weight, length: length, width: width, height: height, foreign_postal_code: foreign_postal_code, mailing_date: mailing_date, price_type: price_type, mail_class: mail_class, account_type: account_type, account_number: account_number, request_duties_taxes_fees: request_duties_taxes_fees, destination_city: destination_city, destination_state: destination_state, items: items, item_value: item_value, extra_services: extra_services) end |
.names ⇒ Object
A mapping from model property names to API property names.
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
# File 'lib/usps_api/models/international_prices_total_rates_query.rb', line 111 def self.names @_hash = {} if @_hash.nil? @_hash['origin_zip_code'] = 'originZIPCode' @_hash['foreign_postal_code'] = 'foreignPostalCode' @_hash['destination_country_code'] = 'destinationCountryCode' @_hash['weight'] = 'weight' @_hash['mailing_date'] = 'mailingDate' @_hash['length'] = 'length' @_hash['width'] = 'width' @_hash['height'] = 'height' @_hash['price_type'] = 'priceType' @_hash['mail_class'] = 'mailClass' @_hash['account_type'] = 'accountType' @_hash['account_number'] = 'accountNumber' @_hash['request_duties_taxes_fees'] = 'requestDutiesTaxesFees' @_hash['destination_city'] = 'destinationCity' @_hash['destination_state'] = 'destinationState' @_hash['items'] = 'items' @_hash['item_value'] = 'itemValue' @_hash['extra_services'] = 'extraServices' @_hash end |
.nullables ⇒ Object
An array for nullable fields
153 154 155 |
# File 'lib/usps_api/models/international_prices_total_rates_query.rb', line 153 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
# File 'lib/usps_api/models/international_prices_total_rates_query.rb', line 135 def self.optionals %w[ foreign_postal_code mailing_date price_type mail_class account_type account_number request_duties_taxes_fees destination_city destination_state items item_value extra_services ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
259 260 261 262 263 264 265 266 267 268 269 270 271 |
# File 'lib/usps_api/models/international_prices_total_rates_query.rb', line 259 def inspect class_name = self.class.name.split('::').last "<#{class_name} origin_zip_code: #{@origin_zip_code.inspect}, foreign_postal_code:"\ " #{@foreign_postal_code.inspect}, destination_country_code:"\ " #{@destination_country_code.inspect}, weight: #{@weight.inspect}, mailing_date:"\ " #{@mailing_date.inspect}, length: #{@length.inspect}, width: #{@width.inspect}, height:"\ " #{@height.inspect}, price_type: #{@price_type.inspect}, mail_class:"\ " #{@mail_class.inspect}, account_type: #{@account_type.inspect}, account_number:"\ " #{@account_number.inspect}, request_duties_taxes_fees:"\ " #{@request_duties_taxes_fees.inspect}, destination_city: #{@destination_city.inspect},"\ " destination_state: #{@destination_state.inspect}, items: #{@items.inspect}, item_value:"\ " #{@item_value.inspect}, extra_services: #{@extra_services.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
246 247 248 249 250 251 252 253 254 255 256 |
# File 'lib/usps_api/models/international_prices_total_rates_query.rb', line 246 def to_s class_name = self.class.name.split('::').last "<#{class_name} origin_zip_code: #{@origin_zip_code}, foreign_postal_code:"\ " #{@foreign_postal_code}, destination_country_code: #{@destination_country_code}, weight:"\ " #{@weight}, mailing_date: #{@mailing_date}, length: #{@length}, width: #{@width}, height:"\ " #{@height}, price_type: #{@price_type}, mail_class: #{@mail_class}, account_type:"\ " #{@account_type}, account_number: #{@account_number}, request_duties_taxes_fees:"\ " #{@request_duties_taxes_fees}, destination_city: #{@destination_city}, destination_state:"\ " #{@destination_state}, items: #{@items}, item_value: #{@item_value}, extra_services:"\ " #{@extra_services}>" end |