Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
class TwitterWelcomeMessageService
def self.call(*args)
new(*args).call
end
private
def call(twitter_handle)
client.update("@#{twitter_handle} welcome to 'Oranges & Apples', we hope you enjoy our juicy fruit!")
end
def client
@client ||= Twitter::REST::Client.new do |config|
config.consumer_key = "..."
config.consumer_secret = "..."
config.access_token = "..."
config.access_token_secret = "..."
end
end
end
class UsersController
def create
# ...
TwitterWelcomeMessageService.call(user.twitter_handle)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment