Class: Tep::AgentDelegation
- Inherits:
-
Object
- Object
- Tep::AgentDelegation
- Defined in:
- lib/tep/agent_delegation.rb
Instance Attribute Summary collapse
-
#agent_id ⇒ Object
readonly
String, e.g.
-
#expires_at ⇒ Object
readonly
Integer (unix epoch seconds).
-
#issued_at ⇒ Object
readonly
Integer (unix epoch seconds).
-
#origin ⇒ Object
readonly
Symbol: :token, :oauth_grant, :session_handoff, …
Instance Method Summary collapse
-
#expired?(now) ⇒ Boolean
‘now` is unix epoch seconds (Time.now.to_i shape).
-
#initialize(agent_id, issued_at, expires_at, origin) ⇒ AgentDelegation
constructor
A new instance of AgentDelegation.
Constructor Details
#initialize(agent_id, issued_at, expires_at, origin) ⇒ AgentDelegation
Returns a new instance of AgentDelegation.
21 22 23 24 25 26 |
# File 'lib/tep/agent_delegation.rb', line 21 def initialize(agent_id, issued_at, expires_at, origin) @agent_id = agent_id @issued_at = issued_at @expires_at = expires_at @origin = origin end |
Instance Attribute Details
#agent_id ⇒ Object (readonly)
String, e.g. “summarizer-bot”
16 17 18 |
# File 'lib/tep/agent_delegation.rb', line 16 def agent_id @agent_id end |
#expires_at ⇒ Object (readonly)
Integer (unix epoch seconds)
18 19 20 |
# File 'lib/tep/agent_delegation.rb', line 18 def expires_at @expires_at end |
#issued_at ⇒ Object (readonly)
Integer (unix epoch seconds)
17 18 19 |
# File 'lib/tep/agent_delegation.rb', line 17 def issued_at @issued_at end |
#origin ⇒ Object (readonly)
Symbol: :token, :oauth_grant, :session_handoff, …
19 20 21 |
# File 'lib/tep/agent_delegation.rb', line 19 def origin @origin end |
Instance Method Details
#expired?(now) ⇒ Boolean
‘now` is unix epoch seconds (Time.now.to_i shape). Passed in rather than read from Time.now so callers control the clock source (and tests can fast-forward).
31 32 33 |
# File 'lib/tep/agent_delegation.rb', line 31 def expired?(now) now >= @expires_at end |