songstats-api 1.1.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +18 -1
- data/lib/songstats/api/artist.rb +18 -4
- data/lib/songstats/api/base.rb +5 -0
- data/lib/songstats/api/label.rb +18 -2
- data/lib/songstats/api/track.rb +0 -2
- data/lib/songstats/api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: abef0db83768f11fbe5b7b4065be17b37314ba7ae09838218fb679e1ed6ce609
|
4
|
+
data.tar.gz: e727fe9aa96d85f7cbeca6340453f931c214c3654b0ced5be3ce378f29e4017b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0058d84c8f6b1af15782760e7d97ecf9e2afbc58735c07c4950902d51abbb470056068016b7a9ec6edf2338635af3eebe150599ae7ece7c7b245d01db365df16'
|
7
|
+
data.tar.gz: 0a8e2720669bd876f5b5572146aef63d9a9e041fbc04e77b4875b09b095aa38502992da63611bec54eaf00e1762cab1cfa3a0786988771d9d7bde329c6da9af2
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -24,7 +24,24 @@ Or install it yourself as:
|
|
24
24
|
|
25
25
|
## Usage
|
26
26
|
|
27
|
-
|
27
|
+
To use this gem ensure that `SONGSTATS_API_KEY` is set as an env variarble.
|
28
|
+
|
29
|
+
This is a wrapper around Song Stats API - [you can find their docs here](https://docs.songstats.com/docs/api/e80265bb8b01b-songstats-api).
|
30
|
+
|
31
|
+
|
32
|
+
### Artist
|
33
|
+
```ruby
|
34
|
+
artist = Songstats::Api::Artist.new
|
35
|
+
artist.search "elton john", {"limit": "1"}
|
36
|
+
artist.info "22wbnEMDvgVIAGdFeek6ET"
|
37
|
+
```
|
38
|
+
|
39
|
+
### Track
|
40
|
+
```ruby
|
41
|
+
track = Songstats::Api::Track.new
|
42
|
+
track.search "rocket man", {"limit": "1"}
|
43
|
+
track.info "12341234"
|
44
|
+
```
|
28
45
|
|
29
46
|
## Development
|
30
47
|
|
data/lib/songstats/api/artist.rb
CHANGED
@@ -1,13 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "singleton"
|
4
|
-
|
5
3
|
module Songstats
|
6
4
|
module Api
|
7
5
|
# Artist class for the Songstats API
|
8
6
|
class Artist < Base
|
9
|
-
include Singleton
|
10
|
-
|
11
7
|
def initialize
|
12
8
|
super
|
13
9
|
@type = "artist"
|
@@ -77,6 +73,24 @@ module Songstats
|
|
77
73
|
# https://docs.songstats.com/docs/api/dc58c858fdbb6-delete-artist-link
|
78
74
|
delete path(id, "/artists/link_request", link: link)
|
79
75
|
end
|
76
|
+
|
77
|
+
def add_track(id, track_id)
|
78
|
+
# https://docs.songstats.com/docs/api/aux8fvg3g9sv7-add-artist-track
|
79
|
+
options = {}
|
80
|
+
options[:isrc] = track_id if track_id.size == ISRC_LENGTH
|
81
|
+
options[:spotify_track_id] = track_id if track_id.size > ISRC_LENGTH && !url?(track_id)
|
82
|
+
options[:link] = track_id if url? track_id
|
83
|
+
post path(id, "/artists/track_request", options)
|
84
|
+
end
|
85
|
+
|
86
|
+
def delete_track(id, track_id)
|
87
|
+
# https://docs.songstats.com/docs/api/sijd2vkvgwpdj-remove-artist-track
|
88
|
+
options = {}
|
89
|
+
options[:isrc] = track_id if track_id.size == ISRC_LENGTH
|
90
|
+
options[:songstats_track_id] = track_id if track_id.size == SONG_STATS_ID_LENGTH
|
91
|
+
options[:spotify_track_id] = track_id if track_id.size > ISRC_LENGTH
|
92
|
+
delete path(id, "/artists/track_request", options)
|
93
|
+
end
|
80
94
|
end
|
81
95
|
end
|
82
96
|
end
|
data/lib/songstats/api/base.rb
CHANGED
data/lib/songstats/api/label.rb
CHANGED
@@ -4,8 +4,6 @@ module Songstats
|
|
4
4
|
module Api
|
5
5
|
# Label class for the Songstats API
|
6
6
|
class Label < Base
|
7
|
-
include Singleton
|
8
|
-
|
9
7
|
# override because the label id is either songstats_label_id or beatport_label_id
|
10
8
|
def query_string(id)
|
11
9
|
return "songstats_label_id=#{id}" if id.size == SONG_STATS_ID_LENGTH
|
@@ -80,6 +78,24 @@ module Songstats
|
|
80
78
|
# https://docs.songstats.com/docs/api/f684183faa3b9-delete-label-link
|
81
79
|
delete path(id, "/labels/link_request", link: link)
|
82
80
|
end
|
81
|
+
|
82
|
+
def add_track(id, track_id)
|
83
|
+
# https://docs.songstats.com/docs/api/sf9lrzr189m48-add-label-track
|
84
|
+
options = {}
|
85
|
+
options[:isrc] = track_id if track_id.size == ISRC_LENGTH
|
86
|
+
options[:spotify_track_id] = track_id if track_id.size > ISRC_LENGTH && !url?(track_id)
|
87
|
+
options[:link] = track_id if url? track_id
|
88
|
+
post path(id, "/labels/track_request", options)
|
89
|
+
end
|
90
|
+
|
91
|
+
def delete_track(id, track_id)
|
92
|
+
# https://docs.songstats.com/docs/api/l0xhrjijnktgf-remove-label-link
|
93
|
+
options = {}
|
94
|
+
options[:isrc] = track_id if track_id.size == ISRC_LENGTH
|
95
|
+
options[:songstats_track_id] = track_id if track_id.size == SONG_STATS_ID_LENGTH
|
96
|
+
options[:spotify_track_id] = track_id if track_id.size > ISRC_LENGTH
|
97
|
+
delete path(id, "/labels/track_request", options)
|
98
|
+
end
|
83
99
|
end
|
84
100
|
end
|
85
101
|
end
|
data/lib/songstats/api/track.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: songstats-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daryl Findlay
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-05-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|