songstats-api 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9a6d73f1bc7dae4d2a9f13b8b9a6e79ffc1d7eae7f439bc6cc11b11d83f74a20
4
- data.tar.gz: a1e58fb1fece05588a000aa3127a76107a361ef889d375b8fe99998683984c46
3
+ metadata.gz: abef0db83768f11fbe5b7b4065be17b37314ba7ae09838218fb679e1ed6ce609
4
+ data.tar.gz: e727fe9aa96d85f7cbeca6340453f931c214c3654b0ced5be3ce378f29e4017b
5
5
  SHA512:
6
- metadata.gz: 8ce059265973ec4d7f7d2e9f0848a3f2495a6e9285012d8328df0daee47741ef5d1a9e49ab73c592cb4cc8056ae19900d4fd658f3f9eede8afe4b471eb58d42c
7
- data.tar.gz: 687bf1a1f80075abd4b1f23425160d6ec42530a56c3504c8af09bebc5ba04c918969b52180e2dfb215f77532a4640ef5120e161afed27fcbd3a1a09d20f1c637
6
+ metadata.gz: '0058d84c8f6b1af15782760e7d97ecf9e2afbc58735c07c4950902d51abbb470056068016b7a9ec6edf2338635af3eebe150599ae7ece7c7b245d01db365df16'
7
+ data.tar.gz: 0a8e2720669bd876f5b5572146aef63d9a9e041fbc04e77b4875b09b095aa38502992da63611bec54eaf00e1762cab1cfa3a0786988771d9d7bde329c6da9af2
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- songstats-api (1.2.0)
4
+ songstats-api (1.3.0)
5
5
  httparty
6
6
 
7
7
  GEM
@@ -73,6 +73,24 @@ module Songstats
73
73
  # https://docs.songstats.com/docs/api/dc58c858fdbb6-delete-artist-link
74
74
  delete path(id, "/artists/link_request", link: link)
75
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
76
94
  end
77
95
  end
78
96
  end
@@ -21,6 +21,11 @@ module Songstats
21
21
 
22
22
  private
23
23
 
24
+ def url?(str)
25
+ url_regex = /\A#{URI::DEFAULT_PARSER.make_regexp(%w[http https])}\z/
26
+ str =~ url_regex ? true : false
27
+ end
28
+
24
29
  def query_string(id)
25
30
  return "isrc=#{id}" if id.size == ISRC_LENGTH
26
31
 
@@ -78,6 +78,24 @@ module Songstats
78
78
  # https://docs.songstats.com/docs/api/f684183faa3b9-delete-label-link
79
79
  delete path(id, "/labels/link_request", link: link)
80
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
81
99
  end
82
100
  end
83
101
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Songstats
4
4
  module Api
5
- VERSION = "1.2.0"
5
+ VERSION = "1.3.0"
6
6
  end
7
7
  end
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.2.0
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-04-12 00:00:00.000000000 Z
11
+ date: 2024-05-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty