songle-song-uri-parser 1.1.1 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/lib/songle-song-uri-parser.rb +8 -6
- data/lib/songle-song-uri-parser/version.rb +4 -0
- data/lib/songle/song_uri.rb +23 -23
- data/lib/songle/song_uri/invalid_song_uri_error.rb +2 -2
- data/lib/songle/song_uri/mp3_song_uri.rb +9 -9
- data/lib/songle/song_uri/nn_scheme_song_uri.rb +4 -4
- data/lib/songle/song_uri/nn_short_song_uri.rb +4 -4
- data/lib/songle/song_uri/nn_song_uri.rb +5 -5
- data/lib/songle/song_uri/numeric_song_uri.rb +3 -3
- data/lib/songle/song_uri/sc_scheme_song_uri.rb +4 -4
- data/lib/songle/song_uri/sc_song_uri.rb +5 -5
- data/lib/songle/song_uri/yt_scheme_song_uri.rb +4 -4
- data/lib/songle/song_uri/yt_short_song_uri.rb +4 -4
- data/lib/songle/song_uri/yt_song_uri.rb +5 -5
- data/songle-song-uri-parser.gemspec +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f3d24947ddabd6ef501f43fba6935409860faa32dd1da2bbeeb626c4d5b7fbcb
|
4
|
+
data.tar.gz: 9d5e563fc6d919dc39b37d8c23039f95e7736f602c0afecf86bedc4705fe1bb1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9fe2886f06335dbf899df2145dc14a182fa460fe2f39e4e413fc082cdd7fefe810cae8ba61664d5f3b4a1c8254798667b792db3867e3de7ef1ac74efca129f81
|
7
|
+
data.tar.gz: d502d93ab14a84eb4b4c68811f37cf3cfe9ebe6440f552aa9a71461e805e56ff8c5168dbc685bcbbebf9932ba60bc62357489c7cfe423687b645192c97eb449d
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.6.
|
1
|
+
2.6.1
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,17 +1,19 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
require "songle/song_uri"
|
3
|
-
|
4
|
-
require "songle/song_uri/
|
3
|
+
|
4
|
+
require "songle/song_uri/invalid_song_uri_error"
|
5
|
+
|
5
6
|
require "songle/song_uri/nn_song_uri"
|
6
7
|
require "songle/song_uri/nn_scheme_song_uri"
|
7
8
|
require "songle/song_uri/nn_short_song_uri"
|
9
|
+
|
8
10
|
require "songle/song_uri/sc_song_uri"
|
9
11
|
require "songle/song_uri/sc_scheme_song_uri"
|
12
|
+
|
10
13
|
require "songle/song_uri/yt_song_uri"
|
11
14
|
require "songle/song_uri/yt_scheme_song_uri"
|
12
15
|
require "songle/song_uri/yt_short_song_uri"
|
13
|
-
require "songle/song_uri/invalid_song_uri_error"
|
14
16
|
|
15
|
-
|
16
|
-
|
17
|
-
|
17
|
+
require "songle/song_uri/numeric_song_uri"
|
18
|
+
|
19
|
+
require "songle/song_uri/mp3_song_uri"
|
data/lib/songle/song_uri.rb
CHANGED
@@ -26,7 +26,7 @@ module ::Songle
|
|
26
26
|
##
|
27
27
|
# @constructor
|
28
28
|
#
|
29
|
-
def initialize
|
29
|
+
def initialize options = nil
|
30
30
|
options ||= {}
|
31
31
|
|
32
32
|
@endpoint_scheme =
|
@@ -78,31 +78,31 @@ module ::Songle
|
|
78
78
|
# @method
|
79
79
|
# @static
|
80
80
|
#
|
81
|
-
def parse
|
82
|
-
|
83
|
-
::URI.decode_www_form_component(
|
81
|
+
def parse query_string, options = nil
|
82
|
+
query_string =
|
83
|
+
::URI.decode_www_form_component(query_string.to_s)
|
84
84
|
|
85
85
|
case
|
86
|
-
when
|
87
|
-
return ::Songle::SongURI::NnSongURI.new(
|
88
|
-
when
|
89
|
-
return ::Songle::SongURI::NnSchemeSongURI.new(
|
90
|
-
when
|
91
|
-
return ::Songle::SongURI::NnShortSongURI.new(
|
92
|
-
when
|
93
|
-
return ::Songle::SongURI::ScSongURI.new(
|
94
|
-
when
|
95
|
-
return ::Songle::SongURI::ScSchemeSongURI.new(
|
96
|
-
when
|
97
|
-
return ::Songle::SongURI::YtSongURI.new(
|
98
|
-
when
|
99
|
-
return ::Songle::SongURI::YtSchemeSongURI.new(
|
100
|
-
when
|
101
|
-
return ::Songle::SongURI::YtShortSongURI.new(
|
102
|
-
when
|
103
|
-
return ::Songle::SongURI::NumericSongURI.new(
|
86
|
+
when query_string =~ ::Songle::SongURI::NnSongURI::URI_REGEX
|
87
|
+
return ::Songle::SongURI::NnSongURI.new(query_string, options)
|
88
|
+
when query_string =~ ::Songle::SongURI::NnSchemeSongURI::URI_REGEX
|
89
|
+
return ::Songle::SongURI::NnSchemeSongURI.new(query_string, options)
|
90
|
+
when query_string =~ ::Songle::SongURI::NnShortSongURI::URI_REGEX
|
91
|
+
return ::Songle::SongURI::NnShortSongURI.new(query_string, options)
|
92
|
+
when query_string =~ ::Songle::SongURI::ScSongURI::URI_REGEX
|
93
|
+
return ::Songle::SongURI::ScSongURI.new(query_string, options)
|
94
|
+
when query_string =~ ::Songle::SongURI::ScSchemeSongURI::URI_REGEX
|
95
|
+
return ::Songle::SongURI::ScSchemeSongURI.new(query_string, options)
|
96
|
+
when query_string =~ ::Songle::SongURI::YtSongURI::URI_REGEX
|
97
|
+
return ::Songle::SongURI::YtSongURI.new(query_string, options)
|
98
|
+
when query_string =~ ::Songle::SongURI::YtSchemeSongURI::URI_REGEX
|
99
|
+
return ::Songle::SongURI::YtSchemeSongURI.new(query_string, options)
|
100
|
+
when query_string =~ ::Songle::SongURI::YtShortSongURI::URI_REGEX
|
101
|
+
return ::Songle::SongURI::YtShortSongURI.new(query_string, options)
|
102
|
+
when query_string =~ ::Songle::SongURI::NumericSongURI::URI_REGEX
|
103
|
+
return ::Songle::SongURI::NumericSongURI.new(query_string, options)
|
104
104
|
else
|
105
|
-
return ::Songle::SongURI::Mp3SongURI.new(
|
105
|
+
return ::Songle::SongURI::Mp3SongURI.new(query_string, options)
|
106
106
|
end
|
107
107
|
end
|
108
108
|
end
|
@@ -16,23 +16,23 @@ module ::Songle::SongURI
|
|
16
16
|
##
|
17
17
|
# @constructor
|
18
18
|
#
|
19
|
-
def initialize
|
20
|
-
super(
|
19
|
+
def initialize query_string, options
|
20
|
+
super(options)
|
21
21
|
|
22
|
-
if
|
23
|
-
|
22
|
+
if query_string =~ URI_REGEX
|
23
|
+
query_string = $3
|
24
24
|
end
|
25
25
|
|
26
|
-
if
|
27
|
-
|
26
|
+
if query_string =~ /^#{ self.endpoint_host }(.+)$/
|
27
|
+
query_string = $1
|
28
28
|
end
|
29
29
|
|
30
|
-
if
|
31
|
-
|
30
|
+
if query_string =~ /^#{ self.endpoint_path }(.+)$/
|
31
|
+
query_string = $1
|
32
32
|
end
|
33
33
|
|
34
34
|
source_uri =
|
35
|
-
::URI.parse("//#{
|
35
|
+
::URI.parse("//#{ query_string }")
|
36
36
|
|
37
37
|
@source_host = source_uri.host
|
38
38
|
@source_path = source_uri.path
|
@@ -26,15 +26,15 @@ module ::Songle::SongURI
|
|
26
26
|
##
|
27
27
|
# @constructor
|
28
28
|
#
|
29
|
-
def initialize
|
30
|
-
super(
|
29
|
+
def initialize query_string, options
|
30
|
+
super(options)
|
31
31
|
|
32
32
|
@source_host = SOURCE_HOST
|
33
33
|
@source_path = SOURCE_PATH
|
34
|
-
@source_id = $1 if
|
34
|
+
@source_id = $1 if query_string =~ URI_REGEX
|
35
35
|
|
36
36
|
if @source_id.nil? || @source_id.strip.empty?
|
37
|
-
raise ::Songle::SongURI::InvalidSongURIError.new(
|
37
|
+
raise ::Songle::SongURI::InvalidSongURIError.new(query_string)
|
38
38
|
end
|
39
39
|
|
40
40
|
@source_path += @source_id
|
@@ -26,15 +26,15 @@ module ::Songle::SongURI
|
|
26
26
|
##
|
27
27
|
# @constructor
|
28
28
|
#
|
29
|
-
def initialize
|
30
|
-
super(
|
29
|
+
def initialize query_string, options
|
30
|
+
super(options)
|
31
31
|
|
32
32
|
@source_host = SOURCE_HOST
|
33
33
|
@source_path = SOURCE_PATH
|
34
|
-
@source_id = $1 if
|
34
|
+
@source_id = $1 if query_string =~ URI_REGEX
|
35
35
|
|
36
36
|
if @source_id.nil? || @source_id.strip.empty?
|
37
|
-
raise ::Songle::SongURI::InvalidSongURIError.new(
|
37
|
+
raise ::Songle::SongURI::InvalidSongURIError.new(query_string)
|
38
38
|
end
|
39
39
|
|
40
40
|
@source_path += @source_id
|
@@ -26,15 +26,15 @@ module ::Songle::SongURI
|
|
26
26
|
##
|
27
27
|
# @constructor
|
28
28
|
#
|
29
|
-
def initialize
|
30
|
-
super(
|
29
|
+
def initialize query_string, options
|
30
|
+
super(options)
|
31
31
|
|
32
32
|
@source_host = SOURCE_HOST
|
33
|
-
@source_path = $1 if
|
34
|
-
@source_id = $2 if
|
33
|
+
@source_path = $1 if query_string =~ URI_REGEX
|
34
|
+
@source_id = $2 if query_string =~ URI_REGEX
|
35
35
|
|
36
36
|
if @source_id.nil? || @source_id.strip.empty?
|
37
|
-
raise ::Songle::SongURI::InvalidSongURIError.new(
|
37
|
+
raise ::Songle::SongURI::InvalidSongURIError.new(query_string)
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
@@ -16,12 +16,12 @@ module ::Songle::SongURI
|
|
16
16
|
##
|
17
17
|
# @constructor
|
18
18
|
#
|
19
|
-
def initialize
|
20
|
-
super(
|
19
|
+
def initialize query_string, options
|
20
|
+
super(options)
|
21
21
|
|
22
22
|
@source_host = nil
|
23
23
|
@source_path = nil
|
24
|
-
@source_id = $3 if
|
24
|
+
@source_id = $3 if query_string =~ URI_REGEX
|
25
25
|
end
|
26
26
|
|
27
27
|
##
|
@@ -26,15 +26,15 @@ module ::Songle::SongURI
|
|
26
26
|
##
|
27
27
|
# @constructor
|
28
28
|
#
|
29
|
-
def initialize
|
30
|
-
super(
|
29
|
+
def initialize query_string, options
|
30
|
+
super(options)
|
31
31
|
|
32
32
|
@source_host = SOURCE_HOST
|
33
33
|
@source_path = SOURCE_PATH
|
34
|
-
@source_id = $1 if
|
34
|
+
@source_id = $1 if query_string =~ URI_REGEX
|
35
35
|
|
36
36
|
if @source_id.nil? || @source_id.strip.empty?
|
37
|
-
raise ::Songle::SongURI::InvalidSongURIError.new(
|
37
|
+
raise ::Songle::SongURI::InvalidSongURIError.new(query_string)
|
38
38
|
end
|
39
39
|
|
40
40
|
@source_path += @source_id
|
@@ -26,15 +26,15 @@ module ::Songle::SongURI
|
|
26
26
|
##
|
27
27
|
# @constructor
|
28
28
|
#
|
29
|
-
def initialize
|
30
|
-
super(
|
29
|
+
def initialize query_string, options
|
30
|
+
super(options)
|
31
31
|
|
32
32
|
@source_host = SOURCE_HOST
|
33
|
-
@source_path = $1 if
|
34
|
-
@source_id = $2 if
|
33
|
+
@source_path = $1 if query_string =~ URI_REGEX
|
34
|
+
@source_id = $2 if query_string =~ URI_REGEX
|
35
35
|
|
36
36
|
if @source_id.nil? || @source_id.strip.empty?
|
37
|
-
raise ::Songle::SongURI::InvalidSongURIError.new(
|
37
|
+
raise ::Songle::SongURI::InvalidSongURIError.new(query_string)
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
@@ -26,15 +26,15 @@ module ::Songle::SongURI
|
|
26
26
|
##
|
27
27
|
# @constructor
|
28
28
|
#
|
29
|
-
def initialize
|
30
|
-
super(
|
29
|
+
def initialize query_string, options
|
30
|
+
super(options)
|
31
31
|
|
32
32
|
@source_host = SOURCE_HOST
|
33
33
|
@source_path = SOURCE_PATH
|
34
|
-
@source_id = $1 if
|
34
|
+
@source_id = $1 if query_string =~ URI_REGEX
|
35
35
|
|
36
36
|
if @source_id.nil? || @source_id.strip.empty?
|
37
|
-
raise ::Songle::SongURI::InvalidSongURIError.new(
|
37
|
+
raise ::Songle::SongURI::InvalidSongURIError.new(query_string)
|
38
38
|
end
|
39
39
|
|
40
40
|
@source_path += @source_id
|
@@ -26,15 +26,15 @@ module ::Songle::SongURI
|
|
26
26
|
##
|
27
27
|
# @constructor
|
28
28
|
#
|
29
|
-
def initialize
|
30
|
-
super(
|
29
|
+
def initialize query_string, options
|
30
|
+
super(options)
|
31
31
|
|
32
32
|
@source_host = SOURCE_HOST
|
33
33
|
@source_path = SOURCE_PATH
|
34
|
-
@source_id = $1 if
|
34
|
+
@source_id = $1 if query_string =~ URI_REGEX
|
35
35
|
|
36
36
|
if @source_id.nil? || @source_id.strip.empty?
|
37
|
-
raise ::Songle::SongURI::InvalidSongURIError.new(
|
37
|
+
raise ::Songle::SongURI::InvalidSongURIError.new(query_string)
|
38
38
|
end
|
39
39
|
|
40
40
|
@source_path += @source_id
|
@@ -26,15 +26,15 @@ module ::Songle::SongURI
|
|
26
26
|
##
|
27
27
|
# @constructor
|
28
28
|
#
|
29
|
-
def initialize
|
30
|
-
super(
|
29
|
+
def initialize query_string, options
|
30
|
+
super(options)
|
31
31
|
|
32
32
|
@source_host = SOURCE_HOST
|
33
|
-
@source_path = $1 if
|
34
|
-
@source_id = $2 if
|
33
|
+
@source_path = $1 if query_string =~ URI_REGEX
|
34
|
+
@source_id = $2 if query_string =~ URI_REGEX
|
35
35
|
|
36
36
|
if @source_id.nil? || @source_id.strip.empty?
|
37
|
-
raise ::Songle::SongURI::InvalidSongURIError.new(
|
37
|
+
raise ::Songle::SongURI::InvalidSongURIError.new(query_string)
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: songle-song-uri-parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takahiro INOUE
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-01-
|
11
|
+
date: 2019-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -70,6 +70,7 @@ files:
|
|
70
70
|
- README.md
|
71
71
|
- Rakefile
|
72
72
|
- lib/songle-song-uri-parser.rb
|
73
|
+
- lib/songle-song-uri-parser/version.rb
|
73
74
|
- lib/songle/song_uri.rb
|
74
75
|
- lib/songle/song_uri/invalid_song_uri_error.rb
|
75
76
|
- lib/songle/song_uri/mp3_song_uri.rb
|