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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ca158c44cc72e7049c898420e7ffba6103597f29
4
- data.tar.gz: f3739a64afefb330dc656da817fced37395ab8a8
3
+ metadata.gz: 2e8ba5b6ee6cb9b44697aa2cad2f7b42a59dc1ea
4
+ data.tar.gz: 6f6c7082865a96f531fb749cc053bba3a5d8e763
5
5
  SHA512:
6
- metadata.gz: b1c7a8a6bbc4ad018e3e163894132723e0ec418461c5db246192bc35330a414ee6226d30c5162ce22512526d58e40d56a7eb1c4b9b3c219d93d10bbe049d0e53
7
- data.tar.gz: 1da1f503601a31044202ae2f0e48af28f841cc797d6311f4e2d2f19d7db79ae163c77b8171b05eb1f94bddc5d66412c323d36c21310b753bbf49010a7e22dda3
6
+ metadata.gz: 6ed3ec452d0ec5a0d64bcbc9c8be73fb95a5f49ffcf96d5d0d1f1106a50d5b4e0667293fcae81bc34b3536acda329e6c2d987d9fb0967a59f3b53c8d61881aaf
7
+ data.tar.gz: 04d09af5f0f52624ac30608867ee48d52b2f1e07e8f8651f479f593b011c35f8a56dba8c805ce7f576b657080897a4dc377630ed5f4598ebd1ffc5271775349d
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- nicoquery (0.1.0)
4
+ nicoquery (0.1.1)
5
5
  activesupport (~> 4.0.0)
6
6
  i18n
7
7
  nicoapi
@@ -1,3 +1,3 @@
1
1
  module NicoQuery
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
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(video_id)
17
- NicoQuery::Object::Movie.new video_id
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
@@ -52,49 +52,63 @@ describe "NicoQuery" do
52
52
  end
53
53
 
54
54
  describe "movie" do
55
- before do
56
- # mylist:38369702 はテスト用に作ったマイリスト。以下の動画を含んでいる。
57
- # sm9 新・豪血寺一族 -煩悩解放 - レッツゴー!陰陽師
58
- # sm1097445 【初音ミク】みくみくにしてあげる♪【してやんよ】
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
- subject { @movie }
60
+ subject { @movie }
63
61
 
64
- it "returns NicoQuery::Object::Movie instance" do
65
- expect(subject).to be_an_instance_of NicoQuery::Object::Movie
66
- end
62
+ it "returns NicoQuery::Object::Movie instance" do
63
+ expect(subject).to be_an_instance_of NicoQuery::Object::Movie
64
+ end
67
65
 
68
- describe "title" do
69
- it "returns string of title" do
70
- expect(subject.title).to eq "新・豪血寺一族 -煩悩解放 - レッツゴー!陰陽師"
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
- describe "url" do
75
- it "returns string of url" do
76
- expect(subject.url).to eq "http://www.nicovideo.jp/watch/sm9"
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
- describe "video_id" do
81
- it "returns number of mylist_id" do
82
- expect(subject.video_id).to eq "sm9"
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
- # describe "description" do
87
- # subject { @movie }
88
- # it "returns string of title" do
89
- # # mylistのrssでは、descriptionの全文取得はできず、頭から256文字までしか取得できない。
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
- describe "tags" do
95
- it "returns movie instances" do
96
- expect(@movie.tags).to be_an_instance_of Array
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nicoquery
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masami Yonehara