Midna 0.8.0 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +2 -0
- data/lib/midna/episode.rb +9 -3
- data/lib/midna/version.rb +1 -1
- data/spec/midna/episode_spec.rb +18 -0
- metadata +2 -3
- data/VERSION +0 -1
data/README.rdoc
CHANGED
@@ -29,9 +29,11 @@ This gem chats with the Midna API so you don't have to. It will give you objects
|
|
29
29
|
# all episodes for the given Series until the given time
|
30
30
|
# start is an integer (unixtime) and defaults to the current time
|
31
31
|
Midna::Episode.series_until(id, start)
|
32
|
+
Midna::Episode.series_until(id, start, :page => 2)
|
32
33
|
# all episodes for the given Series since the given time
|
33
34
|
# start is an integer (unixtime) and defaults to the current time
|
34
35
|
Midna::Episode.series_since(id, start)
|
36
|
+
Midna::Episode.series_since(id, start, :page => 2)
|
35
37
|
|
36
38
|
# code is Channel code
|
37
39
|
Midna::Broadcast.channel(code)
|
data/lib/midna/episode.rb
CHANGED
@@ -18,9 +18,12 @@ class Midna
|
|
18
18
|
|
19
19
|
# Return episodes for a Series until a certain time.
|
20
20
|
# +starttime+ is an integer (unixtime) and defaults to the current time.
|
21
|
-
|
21
|
+
# Pass +page+ in the options hash to fetch a specific page. Requires +starttime+ to be set.
|
22
|
+
def self.series_until(id, starttime=nil, options={})
|
22
23
|
if starttime.nil?
|
23
24
|
Midna.get("/series/#{id}/episodes/until.xml").to_hash["episodes"]
|
25
|
+
elsif options[:page]
|
26
|
+
Midna.get("/series/#{id}/episodes/until.xml?start=#{starttime}&page=#{options[:page]}").to_hash["episodes"]
|
24
27
|
else
|
25
28
|
Midna.get("/series/#{id}/episodes/until.xml?start=#{starttime}").to_hash["episodes"]
|
26
29
|
end
|
@@ -28,9 +31,12 @@ class Midna
|
|
28
31
|
|
29
32
|
# Return episodes for a Series since a certain time.
|
30
33
|
# +starttime+ is an integer (unixtime) and defaults to the current time.
|
31
|
-
|
34
|
+
# Pass +page+ in the options hash to fetch a specific page. Requires +starttime+ to be set.
|
35
|
+
def self.series_since(id, starttime=nil, options={})
|
32
36
|
if starttime.nil?
|
33
37
|
Midna.get("/series/#{id}/episodes/since.xml").to_hash["episodes"]
|
38
|
+
elsif options[:page]
|
39
|
+
Midna.get("/series/#{id}/episodes/since.xml?start=#{starttime}&page=#{options[:page]}").to_hash["episodes"]
|
34
40
|
else
|
35
41
|
Midna.get("/series/#{id}/episodes/since.xml?start=#{starttime}").to_hash["episodes"]
|
36
42
|
end
|
@@ -41,4 +47,4 @@ class Midna
|
|
41
47
|
Midna.get("/series/#{id}/episodes/last.xml").to_hash["episode"]
|
42
48
|
end
|
43
49
|
end
|
44
|
-
end
|
50
|
+
end
|
data/lib/midna/version.rb
CHANGED
data/spec/midna/episode_spec.rb
CHANGED
@@ -50,6 +50,15 @@ describe Midna::Episode do
|
|
50
50
|
Midna::Episode.series_until('400', 123).should equal(hash)
|
51
51
|
end
|
52
52
|
end
|
53
|
+
|
54
|
+
describe 'with only page' do
|
55
|
+
it "should get /series/ID/episodes/until.xml?page=2" do
|
56
|
+
hash = stub
|
57
|
+
Midna.should_receive(:get).with("/series/400/episodes/until.xml?start=123&page=2").and_return(episodes = stub)
|
58
|
+
episodes.stub!(:to_hash).and_return({"episodes" => hash})
|
59
|
+
Midna::Episode.series_until('400', 123, :page => 2).should equal(hash)
|
60
|
+
end
|
61
|
+
end
|
53
62
|
end
|
54
63
|
|
55
64
|
describe 'series_since' do
|
@@ -70,6 +79,15 @@ describe Midna::Episode do
|
|
70
79
|
Midna::Episode.series_since('400', 123).should equal(hash)
|
71
80
|
end
|
72
81
|
end
|
82
|
+
|
83
|
+
describe 'with only page' do
|
84
|
+
it "should get /series/ID/episodes/since.xml?page=2" do
|
85
|
+
hash = stub
|
86
|
+
Midna.should_receive(:get).with("/series/400/episodes/since.xml?start=123&page=2").and_return(episodes = stub)
|
87
|
+
episodes.stub!(:to_hash).and_return({"episodes" => hash})
|
88
|
+
Midna::Episode.series_since('400', 123, :page => 2).should equal(hash)
|
89
|
+
end
|
90
|
+
end
|
73
91
|
|
74
92
|
describe "last" do
|
75
93
|
it "should get /series/ID/episodes/last.xml" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: Midna
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-05
|
12
|
+
date: 2012-06-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: httparty
|
@@ -41,7 +41,6 @@ files:
|
|
41
41
|
- LICENSE
|
42
42
|
- README.rdoc
|
43
43
|
- Rakefile
|
44
|
-
- VERSION
|
45
44
|
- lib/midna.rb
|
46
45
|
- lib/midna/broadcast.rb
|
47
46
|
- lib/midna/broadcaster.rb
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.7.0
|