Class: Turbovax::TwitterClient

Inherits:
Object
  • Object
show all
Defined in:
lib/turbovax/twitter_client.rb

Overview

Helper class that wraps around Twitter gem

Class Method Summary collapse

Class Method Details

.clientObject



8
9
10
11
12
13
14
15
# File 'lib/turbovax/twitter_client.rb', line 8

def self.client
  @client ||= Twitter::REST::Client.new do |config|
    config.consumer_key        = Turbovax.twitter_credentials[:consumer_key]
    config.consumer_secret     = Turbovax.twitter_credentials[:consumer_secret]
    config.access_token        = Turbovax.twitter_credentials[:access_token]
    config.access_token_secret = Turbovax.twitter_credentials[:access_token_secret]
  end
end

.send_tweet(message, reply_to_id: nil) ⇒ Object



17
18
19
20
21
# File 'lib/turbovax/twitter_client.rb', line 17

def self.send_tweet(message, reply_to_id: nil)
  response = client.update(message, in_reply_to_status_id: reply_to_id)
  Turbovax.logger.info("[Turbovax::Twitter::Client] send_tweet (#{response.id})")
  response
end