Sha256: 54ad32ff50ad3488f4ff6e31faca19a2921c8d195400e7f13c79f3b81785db10

Contents?: true

Size: 942 Bytes

Versions: 7

Compression:

Stored size: 942 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|
          { '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.3.4 lib/jabber_admin/commands/create_room_with_opts.rb
jabber_admin-1.3.3 lib/jabber_admin/commands/create_room_with_opts.rb
jabber_admin-1.3.2 lib/jabber_admin/commands/create_room_with_opts.rb
jabber_admin-1.3.1 lib/jabber_admin/commands/create_room_with_opts.rb
jabber_admin-1.3.0 lib/jabber_admin/commands/create_room_with_opts.rb
jabber_admin-1.2.0 lib/jabber_admin/commands/create_room_with_opts.rb
jabber_admin-1.1.0 lib/jabber_admin/commands/create_room_with_opts.rb