Don't declare constants in Struct

Signed-off-by: Rémy Coutable <remy@rymai.me>
This commit is contained in:
Rémy Coutable 2017-02-28 13:34:06 +01:00
parent a69aa3dad5
commit 1872859dd4
No known key found for this signature in database
GPG Key ID: 46DF07E5CD9E96AB
1 changed files with 7 additions and 1 deletions

View File

@ -1,10 +1,16 @@
AccessTokenValidationService = Struct.new(:token) do
class AccessTokenValidationService
# Results:
VALID = :valid
EXPIRED = :expired
REVOKED = :revoked
INSUFFICIENT_SCOPE = :insufficient_scope
attr_reader :token
def initialize(token)
@token = token
end
def validate(scopes: [])
if token.expired?
return EXPIRED