Class: UspsApi::AccessControl
- Inherits:
-
Object
- Object
- UspsApi::AccessControl
- Defined in:
- lib/usps_api/models/access_control.rb
Overview
Details on if the Tracking request was free or charged based on MID access through an IP Agreement. - ‘FREE` - The Tracking request was free. - `IP_AGREEMENT` - The tracking request was charged based on MID access through an IP Agreement.
Constant Summary collapse
- ACCESS_CONTROL =
[ # TODO: Write general description for FREE FREE = 'FREE'.freeze, # TODO: Write general description for IP_AGREEMENT IP_AGREEMENT = 'IP_AGREEMENT'.freeze ].freeze
Class Method Summary collapse
Class Method Details
.from_value(value, default_value = FREE) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/usps_api/models/access_control.rb', line 26 def self.from_value(value, default_value = FREE) return default_value if value.nil? str = value.to_s.strip case str.downcase when 'free' then FREE when 'ip_agreement' then IP_AGREEMENT else default_value end end |
.validate(value) ⇒ Object
20 21 22 23 24 |
# File 'lib/usps_api/models/access_control.rb', line 20 def self.validate(value) return false if value.nil? ACCESS_CONTROL.include?(value) end |