midna 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,6 +5,9 @@ Ruby interface to the Midna API.
5
5
  This gem chats with the Midna API so you don't have to. It will give you objects in the Midna namespace, which you can query like Active Record:
6
6
 
7
7
  Midna::Channel.all
8
+ Midna::Channel.find(code)
9
+
10
+ All of these methods will return hashes or arrays of hashes.
8
11
 
9
12
  Also, Midna is Zelda's goth sister.
10
13
 
@@ -22,7 +25,7 @@ Install this plugin as a gem.
22
25
 
23
26
  Then run <tt>rake gems:install</tt>.
24
27
 
25
- == Installation as a Ruby gem
28
+ == Usage in plain Ruby
26
29
 
27
30
  First install the gem on your machine like usual:
28
31
 
@@ -34,7 +37,8 @@ Use <tt>sudo</tt> if your setup requires it. After this you can require it in yo
34
37
  require 'midna'
35
38
 
36
39
  puts Midna::Channel.all
37
- # => {"channels" => [ an array of hashes ]}
40
+ # => [{"name"=>"Nederland 1", "code"=>"NL1"}, {"name"=>"Nederland 2", "code"=>"NL2"}, {"name"=>"Nederland 3 & Z@pp", "code"=>"NL3"}]
41
+
38
42
 
39
43
  == Configuration
40
44
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.2.0
@@ -1,7 +1,11 @@
1
1
  class Midna
2
2
  class Channel
3
3
  def self.all
4
- Midna.get("/channels.xml").to_hash
4
+ Midna.get("/channels.xml").to_hash["channels"]
5
+ end
6
+
7
+ def self.find(code)
8
+ Midna.get("/channels/#{code}.xml").to_hash["channel"]
5
9
  end
6
10
  end
7
11
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{midna}
8
- s.version = "0.1.0"
8
+ s.version = "0.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Joost Baaij"]
12
- s.date = %q{2010-08-04}
12
+ s.date = %q{2010-08-06}
13
13
  s.description = %q{This gem chats with the Midna API so you don't have to bother with GETs and POSTs and such. It will give you objects in the Midna namespace, so they don't even clash with your existing ones. Also, Midna is Zelda's goth sister.}
14
14
  s.email = %q{joost@spacebabies.nl}
15
15
  s.extra_rdoc_files = [
@@ -2,12 +2,23 @@ require 'spec_helper'
2
2
 
3
3
  describe Midna::Channel do
4
4
  its(:class) { should respond_to(:all) }
5
+ its(:class) { should respond_to(:find) }
5
6
 
6
7
  describe 'all' do
7
8
  it "should get /channels.xml" do
9
+ hash = stub
8
10
  Midna.should_receive(:get).with("/channels.xml").and_return(all = stub)
9
- all.stub!(:to_hash).and_return(hash = stub)
11
+ all.stub!(:to_hash).and_return({"channels" => hash})
10
12
  Midna::Channel.all.should equal(hash)
11
13
  end
12
14
  end
15
+
16
+ describe 'find' do
17
+ it "should get /channel/CODE.xml" do
18
+ hash = stub
19
+ Midna.should_receive(:get).with("/channels/NL3.xml").and_return(channel = stub)
20
+ channel.stub!(:to_hash).and_return({"channel" => hash})
21
+ Midna::Channel.find('NL3').should equal(hash)
22
+ end
23
+ end
13
24
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: midna
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 1
8
+ - 2
9
9
  - 0
10
- version: 0.1.0
10
+ version: 0.2.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Joost Baaij
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-08-04 00:00:00 +02:00
18
+ date: 2010-08-06 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency