assonnato 0.1 → 0.2
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.
- checksums.yaml +4 -4
- data/lib/assonnato/parser.rb +1 -1
- data/lib/assonnato/type/episode.rb +2 -2
- data/lib/assonnato/type/show.rb +5 -6
- data/lib/assonnato/version.rb +1 -1
- data/spec/episode_spec.rb +2 -2
- data/spec/show_spec.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b5bffd3b2439de3995ad8090fa3431cbc6503d9e
|
4
|
+
data.tar.gz: be998af5550a5b81f5e6e7ff2e5ce9e8df9bf722
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 95a0dc787338ff3e49175ba71a36d310aaa9de24f6f2913abf6329c6b41a2d8332c270042466a15ca480be7674c31d9529902750a01c933d078659b364fb83e7
|
7
|
+
data.tar.gz: 93a634b91386845708e88d439a54a089246dee924ee0961b830393ad7f65e8caf82e6579c35ce379dba4e8c32a1e31d2a5819ae710e6670ba14d527d59fe9b15
|
data/lib/assonnato/parser.rb
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
module Assonnato
|
12
12
|
module Parser
|
13
13
|
|
14
|
-
def parse(what, format)
|
14
|
+
def parse(what, format = :json)
|
15
15
|
collection = case format.to_sym
|
16
16
|
when :json then JSON.parse what
|
17
17
|
when :xml, :csv, :yaml then raise NotImplementedError, 'the support for XML, CSV or YAML data is not supported yet'
|
@@ -11,7 +11,7 @@
|
|
11
11
|
module Assonnato
|
12
12
|
class Episode < Show
|
13
13
|
def all!(show)
|
14
|
-
parse get(@host, "/shows/get/#{URI.escape show}/episodes/list
|
14
|
+
parse get(@host, "/shows/get/#{URI.escape show}/episodes/list")
|
15
15
|
end
|
16
16
|
|
17
17
|
def search!(keyword)
|
@@ -19,7 +19,7 @@ module Assonnato
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def get!(show, episode)
|
22
|
-
parse get(@host, "/shows/get/#{URI.escape show}/episodes/get/#{episode}
|
22
|
+
parse get(@host, "/shows/get/#{URI.escape show}/episodes/get/#{episode}")
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
data/lib/assonnato/type/show.rb
CHANGED
@@ -10,25 +10,24 @@
|
|
10
10
|
|
11
11
|
module Assonnato
|
12
12
|
class Show
|
13
|
-
attr_accessor :host
|
13
|
+
attr_accessor :host
|
14
14
|
include Request
|
15
15
|
include Parser
|
16
16
|
|
17
|
-
def initialize(host
|
17
|
+
def initialize(host)
|
18
18
|
@host = host
|
19
|
-
@format = format
|
20
19
|
end
|
21
20
|
|
22
21
|
def all!
|
23
|
-
parse get(@host, "/shows/all
|
22
|
+
parse get(@host, "/shows/all")
|
24
23
|
end
|
25
24
|
|
26
25
|
def search!(keyword)
|
27
|
-
parse get(@host, "/shows/search/#{URI.escape keyword}
|
26
|
+
parse get(@host, "/shows/search/#{URI.escape keyword}")
|
28
27
|
end
|
29
28
|
|
30
29
|
def get!(show)
|
31
|
-
parse get(@host, "/shows/get/#{URI.escape show}
|
30
|
+
parse get(@host, "/shows/get/#{URI.escape show}")
|
32
31
|
end
|
33
32
|
end
|
34
33
|
end
|
data/lib/assonnato/version.rb
CHANGED
data/spec/episode_spec.rb
CHANGED
@@ -3,7 +3,7 @@ require 'assonnato'
|
|
3
3
|
|
4
4
|
describe 'Assonnato' do
|
5
5
|
before do
|
6
|
-
@episode = Assonnato::Episode.new 'http://localhost:4567'
|
6
|
+
@episode = Assonnato::Episode.new 'http://localhost:4567'
|
7
7
|
end
|
8
8
|
|
9
9
|
it 'returns all the episodes of the given show' do
|
@@ -11,7 +11,7 @@ describe 'Assonnato' do
|
|
11
11
|
res.should be_kind_of(Array)
|
12
12
|
res.should_not be_empty
|
13
13
|
res.first.should be_kind_of(Struct)
|
14
|
-
res.first.
|
14
|
+
res.first.episode.should eql(1)
|
15
15
|
end
|
16
16
|
|
17
17
|
it 'can\'t search episodes' do
|
data/spec/show_spec.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: assonnato
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.2'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Giovanni Capuano
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-12-
|
11
|
+
date: 2013-12-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|