Class: RubyNos::RemoteAgent
- Inherits:
-
Object
- Object
- RubyNos::RemoteAgent
- Includes:
- Initializable
- Defined in:
- lib/ruby_nos/remote_agent.rb
Instance Attribute Summary collapse
-
#endpoints ⇒ Object
Returns the value of attribute endpoints.
-
#rest_api ⇒ Object
Returns the value of attribute rest_api.
-
#timestamp ⇒ Object
Returns the value of attribute timestamp.
-
#uuid ⇒ Object
Returns the value of attribute uuid.
Instance Method Summary collapse
- #add_endpoint(*args) ⇒ Object
- #endpoints_collection ⇒ Object
- #same_api?(another_agent) ⇒ Boolean
- #same_endpoints?(another_agent) ⇒ Boolean
- #same_timestamp?(another_agent) ⇒ Boolean
- #to_hash ⇒ Object
Methods included from Initializable
Instance Attribute Details
#endpoints ⇒ Object
Returns the value of attribute endpoints.
4 5 6 |
# File 'lib/ruby_nos/remote_agent.rb', line 4 def endpoints @endpoints end |
#rest_api ⇒ Object
Returns the value of attribute rest_api.
4 5 6 |
# File 'lib/ruby_nos/remote_agent.rb', line 4 def rest_api @rest_api end |
#timestamp ⇒ Object
Returns the value of attribute timestamp.
4 5 6 |
# File 'lib/ruby_nos/remote_agent.rb', line 4 def @timestamp end |
#uuid ⇒ Object
Returns the value of attribute uuid.
4 5 6 |
# File 'lib/ruby_nos/remote_agent.rb', line 4 def uuid @uuid end |
Instance Method Details
#add_endpoint(*args) ⇒ Object
10 11 12 |
# File 'lib/ruby_nos/remote_agent.rb', line 10 def add_endpoint *args endpoints << Endpoint.new(*args) end |
#endpoints_collection ⇒ Object
14 15 16 |
# File 'lib/ruby_nos/remote_agent.rb', line 14 def endpoints_collection endpoints.map{|e| e.to_hash} end |
#same_api?(another_agent) ⇒ Boolean
22 23 24 25 26 27 28 |
# File 'lib/ruby_nos/remote_agent.rb', line 22 def same_api? another_agent if rest_api && another_agent.rest_api rest_api.to_hash == another_agent.rest_api.to_hash else false end end |
#same_endpoints?(another_agent) ⇒ Boolean
18 19 20 |
# File 'lib/ruby_nos/remote_agent.rb', line 18 def same_endpoints? another_agent endpoints_collection == another_agent.endpoints_collection end |
#same_timestamp?(another_agent) ⇒ Boolean
30 31 32 |
# File 'lib/ruby_nos/remote_agent.rb', line 30 def another_agent == another_agent. end |
#to_hash ⇒ Object
34 35 36 37 38 39 |
# File 'lib/ruby_nos/remote_agent.rb', line 34 def to_hash { uuid: uuid, timestamp: Time.at(/1000) } end |