Class: UspsApi::InternationalLetterRatesQuery
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- UspsApi::InternationalLetterRatesQuery
- Defined in:
- lib/usps_api/models/international_letter_rates_query.rb
Overview
Letter rate ingredients for calculating base prices.
Instance Attribute Summary collapse
-
#destination_country_code ⇒ String
The ISO 3166-1 alpha-2 code representing the shipping destination.
-
#extra_services ⇒ Array[ExtraService4]
Extra Service Code requested.
-
#height ⇒ Float
The letter/flat height measured in inches.
-
#item_value ⇒ Float
Declared value of the item for Registered Mail.
-
#length ⇒ Float
The letter/flat length measured in inches.
-
#mailing_date ⇒ Date
The date the package or letter/flat will be mailed.
-
#non_machinable_indicators ⇒ NonMachinableIndicators
Set of boolean indicators used to determine whether a letter qualifies as nonmachinable.
-
#processing_category ⇒ ProcessingCategory21
To be eligible for mailing at the price for letters, a piece must be: * Rectangular * At least 3-1/2 inches high x 5 inches long x 0.007 inch thick.
-
#thickness ⇒ Float
The letter/flat thickness measured in inches.
-
#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(weight:, length:, height:, thickness:, processing_category:, destination_country_code:, mailing_date: SKIP, non_machinable_indicators: SKIP, extra_services: SKIP, item_value: SKIP) ⇒ InternationalLetterRatesQuery
constructor
A new instance of InternationalLetterRatesQuery.
-
#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(weight:, length:, height:, thickness:, processing_category:, destination_country_code:, mailing_date: SKIP, non_machinable_indicators: SKIP, extra_services: SKIP, item_value: SKIP) ⇒ InternationalLetterRatesQuery
Returns a new instance of InternationalLetterRatesQuery.
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
# File 'lib/usps_api/models/international_letter_rates_query.rb', line 116 def initialize(weight:, length:, height:, thickness:, processing_category:, destination_country_code:, mailing_date: SKIP, non_machinable_indicators: SKIP, extra_services: SKIP, item_value: SKIP) @weight = weight @length = length @height = height @thickness = thickness @processing_category = processing_category @mailing_date = mailing_date unless mailing_date == SKIP unless non_machinable_indicators == SKIP @non_machinable_indicators = non_machinable_indicators end @extra_services = extra_services unless extra_services == SKIP @destination_country_code = destination_country_code @item_value = item_value unless item_value == SKIP end |
Instance Attribute Details
#destination_country_code ⇒ String
The ISO 3166-1 alpha-2 code representing the shipping destination.
73 74 75 |
# File 'lib/usps_api/models/international_letter_rates_query.rb', line 73 def destination_country_code @destination_country_code end |
#extra_services ⇒ Array[ExtraService4]
Extra Service Code requested.
-
940 - Registered Mail
-
955 - Return Receipt
69 70 71 |
# File 'lib/usps_api/models/international_letter_rates_query.rb', line 69 def extra_services @extra_services end |
#height ⇒ Float
The letter/flat height measured in inches. The height is the dimension perpendicular to the length.
27 28 29 |
# File 'lib/usps_api/models/international_letter_rates_query.rb', line 27 def height @height end |
#item_value ⇒ Float
Declared value of the item for Registered Mail. Merchandise cannot be mailed with First-Class Mail International. For product eligibility, please review [section 242 of the International Mail Manual](pe.usps.com/text/imm/immc2_018.htm). For details on Registered Mail indemnity and availability, please review [section 333 of the International Mail Manual](pe.usps.com/text/imm/immc3_009.htm).
83 84 85 |
# File 'lib/usps_api/models/international_letter_rates_query.rb', line 83 def item_value @item_value end |
#length ⇒ Float
The letter/flat length measured in inches. For _`LETTERS`_ the length is the dimension parallel to the delivery address as read. For _`FLATS`_ the length is the longest dimension.
22 23 24 |
# File 'lib/usps_api/models/international_letter_rates_query.rb', line 22 def length @length 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.
58 59 60 |
# File 'lib/usps_api/models/international_letter_rates_query.rb', line 58 def mailing_date @mailing_date end |
#non_machinable_indicators ⇒ NonMachinableIndicators
Set of boolean indicators used to determine whether a letter qualifies as nonmachinable.
63 64 65 |
# File 'lib/usps_api/models/international_letter_rates_query.rb', line 63 def non_machinable_indicators @non_machinable_indicators end |
#processing_category ⇒ ProcessingCategory21
To be eligible for mailing at the price for letters, a piece must be:
* Rectangular
* At least 3-1/2 inches high x 5 inches long x 0.007 inch thick.
* No more than 6-1/8 inches high x 11-1/2 inches long x 1/4 inch thick.
For additional information on letters, please refer to the [Postal Explorer](pe.usps.com/businessmail101?ViewName=Letters). The Postal Service uses the word “flats” to refer to large envelopes, newsletters, and magazines. The words large envelopes and flats are used interchangeably. Whatever you call them, flats must:
* Have one dimension that is greater than 6-1/8 inches high OR 11-½
inches long OR ¼ inch thick.
* Be no more than 12 inches high x 15 inches long x ¾ inch thick.
For additional information on flats, please refer to the [Postal
Explorer](pe.usps.com/businessmail101?ViewName=Flats).
* LETTERS
* FLATS
53 54 55 |
# File 'lib/usps_api/models/international_letter_rates_query.rb', line 53 def processing_category @processing_category end |
#thickness ⇒ Float
The letter/flat thickness measured in inches. The minimum dimension is always the thickness.
32 33 34 |
# File 'lib/usps_api/models/international_letter_rates_query.rb', line 32 def thickness @thickness 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 ounces.
16 17 18 |
# File 'lib/usps_api/models/international_letter_rates_query.rb', line 16 def weight @weight end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 166 |
# File 'lib/usps_api/models/international_letter_rates_query.rb', line 136 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. weight = hash.key?('weight') ? hash['weight'] : nil length = hash.key?('length') ? hash['length'] : nil height = hash.key?('height') ? hash['height'] : nil thickness = hash.key?('thickness') ? hash['thickness'] : nil processing_category = hash.key?('processingCategory') ? hash['processingCategory'] : nil destination_country_code = hash.key?('destinationCountryCode') ? hash['destinationCountryCode'] : nil mailing_date = hash.key?('mailingDate') ? hash['mailingDate'] : SKIP if hash['nonMachinableIndicators'] non_machinable_indicators = NonMachinableIndicators.from_hash(hash['nonMachinableIndicators']) end extra_services = hash.key?('extraServices') ? hash['extraServices'] : SKIP item_value = hash.key?('itemValue') ? hash['itemValue'] : SKIP # Create object from extracted values. InternationalLetterRatesQuery.new(weight: weight, length: length, height: height, thickness: thickness, processing_category: processing_category, destination_country_code: destination_country_code, mailing_date: mailing_date, non_machinable_indicators: non_machinable_indicators, extra_services: extra_services, item_value: item_value) end |
.names ⇒ Object
A mapping from model property names to API property names.
86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/usps_api/models/international_letter_rates_query.rb', line 86 def self.names @_hash = {} if @_hash.nil? @_hash['weight'] = 'weight' @_hash['length'] = 'length' @_hash['height'] = 'height' @_hash['thickness'] = 'thickness' @_hash['processing_category'] = 'processingCategory' @_hash['mailing_date'] = 'mailingDate' @_hash['non_machinable_indicators'] = 'nonMachinableIndicators' @_hash['extra_services'] = 'extraServices' @_hash['destination_country_code'] = 'destinationCountryCode' @_hash['item_value'] = 'itemValue' @_hash end |
.nullables ⇒ Object
An array for nullable fields
112 113 114 |
# File 'lib/usps_api/models/international_letter_rates_query.rb', line 112 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
102 103 104 105 106 107 108 109 |
# File 'lib/usps_api/models/international_letter_rates_query.rb', line 102 def self.optionals %w[ mailing_date non_machinable_indicators extra_services item_value ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
179 180 181 182 183 184 185 186 187 |
# File 'lib/usps_api/models/international_letter_rates_query.rb', line 179 def inspect class_name = self.class.name.split('::').last "<#{class_name} weight: #{@weight.inspect}, length: #{@length.inspect}, height:"\ " #{@height.inspect}, thickness: #{@thickness.inspect}, processing_category:"\ " #{@processing_category.inspect}, mailing_date: #{@mailing_date.inspect},"\ " non_machinable_indicators: #{@non_machinable_indicators.inspect}, extra_services:"\ " #{@extra_services.inspect}, destination_country_code:"\ " #{@destination_country_code.inspect}, item_value: #{@item_value.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
169 170 171 172 173 174 175 176 |
# File 'lib/usps_api/models/international_letter_rates_query.rb', line 169 def to_s class_name = self.class.name.split('::').last "<#{class_name} weight: #{@weight}, length: #{@length}, height: #{@height}, thickness:"\ " #{@thickness}, processing_category: #{@processing_category}, mailing_date:"\ " #{@mailing_date}, non_machinable_indicators: #{@non_machinable_indicators},"\ " extra_services: #{@extra_services}, destination_country_code:"\ " #{@destination_country_code}, item_value: #{@item_value}>" end |