Class: UspsApi::InternationalRateListQuery
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- UspsApi::InternationalRateListQuery
- Defined in:
- lib/usps_api/models/international_rate_list_query.rb
Overview
Informative details about all possible rate based on the ingredients.
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.
-
#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 ⇒ 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’.
-
#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) ⇒ InternationalRateListQuery
constructor
A new instance of InternationalRateListQuery.
-
#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) ⇒ InternationalRateListQuery
Returns a new instance of InternationalRateListQuery.
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/usps_api/models/international_rate_list_query.rb', line 114 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) @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 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_rate_list_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_rate_list_query.rb', line 72 def account_type @account_type 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_rate_list_query.rb', line 27 def destination_country_code @destination_country_code 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_rate_list_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_rate_list_query.rb', line 51 def height @height end |
#length ⇒ Float
The package length in inches. The maximum dimension is always length.
42 43 44 |
# File 'lib/usps_api/models/international_rate_list_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_rate_list_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_rate_list_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_rate_list_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_rate_list_query.rb', line 56 def price_type @price_type 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_rate_list_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_rate_list_query.rb', line 47 def width @width end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 |
# File 'lib/usps_api/models/international_rate_list_query.rb', line 133 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 # Create object from extracted values. InternationalRateListQuery.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) end |
.names ⇒ Object
A mapping from model property names to API property names.
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/usps_api/models/international_rate_list_query.rb', line 80 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 end |
.nullables ⇒ Object
An array for nullable fields
110 111 112 |
# File 'lib/usps_api/models/international_rate_list_query.rb', line 110 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
98 99 100 101 102 103 104 105 106 107 |
# File 'lib/usps_api/models/international_rate_list_query.rb', line 98 def self.optionals %w[ foreign_postal_code mailing_date price_type mail_class account_type account_number ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
178 179 180 181 182 183 184 185 186 187 |
# File 'lib/usps_api/models/international_rate_list_query.rb', line 178 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}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
168 169 170 171 172 173 174 175 |
# File 'lib/usps_api/models/international_rate_list_query.rb', line 168 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}>" end |