zelda 0.1.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -2
- data/.rspec +2 -0
- data/CHANGELOG.md +55 -0
- data/Gemfile +3 -1
- data/Gemfile.lock +29 -0
- data/README.rdoc +16 -1
- data/Rakefile +6 -0
- data/lib/zelda/omroep.rb +8 -0
- data/lib/zelda/serie.rb +9 -1
- data/lib/zelda/version.rb +1 -1
- data/lib/zelda/zender.rb +14 -0
- data/spec/spec_helper.rb +6 -13
- data/spec/support/zelda.rb +1 -0
- data/spec/zelda/aflevering_spec.rb +1 -1
- data/spec/zelda/omroep_spec.rb +23 -2
- data/spec/zelda/request_spec.rb +1 -1
- data/spec/zelda/serie_spec.rb +14 -1
- data/spec/zelda/zender_spec.rb +43 -1
- data/zelda.gemspec +2 -0
- metadata +18 -5
- data/spec/zelda_spec.rb +0 -4
data/.gitignore
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
.rvmrc
|
2
|
+
*.gem
|
data/.rspec
ADDED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
## 1.0.0 (Aug 11, 2011)
|
2
|
+
|
3
|
+
Features:
|
4
|
+
|
5
|
+
- Added Zender - Series resource
|
6
|
+
- Added Zender - Current series resource
|
7
|
+
- Added Omroep - Current series resource
|
8
|
+
|
9
|
+
## 0.1.0 (Aug 11, 2011)
|
10
|
+
|
11
|
+
Bugfixes:
|
12
|
+
|
13
|
+
- Massive cruft extermination
|
14
|
+
- Added httparty as a gem dependency
|
15
|
+
|
16
|
+
Features:
|
17
|
+
|
18
|
+
- Use Bundler for development
|
19
|
+
- Use RSpec for development
|
20
|
+
|
21
|
+
## 0.0.9 (unreleased)
|
22
|
+
|
23
|
+
Bugfixes:
|
24
|
+
|
25
|
+
- Serie now uses nebo id
|
26
|
+
|
27
|
+
## 0.0.8 (Oct 7, 2009)
|
28
|
+
|
29
|
+
Bugfixes:
|
30
|
+
|
31
|
+
- Serie.all and Serie.search now return arrays
|
32
|
+
|
33
|
+
## 0.0.4 (Sep 1, 2009)
|
34
|
+
|
35
|
+
Features:
|
36
|
+
|
37
|
+
- Added Omroep
|
38
|
+
- Move shared logic to abstract base class
|
39
|
+
|
40
|
+
## 0.0.2 (Aug 26, 2009)
|
41
|
+
|
42
|
+
Bugfixes:
|
43
|
+
|
44
|
+
- Gives proper warning when API_KEY is missing
|
45
|
+
|
46
|
+
Features:
|
47
|
+
|
48
|
+
- First gem release
|
49
|
+
- Added aflevering
|
50
|
+
|
51
|
+
## 0.0.0 (Aug 12, 2009)
|
52
|
+
|
53
|
+
Features:
|
54
|
+
|
55
|
+
- Initial version
|
data/Gemfile
CHANGED
data/Gemfile.lock
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
zelda (0.1.0)
|
5
|
+
httparty
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: http://rubygems.org/
|
9
|
+
specs:
|
10
|
+
crack (0.1.8)
|
11
|
+
diff-lcs (1.1.2)
|
12
|
+
httparty (0.7.8)
|
13
|
+
crack (= 0.1.8)
|
14
|
+
rspec (2.6.0)
|
15
|
+
rspec-core (~> 2.6.0)
|
16
|
+
rspec-expectations (~> 2.6.0)
|
17
|
+
rspec-mocks (~> 2.6.0)
|
18
|
+
rspec-core (2.6.4)
|
19
|
+
rspec-expectations (2.6.0)
|
20
|
+
diff-lcs (~> 1.1.2)
|
21
|
+
rspec-mocks (2.6.0)
|
22
|
+
|
23
|
+
PLATFORMS
|
24
|
+
ruby
|
25
|
+
|
26
|
+
DEPENDENCIES
|
27
|
+
httparty
|
28
|
+
rspec
|
29
|
+
zelda!
|
data/README.rdoc
CHANGED
@@ -22,4 +22,19 @@ In Gemfile:
|
|
22
22
|
|
23
23
|
Create <tt>config/initializers/zelda.rb</tt>:
|
24
24
|
|
25
|
-
Zelda::API_KEY = 'deadbeef'
|
25
|
+
Zelda::API_KEY = 'deadbeef'
|
26
|
+
|
27
|
+
|
28
|
+
== DEVELOPMENT
|
29
|
+
|
30
|
+
I am running the specs using RSpec 2. Use <tt>bundle install</tt> to get
|
31
|
+
everything you need.
|
32
|
+
|
33
|
+
* fork the project in github
|
34
|
+
* clone your repo
|
35
|
+
* create a branch
|
36
|
+
* bundle install
|
37
|
+
* hack away, commit early and often
|
38
|
+
* run the specs with "rake"
|
39
|
+
* push your branch to your fork
|
40
|
+
* send a pull request
|
data/Rakefile
CHANGED
data/lib/zelda/omroep.rb
CHANGED
@@ -11,10 +11,18 @@ module Zelda
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
+
# Return all Series for this Omroep.
|
14
15
|
def series
|
15
16
|
Zelda::Request.get("omroepen/#{slug}/series")['omroep']['series']['serie'].map do |attrs|
|
16
17
|
Zelda::Serie.new(attrs)
|
17
18
|
end
|
18
19
|
end
|
20
|
+
|
21
|
+
# Return Series for this Omroep that have broadcasts in the future.
|
22
|
+
def current_series
|
23
|
+
Zelda::Request.get("omroepen/#{slug}/current_series")['omroep']['series']['serie'].map do |attrs|
|
24
|
+
Zelda::Serie.new(attrs)
|
25
|
+
end
|
26
|
+
end
|
19
27
|
end
|
20
28
|
end
|
data/lib/zelda/serie.rb
CHANGED
@@ -10,7 +10,7 @@ module Zelda
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def find(id)
|
13
|
-
attrs = Request.get("series/#{
|
13
|
+
attrs = Request.get("series/#{id}")['serie'] rescue nil
|
14
14
|
attrs ? new(attrs) : nil
|
15
15
|
end
|
16
16
|
|
@@ -21,6 +21,14 @@ module Zelda
|
|
21
21
|
end
|
22
22
|
series
|
23
23
|
end
|
24
|
+
|
25
|
+
def current
|
26
|
+
series = []
|
27
|
+
Request.get("current_series")['series'].each do |attrs|
|
28
|
+
series << Serie.new(attrs)
|
29
|
+
end
|
30
|
+
series
|
31
|
+
end
|
24
32
|
end
|
25
33
|
|
26
34
|
def afleveringen(van=nil, tot=nil)
|
data/lib/zelda/version.rb
CHANGED
data/lib/zelda/zender.rb
CHANGED
@@ -18,5 +18,19 @@ module Zelda
|
|
18
18
|
def code
|
19
19
|
@attrs["zender"]["code"]
|
20
20
|
end
|
21
|
+
|
22
|
+
# Return all Series for this Zender.
|
23
|
+
def series
|
24
|
+
Zelda::Request.get("zenders/#{id}/series")['zender']['series']['serie'].map do |attrs|
|
25
|
+
Zelda::Serie.new(attrs)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
# Return Series for this Zender that have broadcasts in the future.
|
30
|
+
def current_series
|
31
|
+
Zelda::Request.get("zenders/#{id}/current_series")['zender']['series']['serie'].map do |attrs|
|
32
|
+
Zelda::Serie.new(attrs)
|
33
|
+
end
|
34
|
+
end
|
21
35
|
end
|
22
36
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,19 +1,12 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
rescue LoadError
|
4
|
-
require 'rubygems' unless ENV['NO_RUBYGEMS']
|
5
|
-
gem 'rspec'
|
6
|
-
require 'spec'
|
7
|
-
end
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler/setup'
|
8
3
|
|
9
|
-
|
4
|
+
require 'zelda'
|
10
5
|
|
11
6
|
# Requires supporting files with custom matchers and macros, etc,
|
12
7
|
# in ./support/ and its subdirectories.
|
13
8
|
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
14
9
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
API_KEY = '12345' unless defined?(API_KEY)
|
19
|
-
end
|
10
|
+
RSpec.configure do |config|
|
11
|
+
# some (optional) config here
|
12
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
Zelda::API_KEY = '12345'
|
data/spec/zelda/omroep_spec.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Zelda::Omroep do
|
4
4
|
before do
|
@@ -47,7 +47,7 @@ describe Zelda::Omroep do
|
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
50
|
-
describe "
|
50
|
+
describe "series" do
|
51
51
|
before(:each) do
|
52
52
|
@omroep = Zelda::Omroep.new('slug' => 'kro')
|
53
53
|
|
@@ -67,4 +67,25 @@ describe Zelda::Omroep do
|
|
67
67
|
find_series.first.should be_a(Zelda::Serie)
|
68
68
|
end
|
69
69
|
end
|
70
|
+
|
71
|
+
describe "current series" do
|
72
|
+
before(:each) do
|
73
|
+
@omroep = Zelda::Omroep.new('slug' => 'kro')
|
74
|
+
|
75
|
+
Zelda::Request.stub!(:get).and_return('omroep' => {'series' => {'serie' => [{'foo' => 'bar'}]}})
|
76
|
+
end
|
77
|
+
|
78
|
+
def find_series
|
79
|
+
@omroep.current_series
|
80
|
+
end
|
81
|
+
|
82
|
+
it "should call Zelda with the correct url" do
|
83
|
+
Zelda::Request.should_receive(:get).with("omroepen/kro/current_series")
|
84
|
+
find_series
|
85
|
+
end
|
86
|
+
|
87
|
+
it "should return an array of series" do
|
88
|
+
find_series.first.should be_a(Zelda::Serie)
|
89
|
+
end
|
90
|
+
end
|
70
91
|
end
|
data/spec/zelda/request_spec.rb
CHANGED
data/spec/zelda/serie_spec.rb
CHANGED
@@ -1,6 +1,19 @@
|
|
1
|
-
require
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Zelda::Serie do
|
4
|
+
describe "current series" do
|
5
|
+
it "calls Zelda with the correct url" do
|
6
|
+
Zelda::Request.should_receive(:get).with("current_series").and_return({'series' => ['serie']})
|
7
|
+
Zelda::Serie.stub(:new).and_return('serie')
|
8
|
+
Zelda::Serie.current.should == ['serie']
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should return an array of series" do
|
12
|
+
Zelda::Request.should_receive(:get).with("series").and_return({ 'series' => ['serie'] })
|
13
|
+
Zelda::Serie.all.first.should be_a(Zelda::Serie)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
4
17
|
describe "when retrieving a list of series" do
|
5
18
|
it "should call Zelda with the correct url" do
|
6
19
|
Zelda::Request.should_receive(:get).with("series").and_return({ 'series' => ['serie'] })
|
data/spec/zelda/zender_spec.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Zelda::Zender do
|
4
4
|
describe "when retrieving a list of zenders" do
|
@@ -36,4 +36,46 @@ describe Zelda::Zender do
|
|
36
36
|
find_zender.name.should == "Nederland 1"
|
37
37
|
end
|
38
38
|
end
|
39
|
+
|
40
|
+
describe "series" do
|
41
|
+
before(:each) do
|
42
|
+
@zender = Zelda::Zender.new('id' => '1')
|
43
|
+
|
44
|
+
Zelda::Request.stub!(:get).and_return('zender' => {'series' => {'serie' => [{'foo' => 'bar'}]}})
|
45
|
+
end
|
46
|
+
|
47
|
+
def find_series
|
48
|
+
@zender.series
|
49
|
+
end
|
50
|
+
|
51
|
+
it "should call Zelda with the correct url" do
|
52
|
+
Zelda::Request.should_receive(:get).with("zenders/1/series")
|
53
|
+
find_series
|
54
|
+
end
|
55
|
+
|
56
|
+
it "should return an array of series" do
|
57
|
+
find_series.first.should be_a(Zelda::Serie)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
describe "current series" do
|
62
|
+
before(:each) do
|
63
|
+
@zender = Zelda::Zender.new('id' => '1')
|
64
|
+
|
65
|
+
Zelda::Request.stub!(:get).and_return('zender' => {'series' => {'serie' => [{'foo' => 'bar'}]}})
|
66
|
+
end
|
67
|
+
|
68
|
+
def find_series
|
69
|
+
@zender.current_series
|
70
|
+
end
|
71
|
+
|
72
|
+
it "should call Zelda with the correct url" do
|
73
|
+
Zelda::Request.should_receive(:get).with("zenders/1/current_series")
|
74
|
+
find_series
|
75
|
+
end
|
76
|
+
|
77
|
+
it "should return an array of series" do
|
78
|
+
find_series.first.should be_a(Zelda::Serie)
|
79
|
+
end
|
80
|
+
end
|
39
81
|
end
|
data/zelda.gemspec
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: zelda
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version:
|
5
|
+
version: 1.0.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Joost Baaij
|
@@ -12,8 +12,18 @@ cert_chain: []
|
|
12
12
|
|
13
13
|
date: 2011-08-11 00:00:00 +02:00
|
14
14
|
default_executable:
|
15
|
-
dependencies:
|
16
|
-
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: httparty
|
18
|
+
prerelease: false
|
19
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
|
+
none: false
|
21
|
+
requirements:
|
22
|
+
- - ">="
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: "0"
|
25
|
+
type: :runtime
|
26
|
+
version_requirements: *id001
|
17
27
|
description: If you don't know what this is, you probably don't need it
|
18
28
|
email:
|
19
29
|
- joost@spacebabies.nl
|
@@ -25,7 +35,10 @@ extra_rdoc_files: []
|
|
25
35
|
|
26
36
|
files:
|
27
37
|
- .gitignore
|
38
|
+
- .rspec
|
39
|
+
- CHANGELOG.md
|
28
40
|
- Gemfile
|
41
|
+
- Gemfile.lock
|
29
42
|
- README.rdoc
|
30
43
|
- Rakefile
|
31
44
|
- lib/zelda.rb
|
@@ -39,12 +52,12 @@ files:
|
|
39
52
|
- spec/spec.opts
|
40
53
|
- spec/spec_helper.rb
|
41
54
|
- spec/support/shared_examples.rb
|
55
|
+
- spec/support/zelda.rb
|
42
56
|
- spec/zelda/aflevering_spec.rb
|
43
57
|
- spec/zelda/omroep_spec.rb
|
44
58
|
- spec/zelda/request_spec.rb
|
45
59
|
- spec/zelda/serie_spec.rb
|
46
60
|
- spec/zelda/zender_spec.rb
|
47
|
-
- spec/zelda_spec.rb
|
48
61
|
- zelda.gemspec
|
49
62
|
has_rdoc: true
|
50
63
|
homepage: https://github.com/tilsammans/zelda
|
@@ -78,9 +91,9 @@ test_files:
|
|
78
91
|
- spec/spec.opts
|
79
92
|
- spec/spec_helper.rb
|
80
93
|
- spec/support/shared_examples.rb
|
94
|
+
- spec/support/zelda.rb
|
81
95
|
- spec/zelda/aflevering_spec.rb
|
82
96
|
- spec/zelda/omroep_spec.rb
|
83
97
|
- spec/zelda/request_spec.rb
|
84
98
|
- spec/zelda/serie_spec.rb
|
85
99
|
- spec/zelda/zender_spec.rb
|
86
|
-
- spec/zelda_spec.rb
|
data/spec/zelda_spec.rb
DELETED