assonnato 0.1 → 0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5c66c6688d50418b551f84148d33c39344d523d4
4
- data.tar.gz: 2977ce2fc199a018961e4ebfd1182920d0c304b7
3
+ metadata.gz: b5bffd3b2439de3995ad8090fa3431cbc6503d9e
4
+ data.tar.gz: be998af5550a5b81f5e6e7ff2e5ce9e8df9bf722
5
5
  SHA512:
6
- metadata.gz: 730bb6f8aa0d3740a0513d8af14ce69b1e46c6cbbbd5625d177264c37a5861caed886a972ec74d8164fb39ceddef0ba42618851d59c36a2ba4fa1d72316629de
7
- data.tar.gz: 1d158e97bfb288151cb3468a6635d477d1526b83760ddeebf441f1e5976cadc400c5f527bf52571aed5518bd3be874fa79c24d504a74b48dfca9af633aa528f0
6
+ metadata.gz: 95a0dc787338ff3e49175ba71a36d310aaa9de24f6f2913abf6329c6b41a2d8332c270042466a15ca480be7674c31d9529902750a01c933d078659b364fb83e7
7
+ data.tar.gz: 93a634b91386845708e88d439a54a089246dee924ee0961b830393ad7f65e8caf82e6579c35ce379dba4e8c32a1e31d2a5819ae710e6670ba14d527d59fe9b15
@@ -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.#{@format}"), @format
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}.#{@format}"), @format
22
+ parse get(@host, "/shows/get/#{URI.escape show}/episodes/get/#{episode}")
23
23
  end
24
24
  end
25
25
  end
@@ -10,25 +10,24 @@
10
10
 
11
11
  module Assonnato
12
12
  class Show
13
- attr_accessor :host, :format
13
+ attr_accessor :host
14
14
  include Request
15
15
  include Parser
16
16
 
17
- def initialize(host, format = :json)
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.#{@format}"), @format
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}.#{@format}"), @format
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}.#{@format}"), @format
30
+ parse get(@host, "/shows/get/#{URI.escape show}")
32
31
  end
33
32
  end
34
33
  end
@@ -9,5 +9,5 @@
9
9
  #++
10
10
 
11
11
  module Assonnato
12
- VERSION = '0.1'
12
+ VERSION = '0.2'
13
13
  end
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', :json
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.id.should eql(1)
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
@@ -3,7 +3,7 @@ require 'assonnato'
3
3
 
4
4
  describe 'Assonnato' do
5
5
  before do
6
- @show = Assonnato::Show.new 'http://localhost:4567', :json
6
+ @show = Assonnato::Show.new 'http://localhost:4567'
7
7
  end
8
8
 
9
9
  it 'returns all the shows' do
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.1'
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-27 00:00:00.000000000 Z
11
+ date: 2013-12-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json