Class: WatchList::Client
- Inherits:
-
Object
- Object
- WatchList::Client
- Defined in:
- lib/watch_list/client.rb
Constant Summary collapse
- MONITOR_ATTRS =
[ :URL, :Type, :SubType, :Port, :KeywordType, :KeywordValue, :HTTPUsername, :HTTPPassword, :AlertContacts, :Interval, ]
Instance Method Summary collapse
- #apply(file) ⇒ Object
- #export ⇒ Object
-
#initialize(options = {}) ⇒ Client
constructor
A new instance of Client.
- #status ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Client
Returns a new instance of Client.
15 16 17 18 19 |
# File 'lib/watch_list/client.rb', line 15 def initialize( = {}) = @uptimerobot = UptimeRobot::Client.new(:apiKey => [:apiKey]) @driver = WatchList::Driver.new(@uptimerobot, ) end |
Instance Method Details
#apply(file) ⇒ Object
38 39 40 |
# File 'lib/watch_list/client.rb', line 38 def apply(file) walk(file) end |
#export ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/watch_list/client.rb', line 21 def export exported = WatchList::Exporter.export(@uptimerobot, ) if block_given? exported.each do |name, attrs| dsl = WatchList::DSL.convert({name => attrs}, ) yield(name, dsl) unless dsl.empty? end else WatchList::DSL.convert(exported, ) end end |
#status ⇒ Object
34 35 36 |
# File 'lib/watch_list/client.rb', line 34 def status WatchList::Exporter.export_status(@uptimerobot, ) end |