Skip to content

Instantly share code, notes, and snippets.

@jeanpaulsio
Created April 19, 2017 01:03
Show Gist options
  • Save jeanpaulsio/7edf6c29ed84d088cd1a9cd4f6851115 to your computer and use it in GitHub Desktop.
Save jeanpaulsio/7edf6c29ed84d088cd1a9cd4f6851115 to your computer and use it in GitHub Desktop.
class TwitterWrapper
attr_accessor :twitter_handle, :message
def initialize
boot_twitter
end
def tweet
@client.update("@#{twitter_handle} #{message}")
end
private
def boot_twitter
@client = Twitter::REST::Client.new do |config|
config.consumer_key = ENV['TWITTER_CONSUMER_KEY']
config.consumer_secret = ENV['TWITTER_CONSUMER_SECRET']
config.access_token = ENV['TWITTER_ACCESS_TOKEN']
config.access_token_secret = ENV['TWITTER_ACCESS_TOKEN_SECRET']
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment