Class: JekyllRecker::Social::Twitter
- Defined in:
- lib/jekyll_recker/social.rb
Overview
Twitter social sharing backend
Constant Summary collapse
- KEY =
'twitter'
Instance Method Summary collapse
Methods inherited from Share
#config, #config_key, #dry?, #initialize, #latest, #latest_title, #post_body, share
Methods included from Mixins::Logging
Constructor Details
This class inherits a constructor from JekyllRecker::Social::Share
Instance Method Details
#configure! ⇒ Object
129 130 131 132 133 134 135 136 137 138 139 |
# File 'lib/jekyll_recker/social.rb', line 129 def configure! creds = extract_from_env || extract_from_config raise 'cannot find twitter credentials!' if creds.nil? @client = ::Twitter::REST::Client.new do |settings| settings.consumer_key = creds['consumer_api_key'] settings.consumer_secret = creds['consumer_api_secret'] settings.access_token = creds['access_token'] settings.access_token_secret = creds['access_token_secret'] end end |
#post! ⇒ Object
141 142 143 144 145 146 147 148 |
# File 'lib/jekyll_recker/social.rb', line 141 def post! if dry? logger.info('tweeting in dry mode, printing message') logger.info("BEGIN TWEET\n#{post_body}END TWEET") else @client.update(post_body) end end |