Class: BrmClient::Gateway::Http
- Inherits:
-
Object
- Object
- BrmClient::Gateway::Http
- Defined in:
- lib/brm_client/gateway/http.rb
Instance Attribute Summary collapse
-
#collection ⇒ Object
readonly
Returns the value of attribute collection.
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
Instance Method Summary collapse
- #disconnect ⇒ Object
-
#initialize(opts) ⇒ Http
constructor
A new instance of Http.
- #send_event(e) ⇒ Object
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
#collection ⇒ Object (readonly)
Returns the value of attribute collection.
5 6 7 |
# File 'lib/brm_client/gateway/http.rb', line 5 def collection @collection end |
#connection ⇒ Object (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
#disconnect ⇒ Object
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 |