Module: Fandango

Defined in:
lib/fandango.rb,
lib/fandango/version.rb,
lib/fandango/parsers/movie.rb,
lib/fandango/parsers/theater.rb

Defined Under Namespace

Classes: BadResponse, Parser

Constant Summary collapse

VERSION =
"0.2.1"

Class Method Summary collapse

Class Method Details

.movies_near(postal_code) ⇒ Object

Raises:

  • (ArgumentError)


10
11
12
13
14
15
16
17
18
19
20
# File 'lib/fandango.rb', line 10

def movies_near(postal_code)
  raise ArgumentError, "postal code cannot be blank" if postal_code.nil? || postal_code == ''
  feed = fetch_and_parse(postal_code)
  feed.entries.map do |entry|
    parser = Parser.new(entry)
    hash = {}
    hash[:theater] = parser.parse_theater
    hash[:movies] = parser.parse_movies
    hash
  end
end