tvdbr 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/lib/tvdbr/client.rb CHANGED
@@ -31,7 +31,7 @@ module Tvdbr
31
31
  updates[:series].each do |series_id|
32
32
  series = self.find_series_by_id(series_id)
33
33
  block.call(series)
34
- end
34
+ end if updates[:series].respond_to?(:each)
35
35
  end
36
36
 
37
37
  # Yields the block for every updated episode
@@ -41,7 +41,7 @@ module Tvdbr
41
41
  updates[:episodes].each do |episode_id|
42
42
  episode = self.find_episode_by_id(episode_id)
43
43
  block.call(episode)
44
- end
44
+ end if updates[:episodes].respond_to?(:each)
45
45
  end
46
46
 
47
47
  # Returns all series matching the given title
@@ -94,10 +94,9 @@ module Tvdbr
94
94
  # tvdb.find_updates_since(1.day.ago)
95
95
  # => { :series => [1,2,3], :episodes => [1,2,3], :time => '<stamp>' }
96
96
  def find_updates_since(time)
97
- @_updated_results ||= {}
98
97
  stamp = time.to_i # Get timestamp
99
- result = @_updated_results[stamp] ||= self.class.get("/Updates.php?type=all&time=#{stamp}")['Items']
100
- { :series => result['Series'].map(&:to_i), :episodes => result['Episode'].map(&:to_i), :time => result['Time'] }
98
+ result = self.class.get("/Updates.php?type=all&time=#{stamp}")['Items']
99
+ { :series => result['Series'], :episodes => result['Episode'], :time => result['Time'] }
101
100
  end
102
101
 
103
102
  protected
@@ -43,7 +43,7 @@ module Tvdbr
43
43
  # dateify :release_date
44
44
  def self.dateify(*attrs)
45
45
  attrs.each do |a|
46
- define_method(a) { Time.parse(self[a]) if self[a] }
46
+ define_method(a) { Time.parse(self[a]) rescue nil if self[a] }
47
47
  end
48
48
  end
49
49
 
data/lib/tvdbr/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Tvdbr
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tvdbr
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Miso
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-01-17 00:00:00 -08:00
19
+ date: 2011-01-18 00:00:00 -08:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency