Class: Contentful::Social::FacebookHandler
- Inherits:
-
Object
- Object
- Contentful::Social::FacebookHandler
- Defined in:
- lib/contentful/social/facebook_handler.rb
Instance Attribute Summary collapse
-
#contentful ⇒ Object
readonly
Returns the value of attribute contentful.
-
#facebook ⇒ Object
readonly
Returns the value of attribute facebook.
-
#template ⇒ Object
readonly
Returns the value of attribute template.
-
#webhook ⇒ Object
readonly
Returns the value of attribute webhook.
Instance Method Summary collapse
-
#initialize(facebook_config, contentful_client, webhook) ⇒ FacebookHandler
constructor
A new instance of FacebookHandler.
- #post ⇒ Object
Constructor Details
#initialize(facebook_config, contentful_client, webhook) ⇒ FacebookHandler
Returns a new instance of FacebookHandler.
8 9 10 11 12 13 14 15 |
# File 'lib/contentful/social/facebook_handler.rb', line 8 def initialize(facebook_config, contentful_client, webhook) @template = facebook_config.template @post_to = facebook_config.post_to || 'me' @webhook = webhook @contentful = contentful_client @facebook = create_facebook_client(facebook_config) end |
Instance Attribute Details
#contentful ⇒ Object (readonly)
Returns the value of attribute contentful.
6 7 8 |
# File 'lib/contentful/social/facebook_handler.rb', line 6 def contentful @contentful end |
#facebook ⇒ Object (readonly)
Returns the value of attribute facebook.
6 7 8 |
# File 'lib/contentful/social/facebook_handler.rb', line 6 def facebook @facebook end |
#template ⇒ Object (readonly)
Returns the value of attribute template.
6 7 8 |
# File 'lib/contentful/social/facebook_handler.rb', line 6 def template @template end |
#webhook ⇒ Object (readonly)
Returns the value of attribute webhook.
6 7 8 |
# File 'lib/contentful/social/facebook_handler.rb', line 6 def webhook @webhook end |
Instance Method Details
#post ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/contentful/social/facebook_handler.rb', line 17 def post body = ::Contentful::Social::Template.new( contentful, webhook, template ).render facebook.put_connections(@post_to, 'feed', message: body) end |