Class: Magiclink::Token
- Inherits:
-
Object
- Object
- Magiclink::Token
- Defined in:
- lib/magiclink/token.rb
Instance Attribute Summary collapse
-
#claim ⇒ Object
readonly
Returns the value of attribute claim.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(claim) ⇒ Token
constructor
A new instance of Token.
- #issuer ⇒ Object
- #public_address ⇒ Object
Constructor Details
#initialize(claim) ⇒ Token
Returns a new instance of Token.
11 12 13 |
# File 'lib/magiclink/token.rb', line 11 def initialize(claim) @claim = claim end |
Instance Attribute Details
#claim ⇒ Object (readonly)
Returns the value of attribute claim.
3 4 5 |
# File 'lib/magiclink/token.rb', line 3 def claim @claim end |
Class Method Details
.parse!(token) ⇒ Object
5 6 7 8 9 |
# File 'lib/magiclink/token.rb', line 5 def self.parse!(token) validate!(token) _, claim = decode!(token) new(claim) end |
Instance Method Details
#issuer ⇒ Object
20 21 22 |
# File 'lib/magiclink/token.rb', line 20 def issuer return claim['iss'] end |
#public_address ⇒ Object
15 16 17 18 |
# File 'lib/magiclink/token.rb', line 15 def public_address # This can also use regex to parse it. return issuer.split(':')[-1] end |