Class: Himari::AccessToken::Format
- Inherits:
-
Struct
- Object
- Struct
- Himari::AccessToken::Format
- Defined in:
- lib/himari/access_token.rb
Constant Summary collapse
- HEADER =
'hmat'
Instance Attribute Summary collapse
-
#handler ⇒ Object
Returns the value of attribute handler.
-
#secret ⇒ Object
Returns the value of attribute secret.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#handler ⇒ Object
Returns the value of attribute handler
16 17 18 |
# File 'lib/himari/access_token.rb', line 16 def handler @handler end |
#secret ⇒ Object
Returns the value of attribute secret
16 17 18 |
# File 'lib/himari/access_token.rb', line 16 def secret @secret end |
Class Method Details
.parse(str) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/himari/access_token.rb', line 19 def self.parse(str) parts = str.split('.') raise InvalidFormat unless parts.size == 3 raise InvalidFormat unless parts[0] == HEADER new(handler: parts[1], secret: parts[2]) end |
Instance Method Details
#to_s ⇒ Object
26 27 28 |
# File 'lib/himari/access_token.rb', line 26 def to_s "#{HEADER}.#{handler}.#{secret}" end |