songle-song-uri-parser 1.0.0 → 1.1.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e56cc4ca2df8bd3dcea18a2822627b9dc30561eca2c75d32e88b8c54033f7f0f
4
- data.tar.gz: e3ade3da897f495a3c021e9b96fdd0203fad7fc872123fc12c237631df29e6ff
3
+ metadata.gz: 51439885a41518b7959c19cae4bc9c32cd9efe73e29418210350edaee6c7d400
4
+ data.tar.gz: 53fa81ee144ca6e51dee68c8d10aade917b678879ef0cc79b05f14e35ab3209e
5
5
  SHA512:
6
- metadata.gz: d8eae1681c74a6b82402ec2434c1fcc0d3f56058a1ea77895409199ddcf596ca4ba6b743f9350435d68308824339a26c441738e06dbdba1e7ab6e81a71167e68
7
- data.tar.gz: c6a5a1cae2bab2731862a8b9558f8339bd43c24cf914528b77fc1efaa11f2c3b1e72d02fde12149aa93614f3b7fb912c25c3d892f3f68cd7344f2f6773fad4d8
6
+ metadata.gz: f86b90bc2139f1820b0cb23b463416b1a675ea1c1c3b46f3714557d5f62cf3deb82a9fd770b05797a3904161bacf3df39aac86414f458873a407a96966a8df32
7
+ data.tar.gz: 2928cb4c48b0b06c6eb1112e835598452302b8ad540324532fbf7c481a569fe7837dbc9a0ec39735af7cb78c63d939b84d396f067e434825f7fbd8becf85ba84
data/CHANGELOG.md CHANGED
@@ -1,4 +1,8 @@
1
1
  # CHANGELOG.md
2
2
 
3
+ ## v1.1.0 (2019-01-25)
4
+ - Changed return value of `Songle::SongURI#type` method (e.g. from "yt" to "youtube")
5
+ - Supported to the numeric format (e.g. "https://songle.jp/songs/12345")
6
+
3
7
  ## v1.0.0 (2019-01-09)
4
8
  - Initial public release
data/Dockerfile CHANGED
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
- ARG RUBY_VERSION=2.6
2
+ ARG RUBY_VERSION=2.6.0
3
3
 
4
- FROM ruby:${RUBY_VERSION}.0-alpine
4
+ FROM ruby:${RUBY_VERSION}-alpine
5
5
  MAINTAINER Takahiro INOUE <takahiro.inoue@aist.go.jp>
6
6
 
7
7
  WORKDIR /work
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- songle-song-uri-parser (1.0.0)
4
+ songle-song-uri-parser (1.1.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -40,14 +40,14 @@ module ::Songle::SongURI
40
40
  end
41
41
 
42
42
  ##
43
- # @function
43
+ # @method
44
44
  #
45
45
  def type
46
46
  return TYPE
47
47
  end
48
48
 
49
49
  ##
50
- # @function
50
+ # @method
51
51
  #
52
52
  def to_s
53
53
  encoded_source_host =
@@ -41,7 +41,7 @@ module ::Songle::SongURI
41
41
  end
42
42
 
43
43
  ##
44
- # @function
44
+ # @method
45
45
  #
46
46
  def type
47
47
  return TYPE
@@ -41,7 +41,7 @@ module ::Songle::SongURI
41
41
  end
42
42
 
43
43
  ##
44
- # @function
44
+ # @method
45
45
  #
46
46
  def type
47
47
  return TYPE
@@ -16,7 +16,7 @@ module ::Songle::SongURI
16
16
  ##
17
17
  # @constant
18
18
  #
19
- TYPE = "nn"
19
+ TYPE = "niconico"
20
20
 
21
21
  ##
22
22
  # @constant
@@ -39,7 +39,7 @@ module ::Songle::SongURI
39
39
  end
40
40
 
41
41
  ##
42
- # @function
42
+ # @method
43
43
  #
44
44
  def type
45
45
  return TYPE
@@ -0,0 +1,41 @@
1
+ # -*- coding: utf-8 -*-
2
+ module ::Songle::SongURI
3
+ class NumericSongURI
4
+ include ::Songle::SongURI
5
+
6
+ ##
7
+ # @constant
8
+ #
9
+ TYPE = "numeric"
10
+
11
+ ##
12
+ # @constant
13
+ #
14
+ URI_REGEX = /^(|\/\/[\w.]+\/[\w.]+\/|http(|s):\/\/[\w.]+\/[\w.]+\/)(\d+)$/
15
+
16
+ ##
17
+ # @constructor
18
+ #
19
+ def initialize string, options
20
+ super(string, options)
21
+
22
+ @source_host = nil
23
+ @source_path = nil
24
+ @source_id = $3 if string =~ URI_REGEX
25
+ end
26
+
27
+ ##
28
+ # @method
29
+ #
30
+ def type
31
+ return TYPE
32
+ end
33
+
34
+ ##
35
+ # @method
36
+ #
37
+ def to_s
38
+ return "#{ self.endpoint }#{ @source_id }"
39
+ end
40
+ end
41
+ end
@@ -41,7 +41,7 @@ module ::Songle::SongURI
41
41
  end
42
42
 
43
43
  ##
44
- # @function
44
+ # @method
45
45
  #
46
46
  def type
47
47
  return TYPE
@@ -16,7 +16,7 @@ module ::Songle::SongURI
16
16
  ##
17
17
  # @constant
18
18
  #
19
- TYPE = "sc"
19
+ TYPE = "soundcloud"
20
20
 
21
21
  ##
22
22
  # @constant
@@ -39,7 +39,7 @@ module ::Songle::SongURI
39
39
  end
40
40
 
41
41
  ##
42
- # @function
42
+ # @method
43
43
  #
44
44
  def type
45
45
  return TYPE
@@ -41,7 +41,7 @@ module ::Songle::SongURI
41
41
  end
42
42
 
43
43
  ##
44
- # @function
44
+ # @method
45
45
  #
46
46
  def type
47
47
  return TYPE
@@ -41,7 +41,7 @@ module ::Songle::SongURI
41
41
  end
42
42
 
43
43
  ##
44
- # @function
44
+ # @method
45
45
  #
46
46
  def type
47
47
  return TYPE
@@ -16,7 +16,7 @@ module ::Songle::SongURI
16
16
  ##
17
17
  # @constant
18
18
  #
19
- TYPE = "yt"
19
+ TYPE = "youtube"
20
20
 
21
21
  ##
22
22
  # @constant
@@ -39,7 +39,7 @@ module ::Songle::SongURI
39
39
  end
40
40
 
41
41
  ##
42
- # @function
42
+ # @method
43
43
  #
44
44
  def type
45
45
  return TYPE
@@ -40,28 +40,28 @@ module ::Songle
40
40
  end
41
41
 
42
42
  ##
43
- # @function
43
+ # @method
44
44
  #
45
45
  def endpoint
46
46
  return "#{ self.endpoint_scheme }://#{ self.endpoint_host }#{ self.endpoint_path }"
47
47
  end
48
48
 
49
49
  ##
50
- # @function
50
+ # @method
51
51
  #
52
52
  def permalink
53
53
  return "http://#{ self.source_host }#{ self.source_path }"
54
54
  end
55
55
 
56
56
  ##
57
- # @function
57
+ # @method
58
58
  #
59
59
  def type
60
60
  return nil
61
61
  end
62
62
 
63
63
  ##
64
- # @function
64
+ # @method
65
65
  #
66
66
  def to_s
67
67
  encoded_source_host =
@@ -75,12 +75,12 @@ module ::Songle
75
75
 
76
76
  class << self
77
77
  ##
78
- # @function
78
+ # @method
79
79
  # @static
80
80
  #
81
81
  def parse string, options = nil
82
82
  string =
83
- ::URI.decode_www_form_component(string)
83
+ ::URI.decode_www_form_component(string.to_s)
84
84
 
85
85
  case
86
86
  when string =~ ::Songle::SongURI::NnSongURI::URI_REGEX
@@ -99,6 +99,8 @@ module ::Songle
99
99
  return ::Songle::SongURI::YtSchemeSongURI.new(string, options)
100
100
  when string =~ ::Songle::SongURI::YtShortSongURI::URI_REGEX
101
101
  return ::Songle::SongURI::YtShortSongURI.new(string, options)
102
+ when string =~ ::Songle::SongURI::NumericSongURI::URI_REGEX
103
+ return ::Songle::SongURI::NumericSongURI.new(string, options)
102
104
  else
103
105
  return ::Songle::SongURI::Mp3SongURI.new(string, options)
104
106
  end
@@ -1,6 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  require "songle/song_uri"
3
3
  require "songle/song_uri/mp3_song_uri"
4
+ require "songle/song_uri/numeric_song_uri"
4
5
  require "songle/song_uri/nn_song_uri"
5
6
  require "songle/song_uri/nn_scheme_song_uri"
6
7
  require "songle/song_uri/nn_short_song_uri"
@@ -12,5 +13,5 @@ require "songle/song_uri/yt_short_song_uri"
12
13
  require "songle/song_uri/invalid_song_uri_error"
13
14
 
14
15
  module ::SongleSongURIParser
15
- VERSION = "1.0.0"
16
+ VERSION = "1.1.0"
16
17
  end
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.0.0
4
+ version: 1.1.0
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-09 00:00:00.000000000 Z
11
+ date: 2019-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -60,7 +60,6 @@ extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
62
  - ".gitignore"
63
- - ".gitlab-ci.yml"
64
63
  - ".rspec"
65
64
  - ".ruby-version"
66
65
  - CHANGELOG.md
@@ -77,6 +76,7 @@ files:
77
76
  - lib/songle/song_uri/nn_scheme_song_uri.rb
78
77
  - lib/songle/song_uri/nn_short_song_uri.rb
79
78
  - lib/songle/song_uri/nn_song_uri.rb
79
+ - lib/songle/song_uri/numeric_song_uri.rb
80
80
  - lib/songle/song_uri/sc_scheme_song_uri.rb
81
81
  - lib/songle/song_uri/sc_song_uri.rb
82
82
  - lib/songle/song_uri/yt_scheme_song_uri.rb
data/.gitlab-ci.yml DELETED
@@ -1,24 +0,0 @@
1
- ####
2
- ## @see http://docs.gitlab.com/ce/ci/yaml/README.html
3
- ####
4
- image: docker:git
5
-
6
- stages:
7
- - build_and_test
8
-
9
- variables:
10
- APP_ENV: develop
11
- IMAGE_PATH: ${CI_REGISTRY}/${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}
12
-
13
- build_and_test:
14
- stage: build_and_test
15
- script:
16
- - docker build --build-arg RUBY_VERSION=2.3 -t ${IMAGE_PATH}:${APP_ENV} .
17
- - docker run ${IMAGE_PATH}:${APP_ENV}
18
- - docker build --build-arg RUBY_VERSION=2.4 -t ${IMAGE_PATH}:${APP_ENV} .
19
- - docker run ${IMAGE_PATH}:${APP_ENV}
20
- - docker build --build-arg RUBY_VERSION=2.5 -t ${IMAGE_PATH}:${APP_ENV} .
21
- - docker run ${IMAGE_PATH}:${APP_ENV}
22
- - docker build --build-arg RUBY_VERSION=2.6 -t ${IMAGE_PATH}:${APP_ENV} .
23
- - docker run ${IMAGE_PATH}:${APP_ENV}
24
- environment: ${APP_ENV}