Sha256: 4f11705746d93db47fbbb4363e5c45cd8628319c4650b70b1d9a181a55b58ef9

Contents?: true

Size: 835 Bytes

Versions: 7

Compression:

Stored size: 835 Bytes

Contents

require 'open-uri'
require 'openssl'

module PicturehouseUk
  # @api private
  module Internal
    # fetches pages from the picturehouse.com website
    class Website
      # get the cinema page with showings for passed id
      # @return [String]
      def cinema(id)
        get("cinema/#{id}")
      end

      # get the cinema contact information page for passed id
      # @return [String]
      def info(id)
        get("cinema/info/#{id}")
      rescue OpenURI::HTTPError
        ''
      end

      # get the home page
      # @return [String]
      def home
        get(nil)
      end

      private

      def get(path)
        # SSL verification doesn't work on picturehouses.com
        open("https://www.picturehouses.com/#{path}",
             ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE).read
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
picturehouse_uk-3.0.13 lib/picturehouse_uk/internal/website.rb
picturehouse_uk-3.0.12 lib/picturehouse_uk/internal/website.rb
picturehouse_uk-3.0.11 lib/picturehouse_uk/internal/website.rb
picturehouse_uk-3.0.10 lib/picturehouse_uk/internal/website.rb
picturehouse_uk-3.0.9 lib/picturehouse_uk/internal/website.rb
picturehouse_uk-3.0.8 lib/picturehouse_uk/internal/website.rb
picturehouse_uk-3.0.7 lib/picturehouse_uk/internal/website.rb