Class: UspsApi::ExtraServiceRateQueryWithInteger
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- UspsApi::ExtraServiceRateQueryWithInteger
- Defined in:
- lib/usps_api/models/extra_service_rate_query_with_integer.rb
Overview
Search parameters for an extra service price.
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_zip_code ⇒ String
The destination ZIP code for the package.
-
#extra_services ⇒ ExtraService1
Extra Service Code requested.
-
#item_value ⇒ Float
The value of the item.
-
#mail_class ⇒ PricesMailClass
The mail service requested.
-
#mailing_date ⇒ Date
The date the package or letter/flat/card will be mailed.
-
#origin_zip_code ⇒ String
The originating ZIP code for the package.
-
#price_type ⇒ PricesPriceType
Price type can be * ‘RETAIL’ * ‘COMMERCIAL’ * ‘CONTRACT’ * ‘NSA’ (deprecated).
-
#weight ⇒ Float
This is 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.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(mail_class:, price_type:, extra_services: SKIP, item_value: SKIP, weight: SKIP, origin_zip_code: SKIP, destination_zip_code: SKIP, mailing_date: SKIP, account_type: SKIP, account_number: SKIP) ⇒ ExtraServiceRateQueryWithInteger
constructor
A new instance of ExtraServiceRateQueryWithInteger.
-
#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:, extra_services: SKIP, item_value: SKIP, weight: SKIP, origin_zip_code: SKIP, destination_zip_code: SKIP, mailing_date: SKIP, account_type: SKIP, account_number: SKIP) ⇒ ExtraServiceRateQueryWithInteger
Returns a new instance of ExtraServiceRateQueryWithInteger.
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 |
# File 'lib/usps_api/models/extra_service_rate_query_with_integer.rb', line 180 def initialize(mail_class:, price_type:, extra_services: SKIP, item_value: SKIP, weight: SKIP, origin_zip_code: SKIP, destination_zip_code: SKIP, mailing_date: SKIP, account_type: SKIP, account_number: SKIP) @extra_services = extra_services unless extra_services == SKIP @mail_class = mail_class @price_type = price_type @item_value = item_value unless item_value == SKIP @weight = weight unless weight == SKIP @origin_zip_code = origin_zip_code unless origin_zip_code == SKIP @destination_zip_code = destination_zip_code unless destination_zip_code == SKIP @mailing_date = mailing_date unless mailing_date == 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.
143 144 145 |
# File 'lib/usps_api/models/extra_service_rate_query_with_integer.rb', line 143 def account_number @account_number end |
#account_type ⇒ AccountType1
The type of payment account linked to a contract rate.
138 139 140 |
# File 'lib/usps_api/models/extra_service_rate_query_with_integer.rb', line 138 def account_type @account_type end |
#destination_zip_code ⇒ String
The destination ZIP code for the package.
127 128 129 |
# File 'lib/usps_api/models/extra_service_rate_query_with_integer.rb', line 127 def destination_zip_code @destination_zip_code end |
#extra_services ⇒ ExtraService1
Extra Service Code requested.
-
415 - USPS Label Delivery
-
480 - Tracking Plus 6 Months
-
481 - Tracking Plus 1 Year
-
482 - Tracking Plus 3 Years
-
483 - Tracking Plus 5 Years
-
484 - Tracking Plus 7 Years
-
485 - Tracking Plus 10 Years
-
486 - Tracking Plus Signature 3 Years
-
487 - Tracking Plus Signature 5 Years
-
488 - Tracking Plus Signature 7 Years
-
489 - Tracking Plus Signature 10 Years
-
498 - PO Box Locker – Stocking Fee (NSA Only)
-
500 - PO Box Locker – Self-Service Pickup Fee (NSA Only)
-
501 - PO Box Locker – Clerk-Assisted Pickup Fee (NSA Only)
-
502 - PO Box Locker – Local Delivery Fee (NSA Only)
-
810 - HAZMAT Air Eligible Ethanol Package
-
811 - HAZMAT Class 1 - Toy Propellant/Safety Fuse Package
-
812 - HAZMAT Class 3 – Flammable Liquid Package
-
813 - HAZMAT Class 7 - Radioactive Materials Package
-
814 - HAZMAT Class 8 - Corrosive Materials Package
-
815 - HAZMAT Class 8 - Nonspillable Wet Battery Package
-
816 - HAZMAT Class 9 - Lithium Battery Marked - Ground Only Package
-
817 - HAZMAT Class 9 - Lithium Battery - Returns Package
-
818 - HAZMAT Class 9 - Lithium batteries, marked package
-
819 - HAZMAT Class 9 - Dry Ice Package
-
820 - HAZMAT Class 9 - Lithium batteries, unmarked package
-
821 - HAZMAT Class 9 - Magnetized Materials Package
-
822 - HAZMAT Division 4.1 – Flammable Solids or Safety Matches Package
-
823 - HAZMAT Division 5.1 - Oxidizers Package
-
824 - HAZMAT Division 5.2 - Organic Peroxides Package
-
825 - HAZMAT Division 6.1 – Toxic Materials Package
-
826 - HAZMAT Division 6.2 – Infectious Substances Package
-
827 - HAZMAT Excepted Quantity Provision Package
-
828 - HAZMAT Ground Only
-
829 - HAZMAT ID8000 Consumer Commodity Package
-
830 - HAZMAT Lighters Package
-
831 - HAZMAT LTD QTY Ground Package
-
832 - HAZMAT Small Quantity Provision Package
-
853 - Perishable Material
-
856 - Live Animals Transportation Fee
-
857 - Hazardous Material
-
858 - Cremated Remains
-
910 - Certified Mail
-
911 - Certified Mail Restricted Delivery
-
912 - Certified Mail Adult Signature Required
-
913 - Certified Mail Adult Signature Restricted Delivery
-
915 - Collect on Delivery (COD)
-
917 - COD Restricted Delivery
-
920 - USPS Tracking
-
921 - Signature Confirmation
-
922 - Adult Signature Required 21 or Over
-
923 - Adult Signature Restricted Delivery 21 or Over
-
924 - Signature Confirmation Restricted Delivery
-
925 - Priority Mail Express Merchandise Insurance
-
930 - Insurance <= $500
-
931 - Insurance > $500
-
934 - Insurance Restricted Delivery
-
940 - Registered Mail
-
941 - Registered Mail Restricted Delivery
-
955 - Return Receipt
-
957 - Return Receipt Electronic
-
972 - Live Animal and Perishable Handling Fee
-
981 - Signature Requested (PRIORITY_MAIL_EXPRESS only)
-
984 - Parcel Locker Delivery
-
986 - PO to Addressee (PRIORITY_MAIL_EXPRESS only)
-
991 - Sunday Delivery
Note: Entering a single extra service will be removed in the next major revision.
82 83 84 |
# File 'lib/usps_api/models/extra_service_rate_query_with_integer.rb', line 82 def extra_services @extra_services end |
#item_value ⇒ Float
The value of the item. Required for Insurance and Collect On Delivery. The price for Insurance, Registered Mail, and Collect On Delivery extra services will vary based on this value.
113 114 115 |
# File 'lib/usps_api/models/extra_service_rate_query_with_integer.rb', line 113 def item_value @item_value end |
#mail_class ⇒ PricesMailClass
The mail service requested. Note:
-
‘PARCEL_SELECT_LIGHTWEIGHT` is deprecated and will convert to
‘PARCEL_SELECT`.
-
‘FIRST-CLASS_PACKAGE_SERVICE` is deprecated and will convert to
‘USPS_GROUND_ADVANTAGE`.
-
‘FIRST-CLASS_PACKAGE_RETURN_SERVICE` is deprecated and will convert to
‘USPS_GROUND_ADVANTAGE_RETURN_SERVICE`.
-
‘GROUND_RETURN_SERVICE` is deprecated and will convert to
‘USPS_GROUND_ADVANTAGE_RETURN_SERVICE`.
-
‘USPS_RETAIL_GROUND` is no longer supported and will return a 400 if
used.
-
Certain mail classes, such as ‘MEDIA_MAIL`, `BOUND_PRINTED_MATTER`, and
‘LIBRARY_MAIL`, have eligibility rules on what can be mailed using that service. For more details on these mail classes, please visit [What are Package Services?](faq.usps.com/s/article/What-are-Package-Services).
102 103 104 |
# File 'lib/usps_api/models/extra_service_rate_query_with_integer.rb', line 102 def mail_class @mail_class end |
#mailing_date ⇒ Date
The date the package or letter/flat/card will be mailed. The mailing date may be today plus 0 to 7 days in advance. Enter the date in the full-date notation as defined by [RFC 3339, section 5.6](datatracker.ietf.org/doc/html/rfc3339#section-5.6).
134 135 136 |
# File 'lib/usps_api/models/extra_service_rate_query_with_integer.rb', line 134 def mailing_date @mailing_date end |
#origin_zip_code ⇒ String
The originating ZIP code for the package.
123 124 125 |
# File 'lib/usps_api/models/extra_service_rate_query_with_integer.rb', line 123 def origin_zip_code @origin_zip_code end |
#price_type ⇒ PricesPriceType
Price type can be * ‘RETAIL’ * ‘COMMERCIAL’ * ‘CONTRACT’ * ‘NSA’ (deprecated)
107 108 109 |
# File 'lib/usps_api/models/extra_service_rate_query_with_integer.rb', line 107 def price_type @price_type end |
#weight ⇒ Float
This is 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.
119 120 121 |
# File 'lib/usps_api/models/extra_service_rate_query_with_integer.rb', line 119 def weight @weight end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 |
# File 'lib/usps_api/models/extra_service_rate_query_with_integer.rb', line 197 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 extra_services = hash.key?('extraServices') ? hash['extraServices'] : SKIP item_value = hash.key?('itemValue') ? hash['itemValue'] : SKIP weight = hash.key?('weight') ? hash['weight'] : SKIP origin_zip_code = hash.key?('originZIPCode') ? hash['originZIPCode'] : SKIP destination_zip_code = hash.key?('destinationZIPCode') ? hash['destinationZIPCode'] : 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. ExtraServiceRateQueryWithInteger.new(mail_class: mail_class, price_type: price_type, extra_services: extra_services, item_value: item_value, weight: weight, origin_zip_code: origin_zip_code, destination_zip_code: destination_zip_code, 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.
146 147 148 149 150 151 152 153 154 155 156 157 158 159 |
# File 'lib/usps_api/models/extra_service_rate_query_with_integer.rb', line 146 def self.names @_hash = {} if @_hash.nil? @_hash['extra_services'] = 'extraServices' @_hash['mail_class'] = 'mailClass' @_hash['price_type'] = 'priceType' @_hash['item_value'] = 'itemValue' @_hash['weight'] = 'weight' @_hash['origin_zip_code'] = 'originZIPCode' @_hash['destination_zip_code'] = 'destinationZIPCode' @_hash['mailing_date'] = 'mailingDate' @_hash['account_type'] = 'accountType' @_hash['account_number'] = 'accountNumber' @_hash end |
.nullables ⇒ Object
An array for nullable fields
176 177 178 |
# File 'lib/usps_api/models/extra_service_rate_query_with_integer.rb', line 176 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
162 163 164 165 166 167 168 169 170 171 172 173 |
# File 'lib/usps_api/models/extra_service_rate_query_with_integer.rb', line 162 def self.optionals %w[ extra_services item_value weight origin_zip_code destination_zip_code mailing_date account_type account_number ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 |
# File 'lib/usps_api/models/extra_service_rate_query_with_integer.rb', line 229 def self.validate(value) if value.instance_of? self return ( APIHelper.valid_type?(value.mail_class, ->(val) { PricesMailClass.validate(val) }) and APIHelper.valid_type?(value.price_type, ->(val) { PricesPriceType.validate(val) }) ) end return false unless value.instance_of? Hash ( APIHelper.valid_type?(value['mailClass'], ->(val) { PricesMailClass.validate(val) }) and APIHelper.valid_type?(value['priceType'], ->(val) { PricesPriceType.validate(val) }) ) end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
259 260 261 262 263 264 265 266 267 |
# File 'lib/usps_api/models/extra_service_rate_query_with_integer.rb', line 259 def inspect class_name = self.class.name.split('::').last "<#{class_name} extra_services: #{@extra_services.inspect}, mail_class:"\ " #{@mail_class.inspect}, price_type: #{@price_type.inspect}, item_value:"\ " #{@item_value.inspect}, weight: #{@weight.inspect}, origin_zip_code:"\ " #{@origin_zip_code.inspect}, destination_zip_code: #{@destination_zip_code.inspect},"\ " mailing_date: #{@mailing_date.inspect}, account_type: #{@account_type.inspect},"\ " account_number: #{@account_number.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
250 251 252 253 254 255 256 |
# File 'lib/usps_api/models/extra_service_rate_query_with_integer.rb', line 250 def to_s class_name = self.class.name.split('::').last "<#{class_name} extra_services: #{@extra_services}, mail_class: #{@mail_class}, price_type:"\ " #{@price_type}, item_value: #{@item_value}, weight: #{@weight}, origin_zip_code:"\ " #{@origin_zip_code}, destination_zip_code: #{@destination_zip_code}, mailing_date:"\ " #{@mailing_date}, account_type: #{@account_type}, account_number: #{@account_number}>" end |