Sha256: cc39126a370c609910eb0c8f5fdd1392d7e9ad9939b3cca5c2cf00673db4c45a

Contents?: true

Size: 940 Bytes

Versions: 7

Compression:

Stored size: 940 Bytes

Contents

# frozen_string_literal: true

module JabberAdmin
  module Commands
    # Create a new room (MUC) with additional options.
    #
    # @see https://bit.ly/2IBEfVO
    class CreateRoomWithOpts
      # Pass the correct data to the given callable.
      #
      # @param callable [Proc, #call] the callable to call
      # @param room [String] room JID (eg. +room1@conference.localhost+)
      # @param host [String] the jabber host (eg. +localhost+)
      # @param options pass additional +symbol: value+ pairs
      def self.call(callable, room:, host:, **options)
        name, service = room.split('@')
        options = options.map do |key, value|
          Hash['name', key.to_s, 'value', value.to_s]
        end

        callable.call('create_room_with_opts',
                      name: name,
                      service: service,
                      host: host,
                      options: options)
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
jabber_admin-1.0.5 lib/jabber_admin/commands/create_room_with_opts.rb
jabber_admin-1.0.4 lib/jabber_admin/commands/create_room_with_opts.rb
jabber_admin-1.0.3 lib/jabber_admin/commands/create_room_with_opts.rb
jabber_admin-1.0.2 lib/jabber_admin/commands/create_room_with_opts.rb
jabber_admin-1.0.1 lib/jabber_admin/commands/create_room_with_opts.rb
jabber_admin-1.0.0 lib/jabber_admin/commands/create_room_with_opts.rb
jabber_admin-0.2.0 lib/jabber_admin/commands/create_room_with_opts.rb