Class: TheTvdb::Configuration

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/the_tvdb/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



7
8
9
# File 'lib/the_tvdb/configuration.rb', line 7

def initialize
  @api_key = ENV['TVDBKEY']
end

Instance Attribute Details

#api_keyObject

Returns the value of attribute api_key.



6
7
8
# File 'lib/the_tvdb/configuration.rb', line 6

def api_key
  @api_key
end

Instance Method Details

#data_pathObject



25
26
27
# File 'lib/the_tvdb/configuration.rb', line 25

def data_path
  "#{dump_path}/data"
end

#default_pathObject



18
19
20
# File 'lib/the_tvdb/configuration.rb', line 18

def default_path
  'tmp/the_tvdb/'
end

#dump_pathObject



11
12
13
14
15
16
# File 'lib/the_tvdb/configuration.rb', line 11

def dump_path
  @dump_path ||= default_path
  FileUtils.mkdir_p("#{@dump_path}/zipfiles") if !File.directory?("#{@dump_path}/zipfiles")
  FileUtils.mkdir_p("#{@dump_path}/data/episodes") if !File.directory?("#{@dump_path}/data/episodes")
  @dump_path
end

#episodes_pathObject



28
29
30
# File 'lib/the_tvdb/configuration.rb', line 28

def episodes_path
  "#{data_path}/episodes"
end

#zip_pathObject



22
23
24
# File 'lib/the_tvdb/configuration.rb', line 22

def zip_path
  "#{dump_path}/zipfiles"
end