Class: WiMP::Track

Inherits:
Base
  • Object
show all
Defined in:
lib/wimp/track.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#execute, execute, #initialize, session, #session

Constructor Details

This class inherits a constructor from WiMP::Base

Class Method Details

.search(query, options = {}) ⇒ Object

@options Integer



11
12
13
14
15
16
17
18
19
# File 'lib/wimp/track.rb', line 11

def self.search(query, options =  {})
  execute do |client|
    client.search(
      query, 0, 0, 
      options.fetch(:limit, 10), 
      WiMP.configuration.session, 0
    ).tracks.map {|track| WiMP::Track.new(track)}
  end
end

Instance Method Details

#albumObject

Returns String.

Returns:

  • String



66
67
68
# File 'lib/wimp/track.rb', line 66

def album
  @o.album
end

#album_idObject

Returns Integer.

Returns:

  • Integer



52
53
54
# File 'lib/wimp/track.rb', line 52

def album_id
  @o.albumId
end

#artistObject

Returns SimpleArtist.

Returns:

  • SimpleArtist



73
74
75
# File 'lib/wimp/track.rb', line 73

def artist
  @o.artist
end

#artist_idObject

Returns Integer.

Returns:

  • Integer



59
60
61
# File 'lib/wimp/track.rb', line 59

def artist_id
  @o.artistId
end

#durationObject

Returns Integer.

Returns:

  • Integer



45
46
47
# File 'lib/wimp/track.rb', line 45

def duration
  @o.duration
end

#idObject

Returns Integer.

Returns:

  • Integer



38
39
40
# File 'lib/wimp/track.rb', line 38

def id
  @o.id
end

#popularityObject

Returns Integer.

Returns:

  • Integer



31
32
33
# File 'lib/wimp/track.rb', line 31

def popularity
  @o.popularity
end

#titleObject

Returns String.

Returns:

  • String



80
81
82
# File 'lib/wimp/track.rb', line 80

def title
  @o.title
end

#urlObject

Returns String.

Returns:

  • String



24
25
26
# File 'lib/wimp/track.rb', line 24

def url
  "http://wimpmusic.se/track/#{id}"
end