Module: Fabriq::Adapter
- Extended by:
- Adapter
- Included in:
- Adapter
- Defined in:
- lib/fabriq/adapter.rb,
lib/fabriq/adapter/rype_adapter.rb
Defined Under Namespace
Classes: RypeAdapter
Instance Attribute Summary collapse
-
#adapter ⇒ Object
Returns the value of attribute adapter.
-
#proxy ⇒ Object
Returns the value of attribute proxy.
-
#rooms ⇒ Object
Returns the value of attribute rooms.
-
#skype_proxy_class ⇒ Object
Returns the value of attribute skype_proxy_class.
Instance Method Summary collapse
- #enqueue_outgoing_message(message) ⇒ Object
- #find_skype_room_by_id(room_id) ⇒ Object
- #init_skype_proxy ⇒ Object
- #load ⇒ Object
- #message_received(&block) ⇒ Object
- #run(&block) ⇒ Object
- #send_message(message) ⇒ Object
- #subscribe_to_incoming_messages(&block) ⇒ Object
Instance Attribute Details
#adapter ⇒ Object
Returns the value of attribute adapter.
7 8 9 |
# File 'lib/fabriq/adapter.rb', line 7 def adapter @adapter end |
#proxy ⇒ Object
Returns the value of attribute proxy.
7 8 9 |
# File 'lib/fabriq/adapter.rb', line 7 def proxy @proxy end |
#rooms ⇒ Object
Returns the value of attribute rooms.
7 8 9 |
# File 'lib/fabriq/adapter.rb', line 7 def rooms @rooms end |
#skype_proxy_class ⇒ Object
Returns the value of attribute skype_proxy_class.
8 9 10 |
# File 'lib/fabriq/adapter.rb', line 8 def skype_proxy_class @skype_proxy_class end |
Instance Method Details
#enqueue_outgoing_message(message) ⇒ Object
40 41 42 |
# File 'lib/fabriq/adapter.rb', line 40 def () self.proxy. << end |
#find_skype_room_by_id(room_id) ⇒ Object
33 34 35 36 37 38 |
# File 'lib/fabriq/adapter.rb', line 33 def find_skype_room_by_id(room_id) @rooms.each do |room| return room if room.id == room_id end nil end |
#init_skype_proxy ⇒ Object
28 29 30 31 |
# File 'lib/fabriq/adapter.rb', line 28 def init_skype_proxy self.proxy = skype_proxy_class.new(self) self.proxy.start end |
#load ⇒ Object
14 15 16 |
# File 'lib/fabriq/adapter.rb', line 14 def load @adapter = Fabriq::Config.adapter.new end |
#message_received(&block) ⇒ Object
48 49 50 51 52 53 |
# File 'lib/fabriq/adapter.rb', line 48 def (&block) self.adapter. do || skype_room = find_skype_room_by_id([:room_id]) block.call((skype_room, )) if block_given? end end |
#run(&block) ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/fabriq/adapter.rb', line 18 def run(&block) init_skype_proxy self.adapter.attach find_available_rooms do |rooms| @rooms = rooms block.call if block_given? end self.adapter.wait end |
#send_message(message) ⇒ Object
55 56 57 |
# File 'lib/fabriq/adapter.rb', line 55 def () self.adapter.(.room.raw, .body) end |
#subscribe_to_incoming_messages(&block) ⇒ Object
44 45 46 |
# File 'lib/fabriq/adapter.rb', line 44 def (&block) self.proxy.(&block) end |