Class: Songstats::Api::Track
- Inherits:
-
Base
- Object
- Base
- Songstats::Api::Track
show all
- Defined in:
- lib/songstats/api/track.rb
Overview
Track class for the Songstats API
Constant Summary
Constants inherited
from Base
Base::ISRC_LENGTH, Base::SONG_STATS_ID_LENGTH
Instance Method Summary
collapse
Constructor Details
#initialize ⇒ Track
Returns a new instance of Track.
7
8
9
10
|
# File 'lib/songstats/api/track.rb', line 7
def initialize
super
@type = "track"
end
|
Instance Method Details
#activities(id, options = {}) ⇒ Object
17
18
19
20
21
|
# File 'lib/songstats/api/track.rb', line 17
def activities(id, options = {})
options[:source] = "all" unless options.key? :source
fetch path(id, "/tracks/activities", options)
end
|
#add_link(id, link) ⇒ Object
41
42
43
44
|
# File 'lib/songstats/api/track.rb', line 41
def add_link(id, link)
post path(id, "/tracks/link_request", link: link)
end
|
#delete_link(id, link) ⇒ Object
46
47
48
49
|
# File 'lib/songstats/api/track.rb', line 46
def delete_link(id, link)
delete path(id, "/tracks/link_request", link: link)
end
|
#historic_stats(id, options = {}) ⇒ Object
29
30
31
32
33
|
# File 'lib/songstats/api/track.rb', line 29
def historic_stats(id, options = {})
options[:source] = "all" unless options.key? :source
fetch path(id, "/tracks/historic_stats", options)
end
|
#info(id) ⇒ Object
12
13
14
15
|
# File 'lib/songstats/api/track.rb', line 12
def info(id)
fetch path(id, "/tracks/info")
end
|
#search(query, options = {}) ⇒ Object
35
36
37
38
39
|
# File 'lib/songstats/api/track.rb', line 35
def search(query, options = {})
options[:q] = query
fetch path("", "/tracks/search", options)
end
|
#stats(id, options = {}) ⇒ Object
23
24
25
26
27
|
# File 'lib/songstats/api/track.rb', line 23
def stats(id, options = {})
options[:source] = "all" unless options.key? :source
fetch path(id, "/tracks/stats", options)
end
|