Class: UspsApi::RateIndicator1
- Inherits:
-
Object
- Object
- UspsApi::RateIndicator1
- Defined in:
- lib/usps_api/models/rate_indicator1.rb
Overview
Use to specify USPS® containers/packaging or container attributes that may affect postage. A rate indicator value will be required if a value for ‘packagingType` is not provided. * 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
Constant Summary collapse
- RATE_INDICATOR1 =
[ # TODO: Write general description for E4 E4 = 'E4'.freeze, # TODO: Write general description for E6 E6 = 'E6'.freeze, # TODO: Write general description for FA FA = 'FA'.freeze, # TODO: Write general description for FB FB = 'FB'.freeze, # TODO: Write general description for FE FE = 'FE'.freeze, # TODO: Write general description for FP FP = 'FP'.freeze, # TODO: Write general description for FS FS = 'FS'.freeze, # TODO: Write general description for PA PA = 'PA'.freeze, # TODO: Write general description for PL PL = 'PL'.freeze, # TODO: Write general description for SP SP = 'SP'.freeze ].freeze
Class Method Summary collapse
Class Method Details
.from_value(value, default_value = E4) ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/usps_api/models/rate_indicator1.rb', line 54 def self.from_value(value, default_value = E4) return default_value if value.nil? str = value.to_s.strip case str.downcase when 'e4' then E4 when 'e6' then E6 when 'fa' then FA when 'fb' then FB when 'fe' then FE when 'fp' then FP when 'fs' then FS when 'pa' then PA when 'pl' then PL when 'sp' then SP else default_value end end |
.validate(value) ⇒ Object
48 49 50 51 52 |
# File 'lib/usps_api/models/rate_indicator1.rb', line 48 def self.validate(value) return false if value.nil? RATE_INDICATOR1.include?(value) end |