class OdeonUk::Internal::Parser::Api::FilmLookup

Parses a string to derive address

Public Instance Methods

at(cinema_id) click to toggle source

@param [Integer] cinema_id id of the cinema @return [Hash{Integer => OdeonUk::Internal::Parser::Api::Film}] contains all films keyed by id for a cinema

# File lib/odeon_uk/internal/parser/api/film_lookup.rb, line 11
def at(cinema_id)
  to_hash.select do |_, film_hash|
    film_hash['sites'].include?(cinema_id)
  end
end
to_hash() click to toggle source

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

# File lib/odeon_uk/internal/parser/api/film_lookup.rb, line 19
def to_hash
  @to_hash ||= api.each_with_object({}) do |film_hash, result|
    result[film_hash['filmMasterId'].to_i] = film_hash
  end
end

Private Instance Methods

api() click to toggle source
# File lib/odeon_uk/internal/parser/api/film_lookup.rb, line 27
def api
  @api ||= OdeonUk::Internal::ApiResponse.new.app_init['films']
end