Class: UspsApi::InternationalExtraServiceRateQuery
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- UspsApi::InternationalExtraServiceRateQuery
- Defined in:
- lib/usps_api/models/international_extra_service_rate_query.rb
Overview
Search parameters for extra services 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.
-
#extra_service ⇒ ExtraServiceCodes
Extra Service Code requested * ‘370` - USPS Delivery Duties Paid Fee * `813` - HAZMAT Class 7 - Radioactive Materials Package * `820` - HAZMAT Class 9 - Lithium batteries, unmarked package * `826` - HAZMAT Division 6.2 – Infectious Substances Package * `857` - Hazardous Material * `930` - Insurance <= $500 * `931` - Insurance > $500 * `955` - Return Receipt (Unsupported as of 01/19/2025).
-
#extra_services ⇒ Array[ExtraService2]
Extra Service Code requested * ‘370` - USPS Delivery Duties Paid Fee * `813` - HAZMAT Class 7 - Radioactive Materials Package * `820` - HAZMAT Class 9 - Lithium batteries, unmarked package * `826` - HAZMAT Division 6.2 – Infectious Substances Package * `857` - Hazardous Material * `930` - Insurance <= $500 * `931` - Insurance > $500 * `955` - Return Receipt (Unsupported as of 01/19/2025).
-
#item_value ⇒ String
The value of the item.
-
#mail_class ⇒ MailClass4
The mail service requested.
-
#mailing_date ⇒ Date
The date the package or letter/flat will be mailed.
-
#price_type ⇒ PriceType2
Price type can be * ‘RETAIL’ * ‘COMMERCIAL’ * ‘COMMERCIAL_PLUS’ * ‘NSA.
-
#rate_indicator ⇒ RateIndicator11
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.
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(mail_class:, price_type:, weight:, rate_indicator:, destination_country_code:, extra_services: SKIP, extra_service: SKIP, item_value: SKIP, mailing_date: SKIP, account_type: SKIP, account_number: SKIP) ⇒ InternationalExtraServiceRateQuery
constructor
A new instance of InternationalExtraServiceRateQuery.
-
#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(mail_class:, price_type:, weight:, rate_indicator:, destination_country_code:, extra_services: SKIP, extra_service: SKIP, item_value: SKIP, mailing_date: SKIP, account_type: SKIP, account_number: SKIP) ⇒ InternationalExtraServiceRateQuery
Returns a new instance of InternationalExtraServiceRateQuery.
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
# File 'lib/usps_api/models/international_extra_service_rate_query.rb', line 141 def initialize(mail_class:, price_type:, weight:, rate_indicator:, destination_country_code:, extra_services: SKIP, extra_service: SKIP, item_value: SKIP, mailing_date: SKIP, account_type: SKIP, account_number: SKIP) @extra_services = extra_services unless extra_services == SKIP @extra_service = extra_service unless extra_service == SKIP @mail_class = mail_class @price_type = price_type @item_value = item_value unless item_value == SKIP @weight = weight @mailing_date = mailing_date unless mailing_date == SKIP @rate_indicator = rate_indicator @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.
105 106 107 |
# File 'lib/usps_api/models/international_extra_service_rate_query.rb', line 105 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.
100 101 102 |
# File 'lib/usps_api/models/international_extra_service_rate_query.rb', line 100 def account_type @account_type end |
#destination_country_code ⇒ String
The ISO 3166-1 alpha-2 code representing the shipping destination.
94 95 96 |
# File 'lib/usps_api/models/international_extra_service_rate_query.rb', line 94 def destination_country_code @destination_country_code end |
#extra_service ⇒ ExtraServiceCodes
Extra Service Code requested
* `370` - USPS Delivery Duties Paid Fee
* `813` - HAZMAT Class 7 - Radioactive Materials Package
* `820` - HAZMAT Class 9 - Lithium batteries, unmarked package
* `826` - HAZMAT Division 6.2 – Infectious Substances Package
* `857` - Hazardous Material
* `930` - Insurance <= $500
* `931` - Insurance > $500
* `955` - Return Receipt (Unsupported as of 01/19/2025)
34 35 36 |
# File 'lib/usps_api/models/international_extra_service_rate_query.rb', line 34 def extra_service @extra_service end |
#extra_services ⇒ Array[ExtraService2]
Extra Service Code requested
* `370` - USPS Delivery Duties Paid Fee
* `813` - HAZMAT Class 7 - Radioactive Materials Package
* `820` - HAZMAT Class 9 - Lithium batteries, unmarked package
* `826` - HAZMAT Division 6.2 – Infectious Substances Package
* `857` - Hazardous Material
* `930` - Insurance <= $500
* `931` - Insurance > $500
* `955` - Return Receipt (Unsupported as of 01/19/2025)
22 23 24 |
# File 'lib/usps_api/models/international_extra_service_rate_query.rb', line 22 def extra_services @extra_services end |
#item_value ⇒ String
The value of the item. Required for Insurance and Registered Mail.
55 56 57 |
# File 'lib/usps_api/models/international_extra_service_rate_query.rb', line 55 def item_value @item_value 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.
43 44 45 |
# File 'lib/usps_api/models/international_extra_service_rate_query.rb', line 43 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.
66 67 68 |
# File 'lib/usps_api/models/international_extra_service_rate_query.rb', line 66 def mailing_date @mailing_date end |
#price_type ⇒ PriceType2
Price type can be
* 'RETAIL'
* 'COMMERCIAL'
* 'COMMERCIAL_PLUS'
* 'NSA
51 52 53 |
# File 'lib/usps_api/models/international_extra_service_rate_query.rb', line 51 def price_type @price_type end |
#rate_indicator ⇒ RateIndicator11
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
90 91 92 |
# File 'lib/usps_api/models/international_extra_service_rate_query.rb', line 90 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.
61 62 63 |
# File 'lib/usps_api/models/international_extra_service_rate_query.rb', line 61 def weight @weight end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 186 187 188 |
# File 'lib/usps_api/models/international_extra_service_rate_query.rb', line 159 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. mail_class = hash.key?('mailClass') ? hash['mailClass'] : nil price_type = hash.key?('priceType') ? hash['priceType'] : nil weight = hash.key?('weight') ? hash['weight'] : nil rate_indicator = hash.key?('rateIndicator') ? hash['rateIndicator'] : nil destination_country_code = hash.key?('destinationCountryCode') ? hash['destinationCountryCode'] : nil extra_services = hash.key?('extraServices') ? hash['extraServices'] : SKIP extra_service = hash.key?('extraService') ? hash['extraService'] : SKIP item_value = hash.key?('itemValue') ? hash['itemValue'] : SKIP mailing_date = hash.key?('mailingDate') ? hash['mailingDate'] : SKIP account_type = hash.key?('accountType') ? hash['accountType'] : SKIP account_number = hash.key?('accountNumber') ? hash['accountNumber'] : SKIP # Create object from extracted values. InternationalExtraServiceRateQuery.new(mail_class: mail_class, price_type: price_type, weight: weight, rate_indicator: rate_indicator, destination_country_code: destination_country_code, extra_services: extra_services, extra_service: extra_service, item_value: item_value, mailing_date: mailing_date, account_type: account_type, account_number: account_number) end |
.names ⇒ Object
A mapping from model property names to API property names.
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
# File 'lib/usps_api/models/international_extra_service_rate_query.rb', line 108 def self.names @_hash = {} if @_hash.nil? @_hash['extra_services'] = 'extraServices' @_hash['extra_service'] = 'extraService' @_hash['mail_class'] = 'mailClass' @_hash['price_type'] = 'priceType' @_hash['item_value'] = 'itemValue' @_hash['weight'] = 'weight' @_hash['mailing_date'] = 'mailingDate' @_hash['rate_indicator'] = 'rateIndicator' @_hash['destination_country_code'] = 'destinationCountryCode' @_hash['account_type'] = 'accountType' @_hash['account_number'] = 'accountNumber' @_hash end |
.nullables ⇒ Object
An array for nullable fields
137 138 139 |
# File 'lib/usps_api/models/international_extra_service_rate_query.rb', line 137 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
125 126 127 128 129 130 131 132 133 134 |
# File 'lib/usps_api/models/international_extra_service_rate_query.rb', line 125 def self.optionals %w[ extra_services extra_service item_value mailing_date account_type account_number ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
201 202 203 204 205 206 207 208 209 |
# File 'lib/usps_api/models/international_extra_service_rate_query.rb', line 201 def inspect class_name = self.class.name.split('::').last "<#{class_name} extra_services: #{@extra_services.inspect}, extra_service:"\ " #{@extra_service.inspect}, mail_class: #{@mail_class.inspect}, price_type:"\ " #{@price_type.inspect}, item_value: #{@item_value.inspect}, weight: #{@weight.inspect},"\ " mailing_date: #{@mailing_date.inspect}, rate_indicator: #{@rate_indicator.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.
191 192 193 194 195 196 197 198 |
# File 'lib/usps_api/models/international_extra_service_rate_query.rb', line 191 def to_s class_name = self.class.name.split('::').last "<#{class_name} extra_services: #{@extra_services}, extra_service: #{@extra_service},"\ " mail_class: #{@mail_class}, price_type: #{@price_type}, item_value: #{@item_value},"\ " weight: #{@weight}, mailing_date: #{@mailing_date}, rate_indicator: #{@rate_indicator},"\ " destination_country_code: #{@destination_country_code}, account_type: #{@account_type},"\ " account_number: #{@account_number}>" end |