Sha256: 5d7e97de9b2216a26658d23c70a482fdae4e3cab12d1acdb742f9416576191cf

Contents?: true

Size: 908 Bytes

Versions: 1

Compression:

Stored size: 908 Bytes

Contents

require 'open-uri'

module OdeonUk
  # Internal utility classes: Do not use
  # @api private
  module Html
    # Utility class to make calls to the odeon website
    class Website
      # cinema page
      # @param [Integer] cinema_id website id of the cinema
      # @return [String] html of the page
      def cinema(cinema_id)
        get("cinemas/odeon/#{cinema_id}/")
      end

      # showtimes page for a single cinema
      # @param [Integer] cinema_id website id of the cinema
      # @return [String] html of the page
      def showtimes(cinema_id)
        get("showtimes/week/#{cinema_id}/?siteId=#{cinema_id}")
      end

      # sitemap page
      # @return [String] html of the page
      def sitemap
        get('sitemap/')
      end

      private

      def get(path)
        URI("http://www.odeon.co.uk/#{path}").read
      rescue OpenURI::HTTPError
        ''
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
odeon_uk-3.0.6 lib/odeon_uk/html/website.rb