Class: Fluent::Tranquility::Pusher
- Inherits:
-
Object
- Object
- Fluent::Tranquility::Pusher
- Defined in:
- lib/fluent/tranquility/pusher.rb
Instance Attribute Summary collapse
-
#connection ⇒ Object
Returns the value of attribute connection.
Instance Method Summary collapse
- #call(data) ⇒ Object
-
#initialize(connection, dataset) ⇒ Pusher
constructor
A new instance of Pusher.
Constructor Details
#initialize(connection, dataset) ⇒ Pusher
Returns a new instance of Pusher.
6 7 8 9 |
# File 'lib/fluent/tranquility/pusher.rb', line 6 def initialize(connection, dataset) @connection = connection @dataset = dataset end |
Instance Attribute Details
#connection ⇒ Object
Returns the value of attribute connection.
4 5 6 |
# File 'lib/fluent/tranquility/pusher.rb', line 4 def connection @connection end |
Instance Method Details
#call(data) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/fluent/tranquility/pusher.rb', line 11 def call(data) res = connection.post("/v1/post/#{dataset}") do |req| req.headers['Content-Type'] = 'text/plain' req.body = data req.params['async'] = true req..timeout = 60 req..open_timeout = 60 end res.success? end |