Class: Backup::Notifier::Twitter
- Defined in:
- lib/backup/notifier/twitter.rb
Instance Attribute Summary collapse
-
#consumer_key ⇒ Object
Twitter consumer key credentials.
-
#consumer_secret ⇒ Object
Twitter consumer key credentials.
-
#model ⇒ Object
Container for the Model object.
-
#oauth_token ⇒ Object
OAuth credentials.
-
#oauth_token_secret ⇒ Object
OAuth credentials.
-
#twitter_client ⇒ Object
Container for the Twitter Client object.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(&block) ⇒ Twitter
constructor
Instantiates a new Backup::Notifier::Twitter object.
-
#perform!(model, exception = false) ⇒ Object
Performs the notification Takes an exception object that might’ve been created if an exception occurred.
Methods inherited from Base
Methods included from Configuration::Helpers
#clear_defaults!, #getter_methods, #load_defaults!, #setter_methods
Constructor Details
#initialize(&block) ⇒ Twitter
Instantiates a new Backup::Notifier::Twitter object
29 30 31 32 33 34 35 |
# File 'lib/backup/notifier/twitter.rb', line 29 def initialize(&block) load_defaults! instance_eval(&block) if block_given? set_defaults! end |
Instance Attribute Details
#consumer_key ⇒ Object
Twitter consumer key credentials
21 22 23 |
# File 'lib/backup/notifier/twitter.rb', line 21 def consumer_key @consumer_key end |
#consumer_secret ⇒ Object
Twitter consumer key credentials
21 22 23 |
# File 'lib/backup/notifier/twitter.rb', line 21 def consumer_secret @consumer_secret end |
#model ⇒ Object
Container for the Model object
17 18 19 |
# File 'lib/backup/notifier/twitter.rb', line 17 def model @model end |
#oauth_token ⇒ Object
OAuth credentials
25 26 27 |
# File 'lib/backup/notifier/twitter.rb', line 25 def oauth_token @oauth_token end |
#oauth_token_secret ⇒ Object
OAuth credentials
25 26 27 |
# File 'lib/backup/notifier/twitter.rb', line 25 def oauth_token_secret @oauth_token_secret end |
#twitter_client ⇒ Object
Container for the Twitter Client object
13 14 15 |
# File 'lib/backup/notifier/twitter.rb', line 13 def twitter_client @twitter_client end |
Instance Method Details
#perform!(model, exception = false) ⇒ Object
Performs the notification Takes an exception object that might’ve been created if an exception occurred. If this is the case it’ll invoke notify_failure!(exception), otherwise, if no error was raised, it’ll go ahead and notify_success!
If’ll only perform these if on_success is true or on_failure is true
44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/backup/notifier/twitter.rb', line 44 def perform!(model, exception = false) @model = model if notify_on_success? and exception.eql?(false) log! notify_success! elsif notify_on_failure? and not exception.eql?(false) log! notify_failure!(exception) end end |