Class: UspsApi::TokenTypeHint
- Inherits:
-
Object
- Object
- UspsApi::TokenTypeHint
- Defined in:
- lib/usps_api/models/token_type_hint.rb
Overview
A hint to the type of the given token. See OAuth Token Types Hint registry, www.rfc-editor.org/rfc/rfc7009#section-4.1.2.1
Constant Summary collapse
- TOKEN_TYPE_HINT =
[ # TODO: Write general description for ACCESS_TOKEN ACCESS_TOKEN = 'access_token'.freeze, # TODO: Write general description for REFRESH_TOKEN REFRESH_TOKEN = 'refresh_token'.freeze ].freeze
Class Method Summary collapse
Class Method Details
.from_value(value, default_value = ACCESS_TOKEN) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/usps_api/models/token_type_hint.rb', line 24 def self.from_value(value, default_value = ACCESS_TOKEN) return default_value if value.nil? str = value.to_s.strip case str.downcase when 'access_token' then ACCESS_TOKEN when 'refresh_token' then REFRESH_TOKEN else default_value end end |
.validate(value) ⇒ Object
18 19 20 21 22 |
# File 'lib/usps_api/models/token_type_hint.rb', line 18 def self.validate(value) return false if value.nil? TOKEN_TYPE_HINT.include?(value) end |