nicoquery 0.1.5 → 0.1.6
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/Gemfile.lock +1 -1
- data/lib/nicoquery/api/getthumbinfo.rb +2 -2
- data/lib/nicoquery/object/movie.rb +8 -4
- data/lib/nicoquery/object/mylist.rb +1 -1
- data/lib/nicoquery/version.rb +1 -1
- data/spec/object/movie_spec.rb +16 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: da509d2ecbd1b8f6463d2c1e1db4f95e9e0d09c1
|
4
|
+
data.tar.gz: 94ee9490691017500833360a877c62feed620434
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ce6acec4951b522d70b91d3ccaa638f0cc54934dc3d116370e666d7cd2d512b2d461b546f3ec2a894a99c114cc2c62a0df065acd462c5e27c9b0a5b5b8fb6af
|
7
|
+
data.tar.gz: 98c9d1b64cf42f209d3743f0e46ff16751faf5508024eb95e6c063f5cb1e0ee2dfdfce1fddb8850004ec97732cf030f3eef507f10103ecd8e2de523a1cf34e56
|
data/Gemfile.lock
CHANGED
@@ -4,8 +4,8 @@ require 'nicoquery/api/base'
|
|
4
4
|
module NicoQuery
|
5
5
|
module Api
|
6
6
|
class GetThumbInfo < NicoQuery::Api::Base
|
7
|
-
def initialize(
|
8
|
-
@dynamic_segment =
|
7
|
+
def initialize(video_id_or_thread_id)
|
8
|
+
@dynamic_segment = video_id_or_thread_id.to_s
|
9
9
|
@params_array = []
|
10
10
|
end
|
11
11
|
|
@@ -26,7 +26,7 @@ module NicoQuery
|
|
26
26
|
@source['video_array'].presence ||
|
27
27
|
@source['gethumbinfo'].presence ||
|
28
28
|
Proc.new do
|
29
|
-
source = (NicoQuery::Api::GetThumbInfo.new @
|
29
|
+
source = (NicoQuery::Api::GetThumbInfo.new(@video_id || @thread_id)).get
|
30
30
|
set_getthumbinfo_source(NicoQuery::ObjectMapper::GetThumbInfo.new source)
|
31
31
|
end.call
|
32
32
|
|
@@ -50,7 +50,7 @@ module NicoQuery
|
|
50
50
|
@source['gethumbinfo'].presence ||
|
51
51
|
@source['video_array'].presence ||
|
52
52
|
Proc.new do
|
53
|
-
source = (NicoQuery::Api::GetThumbInfo.new @
|
53
|
+
source = (NicoQuery::Api::GetThumbInfo.new(@video_id || @thread_id)).get
|
54
54
|
set_getthumbinfo_source(NicoQuery::ObjectMapper::GetThumbInfo.new source)
|
55
55
|
end.call
|
56
56
|
|
@@ -58,9 +58,13 @@ module NicoQuery
|
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
|
-
def initialize(
|
61
|
+
def initialize(video_id_of_thread_id)
|
62
62
|
@source = {}
|
63
|
-
|
63
|
+
if video_id_of_thread_id.to_s.match(/sm|nm/)
|
64
|
+
@video_id = video_id_of_thread_id
|
65
|
+
else
|
66
|
+
@thread_id = video_id_of_thread_id
|
67
|
+
end
|
64
68
|
end
|
65
69
|
|
66
70
|
def set_getthumbinfo_source(source_object)
|
@@ -29,7 +29,7 @@ module NicoQuery
|
|
29
29
|
|
30
30
|
return if @hash.items.nil?
|
31
31
|
@hash.items.map do |item|
|
32
|
-
movie = NicoQuery::Object::Movie.new item.video_id
|
32
|
+
movie = NicoQuery::Object::Movie.new item.video_id.presence || item.thread_id
|
33
33
|
movie.set_mylist_rss_source item
|
34
34
|
@movies.push movie
|
35
35
|
end
|
data/lib/nicoquery/version.rb
CHANGED
data/spec/object/movie_spec.rb
CHANGED
@@ -4,7 +4,7 @@ require 'webmock/rspec'
|
|
4
4
|
|
5
5
|
|
6
6
|
describe "NicoQuery::Object::Movie" do
|
7
|
-
context "when specified movie is exist" do
|
7
|
+
context "when specified video id and this movie is exist" do
|
8
8
|
before do
|
9
9
|
# mylist:38369702 はテスト用に作ったマイリスト。以下の動画を含んでいる。
|
10
10
|
# sm9 新・豪血寺一族 -煩悩解放 - レッツゴー!陰陽師
|
@@ -61,6 +61,21 @@ describe "NicoQuery::Object::Movie" do
|
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
64
|
+
context "when specified video id and this movie is exist" do
|
65
|
+
before do
|
66
|
+
# thread_id:1173108780 == video_id:sm9
|
67
|
+
@movie = NicoQuery::Object::Movie.new(1173108780)
|
68
|
+
end
|
69
|
+
|
70
|
+
subject { @movie }
|
71
|
+
|
72
|
+
describe "title" do
|
73
|
+
it "returns string of title" do
|
74
|
+
expect(subject.title).to eq "新・豪血寺一族 -煩悩解放 - レッツゴー!陰陽師"
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
64
79
|
context "when specified movie is deleted" do
|
65
80
|
before do
|
66
81
|
WebMock.stub_request(:get, "http://ext.nicovideo.jp/api/getthumbinfo/sm999999?").
|