Class: Converse::RESTBroker

Inherits:
Broker
  • Object
show all
Defined in:
lib/converse/rest/rest_broker.rb

Instance Attribute Summary collapse

Attributes inherited from Broker

#domain_language

Instance Method Summary collapse

Methods inherited from Broker

#discuss, #translate_response

Instance Attribute Details

#hostObject

Returns the value of attribute host.



5
6
7
# File 'lib/converse/rest/rest_broker.rb', line 5

def host
  @host
end

#passwordObject

Returns the value of attribute password.



8
9
10
# File 'lib/converse/rest/rest_broker.rb', line 8

def password
  @password
end

#portObject

Returns the value of attribute port.



6
7
8
# File 'lib/converse/rest/rest_broker.rb', line 6

def port
  @port
end

#usernameObject

Returns the value of attribute username.



7
8
9
# File 'lib/converse/rest/rest_broker.rb', line 7

def username
  @username
end

Instance Method Details

#authenticated_by(username) ⇒ Object



32
33
34
35
# File 'lib/converse/rest/rest_broker.rb', line 32

def authenticated_by(username)
  @username = username
  self
end

#broker_conversation(topic) ⇒ Object



10
11
12
13
14
15
# File 'lib/converse/rest/rest_broker.rb', line 10

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

#host_and_portObject



25
26
27
28
29
30
# File 'lib/converse/rest/rest_broker.rb', line 25

def host_and_port
  u = ""
  u = u + "#{@host}" if not @host.nil?
  u = u + ":#{@port}" if not @port.nil?
  u
end

#on_port(port) ⇒ Object



47
48
49
50
# File 'lib/converse/rest/rest_broker.rb', line 47

def on_port(port)
  @port = port
  self
end

#open_topic(concern, action) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/converse/rest/rest_broker.rb', line 17

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

#talks_to(host) ⇒ Object



42
43
44
45
# File 'lib/converse/rest/rest_broker.rb', line 42

def talks_to(host)
  @host = host
  self
end

#with_password(password) ⇒ Object



37
38
39
40
# File 'lib/converse/rest/rest_broker.rb', line 37

def with_password(password)
  @password = password
  self
end