class Postwill::Providers::Twitter
Public Class Methods
new(options)
click to toggle source
# File lib/postwill/providers/twitter.rb, line 4 def initialize(options) @client ||= ::Twitter::REST::Client.new do |config| config.consumer_key = credentials[:consumer_key] config.consumer_secret = credentials[:consumer_secret] config.access_token = options[:access_token] config.access_token_secret = options[:access_token_secret] end end
Private Instance Methods
credentials()
click to toggle source
# File lib/postwill/providers/twitter.rb, line 23 def credentials Postwill::Settings.config.providers.twitter end
post(options)
click to toggle source
# File lib/postwill/providers/twitter.rb, line 15 def post(options) image = File.open(options[:image]) if options[:image] text = options[:text] response = image ? client.update_with_media(text, image) : client.update(text) response.to_h end