zelda 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,14 @@
1
+ ## 1.2.1 (Aug 24, 2011)
2
+
3
+ Bugfixes:
4
+
5
+ - Fixed a serious bug with successive object initialization
6
+
7
+ Features:
8
+
9
+ - Useful to_s for every object
10
+
11
+
1
12
  ## 1.2.0 (Aug 15, 2011)
2
13
 
3
14
  Bugfixes:
@@ -6,5 +6,9 @@ module Zelda
6
6
  attrs ? new(attrs) : nil
7
7
  end
8
8
  end
9
+
10
+ def to_s
11
+ "#{titel} #{start_tijd}-#{eind_tijd} (pepeid #{pepeid})"
12
+ end
9
13
  end
10
14
  end
@@ -3,9 +3,11 @@ module Zelda
3
3
  # Every key in the hash is turned into a method, returning the value.
4
4
  class Base
5
5
  def initialize(attributes={})
6
- attributes.each_pair do |key, value|
6
+ @attributes = attributes
7
+
8
+ @attributes.each_pair do |key, value|
7
9
  self.class.send(:define_method, key) do
8
- value
10
+ @attributes[key]
9
11
  end
10
12
  end
11
13
  end
@@ -13,6 +13,10 @@ module Zelda
13
13
  end
14
14
  end
15
15
 
16
+ def to_s
17
+ name
18
+ end
19
+
16
20
  # Return all Series for this Omroep.
17
21
  def series
18
22
  Zelda::Request.get("omroepen/#{slug}/series")['omroep']['series']['serie'].map do |attrs|
@@ -30,6 +30,10 @@ module Zelda
30
30
  series
31
31
  end
32
32
  end
33
+
34
+ def to_s
35
+ "#{titel} (serieid #{serie_id_nebo})"
36
+ end
33
37
 
34
38
  def afleveringen(van=nil, tot=nil)
35
39
  get_afleveringen(:van => van, :tot => tot)
@@ -1,3 +1,3 @@
1
1
  module Zelda
2
- VERSION = "1.2.0"
2
+ VERSION = "1.2.1"
3
3
  end
@@ -13,6 +13,10 @@ module Zelda
13
13
  end
14
14
  end
15
15
 
16
+ def to_s
17
+ name
18
+ end
19
+
16
20
  # Return all Series for this Zender.
17
21
  def series
18
22
  Zelda::Request.get("zenders/#{id}/series")['zender']['series']['serie'].map do |attrs|
@@ -25,6 +29,6 @@ module Zelda
25
29
  Zelda::Request.get("zenders/#{id}/current_series")['zender']['series']['serie'].map do |attrs|
26
30
  Zelda::Serie.new(attrs)
27
31
  end
28
- end
32
+ end
29
33
  end
30
34
  end
@@ -10,4 +10,13 @@ shared_examples_for "a zelda base model" do
10
10
  it "should not respond to attributes not set in the constructor" do
11
11
  lambda { subject.no_not_here_nope }.should raise_error(NoMethodError)
12
12
  end
13
+
14
+ it "allows successive initialization" do
15
+ list = []
16
+ list << described_class.new(:foo => 'bar')
17
+ list << described_class.new(:foo => 'baz')
18
+
19
+ list[0].foo.should eq('bar')
20
+ list[1].foo.should eq('baz')
21
+ end
13
22
  end
@@ -6,7 +6,12 @@ describe Zelda::Aflevering do
6
6
 
7
7
  it "should accept attributes when being initialized" do
8
8
  Zelda::Aflevering.new(:foo => "bar").should be_a(Zelda::Aflevering)
9
- end
9
+ end
10
+
11
+ it "has a useful to_s" do
12
+ a = Zelda::Aflevering.new(:titel => "Pippi", :start_tijd => 'start', :eind_tijd => 'eind', :pepeid => 219660617)
13
+ a.to_s.should eq("Pippi start-eind (pepeid 219660617)")
14
+ end
10
15
 
11
16
  it "should find an aflevering in Zelda correctly" do
12
17
  afl_attrs = { "aflevering" => {"afleveringid" => "POW_00243538", "name" => "3 op reis"} }
@@ -2,6 +2,11 @@ require 'spec_helper'
2
2
 
3
3
  describe Zelda::Omroep do
4
4
  it_should_behave_like 'a zelda base model'
5
+
6
+ it "has a useful to_s" do
7
+ omroep = Zelda::Omroep.new :name => 'TROS'
8
+ omroep.to_s.should eq('TROS')
9
+ end
5
10
 
6
11
  describe "when retrieving a list of omroepen" do
7
12
  it "should call Zelda with the correct url" do
@@ -2,6 +2,11 @@ require 'spec_helper'
2
2
 
3
3
  describe Zelda::Serie do
4
4
  it_should_behave_like 'a zelda base model'
5
+
6
+ it "has a useful to_s" do
7
+ serie = Zelda::Serie.new :titel => 'Abi', :serie_id_nebo => 6305
8
+ serie.to_s.should eq("Abi (serieid 6305)")
9
+ end
5
10
 
6
11
  describe "current series" do
7
12
  it "calls Zelda with the correct url" do
@@ -2,6 +2,11 @@ require 'spec_helper'
2
2
 
3
3
  describe Zelda::Zender do
4
4
  it_should_behave_like 'a zelda base model'
5
+
6
+ it "has a useful to_s" do
7
+ zender = Zelda::Zender.new :name => "Nederland 1"
8
+ zender.to_s.should eq('Nederland 1')
9
+ end
5
10
 
6
11
  describe "when retrieving a list of zenders" do
7
12
  it "should call Zelda with the correct url" do
metadata CHANGED
@@ -1,39 +1,34 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: zelda
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.2.1
4
5
  prerelease:
5
- version: 1.2.0
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Joost Baaij
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2011-08-15 00:00:00 +02:00
14
- default_executable:
15
- dependencies:
16
- - !ruby/object:Gem::Dependency
12
+ date: 2011-08-24 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
17
15
  name: httparty
18
- prerelease: false
19
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &2164269260 !ruby/object:Gem::Requirement
20
17
  none: false
21
- requirements:
22
- - - ">="
23
- - !ruby/object:Gem::Version
24
- version: "0"
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
25
22
  type: :runtime
26
- version_requirements: *id001
23
+ prerelease: false
24
+ version_requirements: *2164269260
27
25
  description: If you don't know what this is, you probably don't need it
28
- email:
26
+ email:
29
27
  - joost@spacebabies.nl
30
28
  executables: []
31
-
32
29
  extensions: []
33
-
34
30
  extra_rdoc_files: []
35
-
36
- files:
31
+ files:
37
32
  - .gitignore
38
33
  - .rspec
39
34
  - CHANGELOG.md
@@ -59,35 +54,31 @@ files:
59
54
  - spec/zelda/serie_spec.rb
60
55
  - spec/zelda/zender_spec.rb
61
56
  - zelda.gemspec
62
- has_rdoc: true
63
57
  homepage: https://github.com/tilsammans/zelda
64
58
  licenses: []
65
-
66
59
  post_install_message:
67
60
  rdoc_options: []
68
-
69
- require_paths:
61
+ require_paths:
70
62
  - lib
71
- required_ruby_version: !ruby/object:Gem::Requirement
63
+ required_ruby_version: !ruby/object:Gem::Requirement
72
64
  none: false
73
- requirements:
74
- - - ">="
75
- - !ruby/object:Gem::Version
76
- version: "0"
77
- required_rubygems_version: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ! '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ required_rubygems_version: !ruby/object:Gem::Requirement
78
70
  none: false
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: "0"
71
+ requirements:
72
+ - - ! '>='
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
83
75
  requirements: []
84
-
85
76
  rubyforge_project: zelda
86
- rubygems_version: 1.6.2
77
+ rubygems_version: 1.8.6
87
78
  signing_key:
88
79
  specification_version: 3
89
80
  summary: If you don't know what this is, you probably don't need it
90
- test_files:
81
+ test_files:
91
82
  - spec/spec.opts
92
83
  - spec/spec_helper.rb
93
84
  - spec/support/shared_examples.rb