Class: Fabriq::Skype::Room

Inherits:
Object
  • Object
show all
Defined in:
lib/fabriq/skype/room.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(adapter, id, members, raw) ⇒ Room

Returns a new instance of Room.



7
8
9
10
11
12
# File 'lib/fabriq/skype/room.rb', line 7

def initialize(adapter, id, members, raw)
  @adapter = adapter
  @id = id
  @members = members
  @raw = raw
end

Instance Attribute Details

#adapterObject

Returns the value of attribute adapter.



5
6
7
# File 'lib/fabriq/skype/room.rb', line 5

def adapter
  @adapter
end

#idObject

Returns the value of attribute id.



5
6
7
# File 'lib/fabriq/skype/room.rb', line 5

def id
  @id
end

#membersObject

Returns the value of attribute members.



5
6
7
# File 'lib/fabriq/skype/room.rb', line 5

def members
  @members
end

#rawObject

Returns the value of attribute raw.



5
6
7
# File 'lib/fabriq/skype/room.rb', line 5

def raw
  @raw
end

#topicObject

Returns the value of attribute topic.



5
6
7
# File 'lib/fabriq/skype/room.rb', line 5

def topic
  @topic
end

Instance Method Details

#build_message_from_string(body, opts = {}) ⇒ Object



23
24
25
26
# File 'lib/fabriq/skype/room.rb', line 23

def build_message_from_string(body, opts = {})
  body = "@%s: %s" % [opts[:to], body] if opts[:to] && !private_session?
  Fabriq::Skype::Message.new(self, body)
end

#private_session?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/fabriq/skype/room.rb', line 14

def private_session?
  @members.count == 2
end

#send_message(body, opts = {}) ⇒ Object



18
19
20
21
# File 'lib/fabriq/skype/room.rb', line 18

def send_message(body, opts = {})
  message = build_message_from_string(body, opts)
  @adapter.enqueue_outgoing_message(message)
end