Class: Ejaydj::Djs::TwitterBot

Inherits:
Ejaydj::Dj show all
Defined in:
lib/ejaydj/djs/twitter_bot.rb

Constant Summary collapse

MAX_SONG_LENGTH =
40
MAX_ARTIST_LENGTH =
40

Constants inherited from Ejaydj::Dj

Ejaydj::Dj::PLAYLIST_SCHEDULE

Instance Attribute Summary collapse

Attributes inherited from Ejaydj::Dj

#late_night_playlists, #morning_playlists, #music_client_id, #music_client_secret, #music_user_id, #night_playlists, #noon_playlists

Instance Method Summary collapse

Methods inherited from Ejaydj::Dj

#play_me_a_song, #playlists, #reload!

Constructor Details

#initialize(attributes = {}, &block) ⇒ TwitterBot

Returns a new instance of TwitterBot.



16
17
18
# File 'lib/ejaydj/djs/twitter_bot.rb', line 16

def initialize(attributes={}, &block)
  super(attributes, &block)
end

Instance Attribute Details

#twitter_access_tokenObject

Returns the value of attribute twitter_access_token.



7
8
9
# File 'lib/ejaydj/djs/twitter_bot.rb', line 7

def twitter_access_token
  @twitter_access_token
end

#twitter_access_token_secretObject

Returns the value of attribute twitter_access_token_secret.



7
8
9
# File 'lib/ejaydj/djs/twitter_bot.rb', line 7

def twitter_access_token_secret
  @twitter_access_token_secret
end

#twitter_client=(value) ⇒ Object

Sets the attribute twitter_client

Parameters:

  • value

    the value to set the attribute twitter_client to.



7
8
9
# File 'lib/ejaydj/djs/twitter_bot.rb', line 7

def twitter_client=(value)
  @twitter_client = value
end

#twitter_consumer_keyObject

Returns the value of attribute twitter_consumer_key.



7
8
9
# File 'lib/ejaydj/djs/twitter_bot.rb', line 7

def twitter_consumer_key
  @twitter_consumer_key
end

#twitter_consumer_secretObject

Returns the value of attribute twitter_consumer_secret.



7
8
9
# File 'lib/ejaydj/djs/twitter_bot.rb', line 7

def twitter_consumer_secret
  @twitter_consumer_secret
end

Instance Method Details

#tweet_me_a_song(time: Time.now) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/ejaydj/djs/twitter_bot.rb', line 20

def tweet_me_a_song(time: Time.now)
  @song = play_me_a_song(time: time)
  tweet = tweet_string

  twitter_client.update(tweet)
  {message: tweet, song: @song}
end