Class: Drum::Service

Inherits:
Object show all
Defined in:
lib/drum/service/service.rb

Overview

A wrapper around a music streaming service's API providing methods for downloading/uploading playlists.

Instance Method Summary collapse

Instance Method Details

#download(playlist_ref) ⇒ Array<Playlist>

Downloads playlists from this service.

Parameters:

  • playlist_ref (Ref)

    A ref to the playlists (see README for examples)

Returns:



32
33
34
# File 'lib/drum/service/service.rb', line 32

def download(playlist_ref)
  raise "ERROR: Service '#{self.name}' cannot download playlists (yet)!"
end

#nameString

The service's internal name used to identify it.

Returns:

  • (String)

    The internal name of the service.



7
8
9
# File 'lib/drum/service/service.rb', line 7

def name
  raise "ERROR: Service does not specify a name!"
end

#parse_ref(raw_ref) ⇒ optional, Ref

Tries to parse a ref from this service.

Parameters:

  • raw_ref (RawRef)

    The raw reference to be parsed.

Returns:

  • (optional, Ref)

    The ref, if parsed successfully, otherwise nil



15
16
17
# File 'lib/drum/service/service.rb', line 15

def parse_ref(raw_ref)
  nil
end

#remove(playlist_ref) ⇒ Object

Removes playlists from this service.

Parameters:

  • playlist_ref (Ref)

    A ref to the playlists (see README for examples)



24
25
26
# File 'lib/drum/service/service.rb', line 24

def remove(playlist_ref)
  raise "ERROR: Service '#{self.name}' cannot remove playlists (yet)!"
end

#upload(playlist_ref, playlists) ⇒ Object

Uploads playlists to this service.

Parameters:

  • playlist_ref (Ref)

    A ref to the upload location (see README for examples)

  • playlists (Array<Playlist>, Enumerator<Playlist>)

    The list of playlists to be uploaded



40
41
42
# File 'lib/drum/service/service.rb', line 40

def upload(playlist_ref, playlists)
  raise "ERROR: Service '#{self.name}' cannot upload playlists (yet)!"
end