Class: Polyseerio::Client
- Inherits:
-
Object
- Object
- Polyseerio::Client
- Defined in:
- lib/client.rb
Overview
The Polyseer.io client.
Constant Summary collapse
Instance Attribute Summary collapse
-
#agent ⇒ Object
Returns the value of attribute agent.
-
#cid ⇒ Object
Returns the value of attribute cid.
-
#instance ⇒ Object
Returns the value of attribute instance.
Instance Method Summary collapse
-
#initialize(cid, options = {}) ⇒ Client
constructor
A new instance of Client.
-
#start_agent(*args) ⇒ Object
Start an agent using this client.
Constructor Details
#initialize(cid, options = {}) ⇒ Client
Returns a new instance of Client.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/client.rb', line 15 def initialize(cid, = {}) = Helper.defaults(, INITIALIZE_DEFAULTS) if [:request].nil? raise ArgumentError, 'Cannot create an instance of Client without' \ 'passing a request instance.' end if .key? :resources [:resources].each(&Helper.attach_to_instance!(self)) end @cid = cid @agent = nil @instance = nil @request = [:request] @agent_class = [:agent_class] end |
Instance Attribute Details
#agent ⇒ Object
Returns the value of attribute agent.
12 13 14 |
# File 'lib/client.rb', line 12 def agent @agent end |
#cid ⇒ Object
Returns the value of attribute cid.
12 13 14 |
# File 'lib/client.rb', line 12 def cid @cid end |
#instance ⇒ Object
Returns the value of attribute instance.
12 13 14 |
# File 'lib/client.rb', line 12 def instance @instance end |
Instance Method Details
#start_agent(*args) ⇒ Object
Start an agent using this client.
35 36 37 38 39 40 41 |
# File 'lib/client.rb', line 35 def start_agent(*args) raise 'Agent has already started.' unless @agent.nil? @agent = @agent_class.new(self) @agent.start(*args) end |