Class: HuginnRubyAgent::Agent
- Inherits:
-
Object
- Object
- HuginnRubyAgent::Agent
- Defined in:
- lib/huginn_ruby_agent/agent.rb
Instance Attribute Summary collapse
-
#changed_credentials ⇒ Object
readonly
Returns the value of attribute changed_credentials.
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#events ⇒ Object
readonly
Returns the value of attribute events.
-
#logs ⇒ Object
readonly
Returns the value of attribute logs.
Instance Method Summary collapse
- #check ⇒ Object
- #create_event(payload) ⇒ Object
- #error(message) ⇒ Object
-
#initialize(code:, credentials: {}) ⇒ Agent
constructor
A new instance of Agent.
- #log(message) ⇒ Object
- #receive(events) ⇒ Object
- #sdk ⇒ Object
Constructor Details
#initialize(code:, credentials: {}) ⇒ Agent
10 11 12 13 14 15 16 17 |
# File 'lib/huginn_ruby_agent/agent.rb', line 10 def initialize(code:, credentials: {}) @code = code @events = [] @logs = [] @errors = [] @credentials = credentials @changed_credentials = {} end |
Instance Attribute Details
#changed_credentials ⇒ Object (readonly)
Returns the value of attribute changed_credentials.
8 9 10 |
# File 'lib/huginn_ruby_agent/agent.rb', line 8 def changed_credentials @changed_credentials end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
8 9 10 |
# File 'lib/huginn_ruby_agent/agent.rb', line 8 def errors @errors end |
#events ⇒ Object (readonly)
Returns the value of attribute events.
8 9 10 |
# File 'lib/huginn_ruby_agent/agent.rb', line 8 def events @events end |
#logs ⇒ Object (readonly)
Returns the value of attribute logs.
8 9 10 |
# File 'lib/huginn_ruby_agent/agent.rb', line 8 def logs @logs end |
Instance Method Details
#check ⇒ Object
19 20 21 |
# File 'lib/huginn_ruby_agent/agent.rb', line 19 def check execute ".check" end |
#create_event(payload) ⇒ Object
27 28 29 |
# File 'lib/huginn_ruby_agent/agent.rb', line 27 def create_event(payload) @events << payload end |
#error(message) ⇒ Object
35 36 37 |
# File 'lib/huginn_ruby_agent/agent.rb', line 35 def error() @errors << end |
#log(message) ⇒ Object
31 32 33 |
# File 'lib/huginn_ruby_agent/agent.rb', line 31 def log() @logs << end |
#receive(events) ⇒ Object
23 24 25 |
# File 'lib/huginn_ruby_agent/agent.rb', line 23 def receive(events) execute ".receive(api.deserialize('#{sdk.serialize(events)}'))" end |
#sdk ⇒ Object
39 40 41 |
# File 'lib/huginn_ruby_agent/agent.rb', line 39 def sdk @sdk ||= SDK.new end |