Sha256: 61d3acb04be1e8de5bafa95ebb960d68a83bba920ddccc807c316dd9a3f0db19

Contents?: true

Size: 807 Bytes

Versions: 1

Compression:

Stored size: 807 Bytes

Contents

require "converse/broker"

module Converse
  class RESTBroker < Broker
    attr_accessor :peer_host_and_port
    attr_accessor :username
    attr_accessor :password

    def broker_conversation(topic)
      conversation = HTMLConversation.new(topic)
      conversation.username = @username if @username.nil? == false
      conversation.password = @password if @password.nil? == false
      conversation
    end

    def open_topic(concern, action)
      if (concern.nil? == true or concern == "")
        "http://#{@peer_host_and_port}/#{action}"
      else
        "http://#{@peer_host_and_port}/#{concern}/#{action}"
      end
    end

    def authenticated_by(username)
      @username = username
      self
    end

    def with_password(password)
      @password = password
      self
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
converse-1.0.15 lib/converse/rest/rest_broker.rb