Sha256: be51c1acc4536971f265a1ef59f18de591089f2559865fcb17e22b7ebecfed1a

Contents?: true

Size: 684 Bytes

Versions: 1

Compression:

Stored size: 684 Bytes

Contents

module Fabriq
  module Skype
    class Room

      attr_accessor :adapter, :id, :topic, :members, :raw

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

      def private_session?
        @members.count == 2
      end

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

      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

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fabriq-0.1.0 lib/fabriq/skype/room.rb