Class: Soundly::Tracks

Inherits:
Object
  • Object
show all
Defined in:
lib/soundly/tracks.rb

Constant Summary collapse

@@blue_playlist =
[]
@@red_playlist =
[]
@@all =
[]

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeTracks

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

#authenticateObject

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_playlistObject

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_songsObject



39
40
41
# File 'lib/soundly/tracks.rb', line 39

def blue_songs
	@@blue_playlist
end

#red_playlistObject

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_songsObject



43
44
45
# File 'lib/soundly/tracks.rb', line 43

def red_songs
	@@red_playlist
end