Sha256: 10b589bcbed7ac3040f0524a97fdc4c75f2441007a0b8aeeea6b32946bc5c93b

Contents?: true

Size: 702 Bytes

Versions: 1

Compression:

Stored size: 702 Bytes

Contents

require_relative "skype/message"
require_relative "skype/room"

module Fabriq
  module Skype
    class << self

      attr_accessor :adapter

      def adapter
        @adapter || Fabriq::Adapter
      end

      def rooms
        adapter.rooms
      end

      def room_by_id(room_id)
        rooms.select { |room| room.id == room_id }.first
      end

      def send_message(message)
        adapter.enqueue_outgoing_message(message)
      end

      def listen_for_messages_to_self(&block)
        adapter.subscribe_to_incoming_messages do |message|
          if message.private_session? || message.direct?
            block.call(message)
          end
        end
      end
      
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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