Module: TheTvdb
- Defined in:
- lib/the_tvdb.rb,
lib/the_tvdb/show.rb,
lib/the_tvdb/episode.rb,
lib/the_tvdb/gateway.rb,
lib/the_tvdb/version.rb,
lib/the_tvdb/configuration.rb,
lib/generators/the_tvdb/install_generator.rb
Defined Under Namespace
Modules: Generators
Classes: Configuration, Episode, Gateway, Show
Constant Summary
collapse
- VERSION =
"0.1.5"
Class Method Summary
collapse
Class Method Details
.configuration ⇒ Object
13
14
15
|
# File 'lib/the_tvdb.rb', line 13
def self.configuration
@config ||= Configuration.instance
end
|
.gateway ⇒ Object
17
18
19
|
# File 'lib/the_tvdb.rb', line 17
def self.gateway
@gateway ||= Gateway.instance
end
|
.setup {|self.configuration| ... } ⇒ Object
9
10
11
|
# File 'lib/the_tvdb.rb', line 9
def self.setup
yield self.configuration
end
|
.update(timestamp = nil, full_data = false) ⇒ Hash
Starting from the last update recorded on the gateway, a hash with the new update time and the updated shows are returned
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/the_tvdb.rb', line 27
def self.update(timestamp=nil, full_data=false)
update_hash = gateway.update(timestamp)
result = { time: update_hash['Time'].to_i }
result[:shows] = []
if update_hash['Series']
if full_data
result[:shows] = update_hash['Series'].map {|show_remote_id| Show.find(show_remote_id) }
else
result[:shows] = update_hash['Series'].map {|show_remote_id| show_remote_id.to_i }
end
end
gateway.last_updated = result[:time]
result
end
|