Class: WebChecker::Notifications
- Inherits:
-
Object
- Object
- WebChecker::Notifications
- Includes:
- Singleton
- Defined in:
- lib/web_checker/notifications.rb
Instance Attribute Summary collapse
-
#twilio ⇒ Object
readonly
Returns the value of attribute twilio.
Instance Method Summary collapse
Instance Attribute Details
#twilio ⇒ Object (readonly)
Returns the value of attribute twilio.
10 11 12 |
# File 'lib/web_checker/notifications.rb', line 10 def twilio @twilio end |
Instance Method Details
#notify ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/web_checker/notifications.rb', line 17 def notify = "Your url #{@options['url']} is active now" results = [] results.push(notify_via_email()) results.push(notify_via_twilio()) if @twilio results.include?(false) ? false : true end |
#notify_broken(count) ⇒ Object
25 26 27 28 29 30 |
# File 'lib/web_checker/notifications.rb', line 25 def notify_broken(count) results = [] results.push(notify_via_email((count))) results.push(notify_via_twilio((count))) if @twilio results.include?(false) ? false : true end |
#setup(options) ⇒ Object
12 13 14 15 |
# File 'lib/web_checker/notifications.rb', line 12 def setup() = @twilio = ['twilio'] ? Twilio::REST::Client.new(['twilio_sid'], ['twilio_token']) : nil end |