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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 468c589049232e4268150e999a970d8e812145e3
4
- data.tar.gz: 88775876e1ba25744db70c6ca01fccf970afd1d8
3
+ metadata.gz: da509d2ecbd1b8f6463d2c1e1db4f95e9e0d09c1
4
+ data.tar.gz: 94ee9490691017500833360a877c62feed620434
5
5
  SHA512:
6
- metadata.gz: ea35f1f24febbeec5aa5c4805394058254b03ac211003818cc1ab096b38e2c02ba1df9d61246621cea4f40060961751ca7cd8735289fe440e4871bf56ff47dbc
7
- data.tar.gz: 17189a95674986b03b9eaf1dd6cea57445cdb825612730acd320984324266d2c5a00c417ad18a3de3878e896625710a97ec1af2349b2b7c58ca33b68181c4a3b
6
+ metadata.gz: 3ce6acec4951b522d70b91d3ccaa638f0cc54934dc3d116370e666d7cd2d512b2d461b546f3ec2a894a99c114cc2c62a0df065acd462c5e27c9b0a5b5b8fb6af
7
+ data.tar.gz: 98c9d1b64cf42f209d3743f0e46ff16751faf5508024eb95e6c063f5cb1e0ee2dfdfce1fddb8850004ec97732cf030f3eef507f10103ecd8e2de523a1cf34e56
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- nicoquery (0.1.5)
4
+ nicoquery (0.1.6)
5
5
  activesupport (~> 4.0.0)
6
6
  i18n
7
7
  nicoapi
@@ -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(video_id)
8
- @dynamic_segment = video_id
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 @video_id).get
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 @video_id).get
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(video_id)
61
+ def initialize(video_id_of_thread_id)
62
62
  @source = {}
63
- @video_id = video_id
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
@@ -1,3 +1,3 @@
1
1
  module NicoQuery
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6"
3
3
  end
@@ -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?").
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.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masami Yonehara