nicoquery 0.1.0 → 0.1.1
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/version.rb +1 -1
- data/lib/nicoquery.rb +8 -2
- data/spec/nicoquery_spec.rb +45 -32
- 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: 2e8ba5b6ee6cb9b44697aa2cad2f7b42a59dc1ea
|
4
|
+
data.tar.gz: 6f6c7082865a96f531fb749cc053bba3a5d8e763
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ed3ec452d0ec5a0d64bcbc9c8be73fb95a5f49ffcf96d5d0d1f1106a50d5b4e0667293fcae81bc34b3536acda329e6c2d987d9fb0967a59f3b53c8d61881aaf
|
7
|
+
data.tar.gz: 04d09af5f0f52624ac30608867ee48d52b2f1e07e8f8651f479f593b011c35f8a56dba8c805ce7f576b657080897a4dc377630ed5f4598ebd1ffc5271775349d
|
data/Gemfile.lock
CHANGED
data/lib/nicoquery/version.rb
CHANGED
data/lib/nicoquery.rb
CHANGED
@@ -13,8 +13,14 @@ module NicoQuery
|
|
13
13
|
NicoQuery::Object::Mylist.new mylist_id
|
14
14
|
end
|
15
15
|
|
16
|
-
def movie(
|
17
|
-
|
16
|
+
def movie(args)
|
17
|
+
if args.is_a? Array
|
18
|
+
array = []
|
19
|
+
NicoQuery::Crawler::BulkScraping.execute(args) {|movie| array << movie }
|
20
|
+
array
|
21
|
+
else
|
22
|
+
NicoQuery::Object::Movie.new args
|
23
|
+
end
|
18
24
|
end
|
19
25
|
|
20
26
|
module_function :tag_search
|
data/spec/nicoquery_spec.rb
CHANGED
@@ -52,49 +52,63 @@ describe "NicoQuery" do
|
|
52
52
|
end
|
53
53
|
|
54
54
|
describe "movie" do
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
@movie = NicoQuery::Object::Movie.new('sm9')
|
60
|
-
end
|
55
|
+
context "when passed a string of video id to argument" do
|
56
|
+
before do
|
57
|
+
@movie = NicoQuery.movie('sm9')
|
58
|
+
end
|
61
59
|
|
62
|
-
|
60
|
+
subject { @movie }
|
63
61
|
|
64
|
-
|
65
|
-
|
66
|
-
|
62
|
+
it "returns NicoQuery::Object::Movie instance" do
|
63
|
+
expect(subject).to be_an_instance_of NicoQuery::Object::Movie
|
64
|
+
end
|
67
65
|
|
68
|
-
|
69
|
-
|
70
|
-
|
66
|
+
describe "title" do
|
67
|
+
it "returns string of title" do
|
68
|
+
expect(subject.title).to eq "新・豪血寺一族 -煩悩解放 - レッツゴー!陰陽師"
|
69
|
+
end
|
71
70
|
end
|
72
|
-
end
|
73
71
|
|
74
|
-
|
75
|
-
|
76
|
-
|
72
|
+
describe "url" do
|
73
|
+
it "returns string of url" do
|
74
|
+
expect(subject.url).to eq "http://www.nicovideo.jp/watch/sm9"
|
75
|
+
end
|
77
76
|
end
|
78
|
-
end
|
79
77
|
|
80
|
-
|
81
|
-
|
82
|
-
|
78
|
+
describe "video_id" do
|
79
|
+
it "returns number of mylist_id" do
|
80
|
+
expect(subject.video_id).to eq "sm9"
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
# describe "description" do
|
85
|
+
# subject { @movie }
|
86
|
+
# it "returns string of title" do
|
87
|
+
# # mylistのrssでは、descriptionの全文取得はできず、頭から256文字までしか取得できない。
|
88
|
+
# expect(subject.description).to eq "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nam cursus. Morbi ut mi. Nullam enim leo, egestas id, condimentum at, laoreet mattis, massa. Sed eleifend nonummy diam. Praesent mauris ante, elementum et, bibendum at, posuere sit amet, nibh. Duis "
|
89
|
+
# end
|
90
|
+
# end
|
91
|
+
|
92
|
+
describe "tags" do
|
93
|
+
it "returns movie instances" do
|
94
|
+
expect(@movie.tags).to be_an_instance_of Array
|
95
|
+
end
|
83
96
|
end
|
84
97
|
end
|
85
98
|
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
# expect(subject.description).to eq "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nam cursus. Morbi ut mi. Nullam enim leo, egestas id, condimentum at, laoreet mattis, massa. Sed eleifend nonummy diam. Praesent mauris ante, elementum et, bibendum at, posuere sit amet, nibh. Duis "
|
91
|
-
# end
|
92
|
-
# end
|
99
|
+
context "when passed an string array of video id to argument" do
|
100
|
+
before do
|
101
|
+
@movie = NicoQuery.movie(['sm9', 'sm1097445'])
|
102
|
+
end
|
93
103
|
|
94
|
-
|
95
|
-
|
96
|
-
|
104
|
+
subject { @movie }
|
105
|
+
|
106
|
+
it "returns array of NicoQuery::Object::Movie instance" do
|
107
|
+
expect(subject).to be_an_instance_of Array
|
108
|
+
expect(subject[0]).to be_an_instance_of NicoQuery::Object::Movie
|
109
|
+
expect(subject[1]).to be_an_instance_of NicoQuery::Object::Movie
|
97
110
|
end
|
111
|
+
|
98
112
|
end
|
99
113
|
end
|
100
114
|
|
@@ -119,5 +133,4 @@ describe "NicoQuery" do
|
|
119
133
|
expect(subject[0]).to be_an_instance_of NicoQuery::Object::Movie
|
120
134
|
end
|
121
135
|
end
|
122
|
-
|
123
136
|
end
|