Class: UspsApi::Packaging
- Inherits:
-
Object
- Object
- UspsApi::Packaging
- Defined in:
- lib/usps_api/models/packaging.rb
Overview
Description of the packaging
Constant Summary collapse
- PACKAGING =
[ # TODO: Write general description for APO_FPO_DPO_LARGE_FLAT_RATE_BOX APO_FPO_DPO_LARGE_FLAT_RATE_BOX = 'APO_FPO_DPO_LARGE_FLAT_RATE_BOX'.freeze, # TODO: Write general description for CUBIC_TIER_1 CUBIC_TIER_1 = 'CUBIC_TIER_1'.freeze, # TODO: Write general description for CUBIC_TIER_2 CUBIC_TIER_2 = 'CUBIC_TIER_2'.freeze, # TODO: Write general description for CUBIC_TIER_3 CUBIC_TIER_3 = 'CUBIC_TIER_3'.freeze, # TODO: Write general description for CUBIC_TIER_4 CUBIC_TIER_4 = 'CUBIC_TIER_4'.freeze, # TODO: Write general description for CUBIC_TIER_5 CUBIC_TIER_5 = 'CUBIC_TIER_5'.freeze, # TODO: Write general description for FLAT_RATE_ENVELOPE FLAT_RATE_ENVELOPE = 'FLAT_RATE_ENVELOPE'.freeze, # TODO: Write general description for GIFT_CARD_FLAT_RATE_ENVELOPE GIFT_CARD_FLAT_RATE_ENVELOPE = 'GIFT_CARD_FLAT_RATE_ENVELOPE'.freeze, # TODO: Write general description for LARGE_FLAT_RATE_BOX LARGE_FLAT_RATE_BOX = 'LARGE_FLAT_RATE_BOX'.freeze, # TODO: Write general description for LEGAL_FLAT_RATE_ENVELOPE LEGAL_FLAT_RATE_ENVELOPE = 'LEGAL_FLAT_RATE_ENVELOPE'.freeze, # TODO: Write general description for MEDIUM_FLAT_RATE_BOX MEDIUM_FLAT_RATE_BOX = 'MEDIUM_FLAT_RATE_BOX'.freeze, # TODO: Write general description for PADDED_FLAT_RATE_ENVELOPE PADDED_FLAT_RATE_ENVELOPE = 'PADDED_FLAT_RATE_ENVELOPE'.freeze, # TODO: Write general description for REGIONAL_RATE_BOX_A REGIONAL_RATE_BOX_A = 'REGIONAL_RATE_BOX_A'.freeze, # TODO: Write general description for REGIONAL_RATE_BOX_B REGIONAL_RATE_BOX_B = 'REGIONAL_RATE_BOX_B'.freeze, # TODO: Write general description for SMALL_FLAT_RATE_BOX SMALL_FLAT_RATE_BOX = 'SMALL_FLAT_RATE_BOX'.freeze, # TODO: Write general description for SMALL_FLAT_RATE_ENVELOPE SMALL_FLAT_RATE_ENVELOPE = 'SMALL_FLAT_RATE_ENVELOPE'.freeze, # TODO: Write general description for WINDOW_FLAT_RATE_ENVELOPE WINDOW_FLAT_RATE_ENVELOPE = 'WINDOW_FLAT_RATE_ENVELOPE'.freeze ].freeze
Class Method Summary collapse
- .from_value(value, default_value = APO_FPO_DPO_LARGE_FLAT_RATE_BOX) ⇒ Object
- .validate(value) ⇒ Object
Class Method Details
.from_value(value, default_value = APO_FPO_DPO_LARGE_FLAT_RATE_BOX) ⇒ Object
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/usps_api/models/packaging.rb', line 68 def self.from_value(value, default_value = APO_FPO_DPO_LARGE_FLAT_RATE_BOX) return default_value if value.nil? str = value.to_s.strip case str.downcase when 'apo_fpo_dpo_large_flat_rate_box' then APO_FPO_DPO_LARGE_FLAT_RATE_BOX when 'cubic_tier_1' then CUBIC_TIER_1 when 'cubic_tier_2' then CUBIC_TIER_2 when 'cubic_tier_3' then CUBIC_TIER_3 when 'cubic_tier_4' then CUBIC_TIER_4 when 'cubic_tier_5' then CUBIC_TIER_5 when 'flat_rate_envelope' then FLAT_RATE_ENVELOPE when 'gift_card_flat_rate_envelope' then GIFT_CARD_FLAT_RATE_ENVELOPE when 'large_flat_rate_box' then LARGE_FLAT_RATE_BOX when 'legal_flat_rate_envelope' then LEGAL_FLAT_RATE_ENVELOPE when 'medium_flat_rate_box' then MEDIUM_FLAT_RATE_BOX when 'padded_flat_rate_envelope' then PADDED_FLAT_RATE_ENVELOPE when 'regional_rate_box_a' then REGIONAL_RATE_BOX_A when 'regional_rate_box_b' then REGIONAL_RATE_BOX_B when 'small_flat_rate_box' then SMALL_FLAT_RATE_BOX when 'small_flat_rate_envelope' then SMALL_FLAT_RATE_ENVELOPE when 'window_flat_rate_envelope' then WINDOW_FLAT_RATE_ENVELOPE else default_value end end |
.validate(value) ⇒ Object
62 63 64 65 66 |
# File 'lib/usps_api/models/packaging.rb', line 62 def self.validate(value) return false if value.nil? PACKAGING.include?(value) end |