Class: Soundly::Tracks
- Inherits:
-
Object
- Object
- Soundly::Tracks
- Defined in:
- lib/soundly/tracks.rb
Constant Summary collapse
- @@blue_playlist =
[]
- @@red_playlist =
[]
- @@all =
[]
Class Method Summary collapse
Instance Method Summary collapse
-
#authenticate ⇒ Object
LOG IN.
-
#blue_playlist ⇒ Object
SPOTIFY TOP 50 IN AMERICA.
- #blue_songs ⇒ Object
-
#initialize ⇒ Tracks
constructor
A new instance of Tracks.
-
#red_playlist ⇒ Object
MY PERSONAL SPOTIFY PLAYLIST.
- #red_songs ⇒ Object
Constructor Details
#initialize ⇒ Tracks
Returns a new instance of Tracks.
10 11 12 13 14 |
# File 'lib/soundly/tracks.rb', line 10 def initialize authenticate blue_playlist red_playlist end |
Class Method Details
.all(playlist) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/soundly/tracks.rb', line 17 def self.all(playlist) if playlist == "blue" @@blue_playlist else @@red_playlist end end |
Instance Method Details
#authenticate ⇒ Object
LOG IN
6 7 8 |
# File 'lib/soundly/tracks.rb', line 6 def authenticate #LOG IN RSpotify.authenticate(ENV['CLIENT_ID'], ENV['CLIENT_SECRET']) end |
#blue_playlist ⇒ Object
SPOTIFY TOP 50 IN AMERICA
25 26 27 28 29 30 |
# File 'lib/soundly/tracks.rb', line 25 def blue_playlist #SPOTIFY TOP 50 IN AMERICA playlist = RSpotify::Playlist.find('spotifycharts', '37i9dQZEVXbLRQDuF5jeBp') playlist.tracks.each do |song| @@blue_playlist << song end end |
#blue_songs ⇒ Object
39 40 41 |
# File 'lib/soundly/tracks.rb', line 39 def blue_songs @@blue_playlist end |
#red_playlist ⇒ Object
MY PERSONAL SPOTIFY PLAYLIST
32 33 34 35 36 37 |
# File 'lib/soundly/tracks.rb', line 32 def red_playlist #MY PERSONAL SPOTIFY PLAYLIST playlist = RSpotify::Playlist.find('dwayne.', '2wbLPMQHxG3vhxQzRNEOm9') playlist.tracks.each do |song| @@red_playlist << song end end |
#red_songs ⇒ Object
43 44 45 |
# File 'lib/soundly/tracks.rb', line 43 def red_songs @@red_playlist end |