midna 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,7 +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)
8
+ Midna::Channel.find(code) # alphanumeric; like NL1
9
+ Midna::Episode.find(id) # aflevering ID/episode ID from the omroep player
10
+ Midna::Broadcast.all(code) # code is Channel code
9
11
 
10
12
  All of these methods will return hashes or arrays of hashes.
11
13
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.1
1
+ 0.3.0
@@ -7,6 +7,8 @@ rescue LoadError
7
7
  end
8
8
 
9
9
  require 'midna/channel'
10
+ require 'midna/episode'
11
+ require 'midna/broadcast'
10
12
 
11
13
  class Midna
12
14
  include HTTParty
@@ -0,0 +1,7 @@
1
+ class Midna
2
+ class Broadcast
3
+ def self.all(code)
4
+ Midna.get("/channels/#{code}/broadcasts.xml").to_hash["broadcasts"]
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ class Midna
2
+ class Episode
3
+ def self.find(id)
4
+ Midna.get("/episodes/#{id}.xml").to_hash["episode"]
5
+ end
6
+ end
7
+ end
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{midna}
8
- s.version = "0.2.1"
8
+ s.version = "0.3.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"]
@@ -24,9 +24,13 @@ Gem::Specification.new do |s|
24
24
  "Rakefile",
25
25
  "VERSION",
26
26
  "lib/midna.rb",
27
+ "lib/midna/broadcast.rb",
27
28
  "lib/midna/channel.rb",
29
+ "lib/midna/episode.rb",
28
30
  "midna.gemspec",
31
+ "spec/midna/broadcast_spec.rb",
29
32
  "spec/midna/channel_spec.rb",
33
+ "spec/midna/episode_spec.rb",
30
34
  "spec/midna_spec.rb",
31
35
  "spec/spec.opts",
32
36
  "spec/spec_helper.rb",
@@ -38,7 +42,9 @@ Gem::Specification.new do |s|
38
42
  s.rubygems_version = %q{1.3.7}
39
43
  s.summary = %q{Ruby interface to the Midna API}
40
44
  s.test_files = [
41
- "spec/midna/channel_spec.rb",
45
+ "spec/midna/broadcast_spec.rb",
46
+ "spec/midna/channel_spec.rb",
47
+ "spec/midna/episode_spec.rb",
42
48
  "spec/midna_spec.rb",
43
49
  "spec/spec_helper.rb",
44
50
  "spec/support/midna.rb"
@@ -0,0 +1,14 @@
1
+ require 'spec_helper'
2
+
3
+ describe Midna::Broadcast do
4
+ its(:class) { should respond_to(:all) }
5
+
6
+ describe 'all' do
7
+ it "should get /channels/NL1/broadcasts.xml" do
8
+ hash = stub
9
+ Midna.should_receive(:get).with("/channels/NL1/broadcasts.xml").and_return(all = stub)
10
+ all.stub!(:to_hash).and_return({"broadcasts" => hash})
11
+ Midna::Broadcast.all('NL1').should equal(hash)
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,15 @@
1
+ require 'spec_helper'
2
+
3
+ describe Midna::Episode do
4
+ its(:class) { should respond_to(:find) }
5
+
6
+ describe 'find' do
7
+ it "should get /episodes/ID.xml" do
8
+ hash = stub
9
+ Midna.should_receive(:get).with("/episodes/1138.xml").and_return(episode = stub)
10
+ episode.stub!(:to_hash).and_return({"episode" => hash})
11
+ Midna::Episode.find('1138').should equal(hash)
12
+ end
13
+ end
14
+
15
+ 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: 21
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 2
9
- - 1
10
- version: 0.2.1
8
+ - 3
9
+ - 0
10
+ version: 0.3.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Joost Baaij
@@ -65,9 +65,13 @@ files:
65
65
  - Rakefile
66
66
  - VERSION
67
67
  - lib/midna.rb
68
+ - lib/midna/broadcast.rb
68
69
  - lib/midna/channel.rb
70
+ - lib/midna/episode.rb
69
71
  - midna.gemspec
72
+ - spec/midna/broadcast_spec.rb
70
73
  - spec/midna/channel_spec.rb
74
+ - spec/midna/episode_spec.rb
71
75
  - spec/midna_spec.rb
72
76
  - spec/spec.opts
73
77
  - spec/spec_helper.rb
@@ -107,7 +111,9 @@ signing_key:
107
111
  specification_version: 3
108
112
  summary: Ruby interface to the Midna API
109
113
  test_files:
114
+ - spec/midna/broadcast_spec.rb
110
115
  - spec/midna/channel_spec.rb
116
+ - spec/midna/episode_spec.rb
111
117
  - spec/midna_spec.rb
112
118
  - spec/spec_helper.rb
113
119
  - spec/support/midna.rb