Module: HttpCapture

Included in:
Client
Defined in:
lib/google_movies/http_capture.rb

Defined Under Namespace

Classes: Client

Instance Method Summary collapse

Instance Method Details

#get_information(doc) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
# File 'lib/google_movies/http_capture.rb', line 23

def get_information(doc)
  @doc = doc
  @movies_theater ||= []

  @doc.search('div[@class="theater"]').each do |theater|
    movies = []
    movies = get_movies(theater)
    @movies_theater << create_movie_theater_with(theater, movies)
  end
  @movies_theater
end

#movies_theaters(page_url) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/google_movies/http_capture.rb', line 11

def movies_theaters(page_url)
  @http_address = URI.parse(URI.encode(page_url.strip))
  @doc = page_doc(@http_address)
  pages = @doc.css('div.n a[@href]')
  pages.each do |p|
    http_address = URI.parse(URI.encode("http://google.com#{p.values.first.strip}"))
    doc = page_doc(http_address)
    get_information(doc)
  end
  @movies_theater
end