Class: NetworkChannel
- Inherits:
-
AbstractChannel
- Object
- AbstractChannel
- NetworkChannel
- Defined in:
- lib/cirrocumulus/channels.rb
Overview
Communication channel over network.
Instance Method Summary collapse
- #agree(sender, action, options = {}) ⇒ Object
- #failure(sender, action, reason, options = {}) ⇒ Object
- #inform(sender, proposition, options = {}) ⇒ Object
-
#initialize(client, remote_jid) ⇒ NetworkChannel
constructor
A new instance of NetworkChannel.
- #query(sender, expression, options = {}) ⇒ Object
- #query_if(sender, proposition, options = {}) ⇒ Object
- #refuse(sender, action, reason, options = {}) ⇒ Object
- #request(sender, action, options = {}) ⇒ Object
Constructor Details
#initialize(client, remote_jid) ⇒ NetworkChannel
Returns a new instance of NetworkChannel.
85 86 87 88 89 |
# File 'lib/cirrocumulus/channels.rb', line 85 def initialize(client, remote_jid) @remote_jid = remote_jid @client = client @serializer = Sexpistol.new end |
Instance Method Details
#agree(sender, action, options = {}) ⇒ Object
107 108 109 |
# File 'lib/cirrocumulus/channels.rb', line 107 def agree(sender, action, = {}) client.queue(serializer.to_sexp((remote_jid, :agree, action, ))) end |
#failure(sender, action, reason, options = {}) ⇒ Object
115 116 117 |
# File 'lib/cirrocumulus/channels.rb', line 115 def failure(sender, action, reason, = {}) client.queue(serializer.to_sexp((remote_jid, :failure, [action, reason], ))) end |
#inform(sender, proposition, options = {}) ⇒ Object
91 92 93 |
# File 'lib/cirrocumulus/channels.rb', line 91 def inform(sender, proposition, = {}) client.queue(serializer.to_sexp((remote_jid, :inform, proposition, ))) end |
#query(sender, expression, options = {}) ⇒ Object
99 100 101 |
# File 'lib/cirrocumulus/channels.rb', line 99 def query(sender, expression, = {}) client.queue(serializer.to_sexp((remote_jid, :query, expression, ))) end |
#query_if(sender, proposition, options = {}) ⇒ Object
103 104 105 |
# File 'lib/cirrocumulus/channels.rb', line 103 def query_if(sender, proposition, = {}) client.queue(serializer.to_sexp((remote_jid, :query_if, proposition, ))) end |
#refuse(sender, action, reason, options = {}) ⇒ Object
111 112 113 |
# File 'lib/cirrocumulus/channels.rb', line 111 def refuse(sender, action, reason, = {}) client.queue(serializer.to_sexp((remote_jid, :refuse, [action, reason], ))) end |
#request(sender, action, options = {}) ⇒ Object
95 96 97 |
# File 'lib/cirrocumulus/channels.rb', line 95 def request(sender, action, = {}) client.queue(serializer.to_sexp((remote_jid, :request, action, ))) end |