Module: Lazybird::TwitterClient

Extended by:
TwitterClient
Included in:
TwitterClient
Defined in:
lib/lazybird/twitter_client.rb

Instance Method Summary collapse

Instance Method Details

#retweet_random_friendObject



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

def retweet_random_friend
  tweet = random_friend_tweet
  message = tweet.text
  duplicate_tweet_check(message)
  client.retweet tweet
  message
rescue Twitter::Error::Forbidden, Sequel::UniqueConstraintViolation
  duplicated_tweet_warning
end

#tweet(message:) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/lazybird/twitter_client.rb', line 17

def tweet(message:)
  duplicate_tweet_check(message)
  client.update message
  message
rescue Twitter::Error::Forbidden, Sequel::UniqueConstraintViolation
  duplicated_tweet_warning
end