Class: BrmClient::Gateway::Http

Inherits:
Object
  • Object
show all
Defined in:
lib/brm_client/gateway/http.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ Http

Returns a new instance of Http.



6
7
8
9
10
11
12
13
14
# File 'lib/brm_client/gateway/http.rb', line 6

def initialize opts
  host = opts[:host]
  port = opts[:port]
  path = opts[:path] || ""
  @endpoint = "http://#{host}:#{port}"
  @timeout = opts[:timeout] || 300
  @destination = opts[:queue] || opts[:application]
  @rest_client = RestClient::Resource.new(@endpoint, :timeout => @timeout)
end

Instance Attribute Details

#collectionObject (readonly)

Returns the value of attribute collection.



5
6
7
# File 'lib/brm_client/gateway/http.rb', line 5

def collection
  @collection
end

#connectionObject (readonly)

Returns the value of attribute connection.



5
6
7
# File 'lib/brm_client/gateway/http.rb', line 5

def connection
  @connection
end

Instance Method Details

#disconnectObject



16
17
# File 'lib/brm_client/gateway/http.rb', line 16

def disconnect
end

#send_event(e) ⇒ Object



19
20
21
# File 'lib/brm_client/gateway/http.rb', line 19

def send_event e
  @rest_client.post :destination => @destination, :msg => e.to_json
end