Class: Tep::AuthOAuth2Code

Inherits:
Object
  • Object
show all
Defined in:
lib/tep/auth_oauth2_code.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code, principal_id, client_id, caps_str, expires_at) ⇒ AuthOAuth2Code

Returns a new instance of AuthOAuth2Code.



28
29
30
31
32
33
34
# File 'lib/tep/auth_oauth2_code.rb', line 28

def initialize(code, principal_id, client_id, caps_str, expires_at)
  @code         = code
  @principal_id = principal_id
  @client_id    = client_id
  @caps_str     = caps_str
  @expires_at   = expires_at
end

Instance Attribute Details

#caps_strObject (readonly)

comma-separated symbols (granted subset)



25
26
27
# File 'lib/tep/auth_oauth2_code.rb', line 25

def caps_str
  @caps_str
end

#client_idObject (readonly)

which client this code was issued for



24
25
26
# File 'lib/tep/auth_oauth2_code.rb', line 24

def client_id
  @client_id
end

#codeObject (readonly)

opaque base64url string



22
23
24
# File 'lib/tep/auth_oauth2_code.rb', line 22

def code
  @code
end

#expires_atObject (readonly)

unix epoch seconds; >= now means alive



26
27
28
# File 'lib/tep/auth_oauth2_code.rb', line 26

def expires_at
  @expires_at
end

#principal_idObject (readonly)

the human granting access



23
24
25
# File 'lib/tep/auth_oauth2_code.rb', line 23

def principal_id
  @principal_id
end

Instance Method Details

#expired?(now) ⇒ Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/tep/auth_oauth2_code.rb', line 36

def expired?(now)
  now >= @expires_at
end