class CineworldUk::Internal::Parser::Api::FilmLookup

Parses a string to derive address

Public Instance Methods

to_hash() click to toggle source

@return [Hash{Integer => CineworldUk::Internal::Parser::Api::Film}] contains all films & upcoming films keyed by id

# File lib/cineworld_uk/internal/parser/api/film_lookup.rb, line 10
def to_hash
  @to_hash ||= all_films.each_with_object({}) do |item, lookup|
    next if item['edi'].nil?
    lookup[item['edi']] = Film.new(item)
  end
end

Private Instance Methods

all_films() click to toggle source
# File lib/cineworld_uk/internal/parser/api/film_lookup.rb, line 19
def all_films
  films_data + comingsoon_data
end
api() click to toggle source
# File lib/cineworld_uk/internal/parser/api/film_lookup.rb, line 23
def api
  @api ||= CineworldUk::Internal::ApiResponse.new
end
comingsoon_data() click to toggle source
# File lib/cineworld_uk/internal/parser/api/film_lookup.rb, line 27
def comingsoon_data
  @comingsoon_data ||= JSON.parse(api.film_list_comingsoon)['films']
end
films_data() click to toggle source
# File lib/cineworld_uk/internal/parser/api/film_lookup.rb, line 31
def films_data
  @films_data ||= JSON.parse(api.film_list)['films']
end