class OdeonUk::Internal::ApiResponse

Utility class to make calls to the odeon website

Constants

VERSION

iOS app API version

Public Instance Methods

all_cinemas() click to toggle source

cinemas information @return [Hash] decoded response of api containing cinema details

# File lib/odeon_uk/internal/api_response.rb, line 15
def all_cinemas
  parse(all_cinemas_raw)
end
app_init() click to toggle source

application initialize @return [Hash] decoded response of api, mostly films

# File lib/odeon_uk/internal/api_response.rb, line 21
def app_init
  parse(app_init_raw)
end
film_times(cinema_id, film_id) click to toggle source

showings for a film at a cinema @return [Hash] decoded response of api, day split times

# File lib/odeon_uk/internal/api_response.rb, line 27
def film_times(cinema_id, film_id)
  parse(film_times_raw(cinema_id, film_id))
end

Private Instance Methods

all_cinemas_raw() click to toggle source
# File lib/odeon_uk/internal/api_response.rb, line 33
def all_cinemas_raw
  post('all-cinemas').body
end
app_init_raw() click to toggle source
# File lib/odeon_uk/internal/api_response.rb, line 37
def app_init_raw
  post('app-init').body
end
film_times_raw(cinema_id, film_id) click to toggle source
# File lib/odeon_uk/internal/api_response.rb, line 41
def film_times_raw(cinema_id, film_id)
  post('film-times', { s: cinema_id, m: film_id }).body
end
parse(content) click to toggle source
# File lib/odeon_uk/internal/api_response.rb, line 50
def parse(content)
  plist = CFPropertyList::List.new(data: content)
  CFPropertyList.native_types(plist.value).fetch('data', {})
end
post(path, request_body={}) click to toggle source
# File lib/odeon_uk/internal/api_response.rb, line 45
def post(path, request_body={})
  uri = URI("https://api.odeon.co.uk/#{VERSION}/api/#{path}")
  Net::HTTP.post_form(uri, request_body)
end