Class: Feedbook::Notifiers::FacebookNotifier
- Inherits:
-
Object
- Object
- Feedbook::Notifiers::FacebookNotifier
- Includes:
- Singleton
- Defined in:
- lib/feedbook/notifiers/facebook_notifier.rb
Instance Method Summary collapse
-
#load_configuration(configuration = {}) ⇒ NilClass
Load configuration for FacebookNotifier.
-
#notify(message) ⇒ NilClass
Sends notification to Facebook wall.
Instance Method Details
#load_configuration(configuration = {}) ⇒ NilClass
Load configuration for FacebookNotifier
31 32 33 34 35 36 37 |
# File 'lib/feedbook/notifiers/facebook_notifier.rb', line 31 def load_configuration(configuration = {}) @client = Koala::Facebook::API.new(configuration.fetch('token'), configuration.fetch('app_secret', nil)) puts 'Configuration loaded for FacebookNotifier' rescue Koala::KoalaError => e raise Errors::NotifierConfigurationError.new(:facebook, e.) end |
#notify(message) ⇒ NilClass
Sends notification to Facebook wall
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/feedbook/notifiers/facebook_notifier.rb', line 15 def notify() if client.nil? puts "Message has not been notified on Facebook: #{} because of invalid client configuration" else client.put_wall_post() puts "New message has been notified on Facebook: #{}" end rescue Koala::KoalaError => e p "FacebookNotifier did not notify because of client error (#{e.})." end |