Class: Logplex::Drain
- Inherits:
-
Object
- Object
- Logplex::Drain
- Defined in:
- lib/logplex/drain.rb
Overview
Operations on a Logplex::Drain:
Add a url to a drain: POST /v2/channels/<channel>/drains/<drain> { "url": ... }
drain.use(url) ### I like 'use' better than 'drain.url = "url"'
Delete a drain: DELETE /v2/channels/<channel>/drains/<drain>
drain.destroy
Instance Attribute Summary collapse
-
#drain_url ⇒ Object
Public: Get the url for this drain.
-
#id ⇒ Object
readonly
Public: Get the id for this drain.
Instance Method Summary collapse
-
#destroy ⇒ Object
Public: Destroy this drain.
-
#initialize(url, channel_id, drain_id, drain_token, drain_url = nil) ⇒ Drain
constructor
A new instance of Drain.
Constructor Details
#initialize(url, channel_id, drain_id, drain_token, drain_url = nil) ⇒ Drain
Returns a new instance of Drain.
10 11 12 13 14 15 16 17 |
# File 'lib/logplex/drain.rb', line 10 def initialize(url, channel_id, drain_id, drain_token, drain_url=nil) @url = url @channel_id = channel_id @id = drain_id @token = drain_token @drain_url = drain_url @backend = Logplex::Client::Backends::HTTP.new(@url) end |
Instance Attribute Details
#drain_url ⇒ Object
Public: Get the url for this drain.
41 42 43 |
# File 'lib/logplex/drain.rb', line 41 def drain_url @drain_url end |
#id ⇒ Object (readonly)
Public: Get the id for this drain
44 45 46 |
# File 'lib/logplex/drain.rb', line 44 def id @id end |
Instance Method Details
#destroy ⇒ Object
Public: Destroy this drain.
Returns nothing Raises TODO(sissel): document exceptions
23 24 25 |
# File 'lib/logplex/drain.rb', line 23 def destroy @backend.delete_drain(@channel_id, @id) end |