Class: IMDB::Data::Show

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/imdb-html/data/show.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tt) ⇒ Show

Returns a new instance of Show.



8
9
10
# File 'lib/imdb-html/data/show.rb', line 8

def initialize tt
	@tt = tt.to_i
end

Class Method Details

.process(tt) ⇒ Object



34
35
36
37
38
39
# File 'lib/imdb-html/data/show.rb', line 34

def self.process tt
	show = Show.new tt
	File.open show.json_path, "w" do |j|
		j.puts JSON.pretty_generate( show.episodes )
	end
end

Instance Method Details

#episodesObject



26
27
28
# File 'lib/imdb-html/data/show.rb', line 26

def episodes
	Episode.parse_params( noko "epcast" )
end

#http(*args) ⇒ Object



18
19
20
# File 'lib/imdb-html/data/show.rb', line 18

def http *args
	self.class.get path *args
end

#json_pathObject



30
31
32
# File 'lib/imdb-html/data/show.rb', line 30

def json_path
	File.join "/home/mdt/g/imdb-memo/json/#{tt}.json"
end

#noko(*args) ⇒ Object



21
22
23
# File 'lib/imdb-html/data/show.rb', line 21

def noko *args
	Nokogiri::HTML http *args
end

#path(*args) ⇒ Object



15
16
17
# File 'lib/imdb-html/data/show.rb', line 15

def path *args
	File.join *["/title/tt#{tt}", args].flatten
end

#ttObject



12
13
14
# File 'lib/imdb-html/data/show.rb', line 12

def tt
	@tt.to_s.rjust 7, '0'
end