Created
April 19, 2017 01:03
-
-
Save jeanpaulsio/7edf6c29ed84d088cd1a9cd4f6851115 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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