zelda 1.3.0 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1 @@
1
+ rvm: 1.9.2
@@ -1,3 +1,8 @@
1
+ ## 1.4.0 (Mar 21, 2012)
2
+
3
+ - Raise errors coming from the response
4
+
5
+
1
6
  ## 1.3.0
2
7
 
3
8
  - All strings are now force-encoded to UTF-8
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- zelda (1.2.1)
4
+ zelda (1.3.0)
5
5
  httparty
6
6
 
7
7
  GEM
@@ -6,6 +6,8 @@
6
6
 
7
7
  If you don't know what this is, you probably don't need it :).
8
8
 
9
+ Ruby 1.9.2 or higher is required to use this gem.
10
+
9
11
 
10
12
  == INSTALLATION
11
13
 
@@ -2,19 +2,23 @@ module Zelda
2
2
  class Request
3
3
  def self.get(url)
4
4
  result = HTTParty.get parse_url(url)
5
-
5
+
6
6
  if result
7
7
  %w(created_at updated_at id).each do |key|
8
8
  result.delete(key) if result[key]
9
9
  end
10
+
11
+ if result['error']
12
+ raise result['error']
13
+ end
10
14
  end
11
15
 
12
16
  result
13
17
  end
14
-
18
+
15
19
  def self.parse_url(*args)
16
20
  raise "No Zelda::API_KEY specified" unless defined?(Zelda::API_KEY)
17
21
  "http://zelda.omroep.nl/#{ Zelda::API_KEY }/#{ args.join('/') }"
18
22
  end
19
23
  end
20
- end
24
+ end
@@ -1,3 +1,3 @@
1
1
  module Zelda
2
- VERSION = "1.3.0"
2
+ VERSION = "1.4.0"
3
3
  end
@@ -0,0 +1 @@
1
+ <error>Invalid API key specified</error>
@@ -23,6 +23,12 @@ describe Zelda::Request do
23
23
  lambda { Zelda::Request.get('foo') }.should raise_error("No Zelda::API_KEY specified")
24
24
  Zelda::API_KEY = api_key
25
25
  end
26
+
27
+ it "should raise error given in the response" do
28
+ xml = File.read(File.dirname(__FILE__) + "/../responses/invalid_api_key.xml")
29
+ FakeWeb.register_uri(:get, "http://zelda.omroep.nl/12345/foo", :body => xml, :content_type => "text/xml")
30
+ lambda { Zelda::Request.get('foo') }.should raise_error("Invalid API key specified")
31
+ end
26
32
 
27
33
  describe "when returning an url" do
28
34
  it "should be correct with 1 args" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zelda
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,12 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-10-12 00:00:00.000000000 +02:00
13
- default_executable:
12
+ date: 2012-03-21 00:00:00.000000000Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: httparty
17
- requirement: &2157947540 !ruby/object:Gem::Requirement
16
+ requirement: &70349118794460 !ruby/object:Gem::Requirement
18
17
  none: false
19
18
  requirements:
20
19
  - - ! '>='
@@ -22,7 +21,7 @@ dependencies:
22
21
  version: '0'
23
22
  type: :runtime
24
23
  prerelease: false
25
- version_requirements: *2157947540
24
+ version_requirements: *70349118794460
26
25
  description: If you don't know what this is, you probably don't need it
27
26
  email:
28
27
  - joost@spacebabies.nl
@@ -32,6 +31,7 @@ extra_rdoc_files: []
32
31
  files:
33
32
  - .gitignore
34
33
  - .rspec
34
+ - .travis.yml
35
35
  - CHANGELOG.md
36
36
  - Gemfile
37
37
  - Gemfile.lock
@@ -47,6 +47,7 @@ files:
47
47
  - lib/zelda/version.rb
48
48
  - lib/zelda/zender.rb
49
49
  - spec/responses/aflevering.xml
50
+ - spec/responses/invalid_api_key.xml
50
51
  - spec/responses/omroep.xml
51
52
  - spec/responses/serie.xml
52
53
  - spec/responses/zender.xml
@@ -61,7 +62,6 @@ files:
61
62
  - spec/zelda/serie_spec.rb
62
63
  - spec/zelda/zender_spec.rb
63
64
  - zelda.gemspec
64
- has_rdoc: true
65
65
  homepage: https://github.com/tilsammans/zelda
66
66
  licenses: []
67
67
  post_install_message:
@@ -82,12 +82,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
82
82
  version: '0'
83
83
  requirements: []
84
84
  rubyforge_project:
85
- rubygems_version: 1.6.2
85
+ rubygems_version: 1.8.10
86
86
  signing_key:
87
87
  specification_version: 3
88
88
  summary: If you don't know what this is, you probably don't need it
89
89
  test_files:
90
90
  - spec/responses/aflevering.xml
91
+ - spec/responses/invalid_api_key.xml
91
92
  - spec/responses/omroep.xml
92
93
  - spec/responses/serie.xml
93
94
  - spec/responses/zender.xml
@@ -101,3 +102,4 @@ test_files:
101
102
  - spec/zelda/request_spec.rb
102
103
  - spec/zelda/serie_spec.rb
103
104
  - spec/zelda/zender_spec.rb
105
+ has_rdoc: