Class: AgentClient::Segment
- Inherits:
-
Object
- Object
- AgentClient::Segment
- Defined in:
- lib/agent_client/segment.rb
Overview
Represents a link in a Stratumn application
Instance Attribute Summary collapse
-
#agent ⇒ Object
Returns the value of attribute agent.
-
#link ⇒ Object
Returns the value of attribute link.
-
#link_hash ⇒ Object
Returns the value of attribute link_hash.
-
#meta ⇒ Object
Returns the value of attribute meta.
-
#state ⇒ Object
Returns the value of attribute state.
Class Method Summary collapse
Instance Method Summary collapse
- #find_segments(options = {}) ⇒ Object
-
#initialize(agent, obj) ⇒ Segment
constructor
A new instance of Segment.
- #load ⇒ Object
- #previous ⇒ Object
Methods included from Helper
Methods included from Request
Constructor Details
#initialize(agent, obj) ⇒ Segment
Returns a new instance of Segment.
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/agent_client/segment.rb', line 16 def initialize(agent, obj) self.agent = agent self.link = obj['link'] self. = link['meta'] self.state = link['state'] self.link_hash = obj['meta']['linkHash'] agent.agent_info['actions'].each do |(method, _)| add_transition_method(method) end end |
Instance Attribute Details
#agent ⇒ Object
Returns the value of attribute agent.
14 15 16 |
# File 'lib/agent_client/segment.rb', line 14 def agent @agent end |
#link ⇒ Object
Returns the value of attribute link.
14 15 16 |
# File 'lib/agent_client/segment.rb', line 14 def link @link end |
#link_hash ⇒ Object
Returns the value of attribute link_hash.
14 15 16 |
# File 'lib/agent_client/segment.rb', line 14 def link_hash @link_hash end |
#meta ⇒ Object
Returns the value of attribute meta.
14 15 16 |
# File 'lib/agent_client/segment.rb', line 14 def @meta end |
#state ⇒ Object
Returns the value of attribute state.
14 15 16 |
# File 'lib/agent_client/segment.rb', line 14 def state @state end |
Class Method Details
Instance Method Details
#find_segments(options = {}) ⇒ Object
33 34 35 |
# File 'lib/agent_client/segment.rb', line 33 def find_segments( = {}) agent.find_segments() end |
#load ⇒ Object
37 38 39 |
# File 'lib/agent_client/segment.rb', line 37 def load agent.get_segment(link_hash) end |
#previous ⇒ Object
29 30 31 |
# File 'lib/agent_client/segment.rb', line 29 def previous agent.get_segment(['prevLinkHash']) if ['prevLinkHash'] end |