Class: OdeonUk::Performance

Inherits:
Cinebase::Performance
  • Object
show all
Defined in:
lib/odeon_uk/performance.rb

Overview

The object representing a single screening of a film on the Odeon UK website

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Object

Parameters:

  • options (Hash)

    options hash

Options Hash (options):

  • :booking_url (String) — default: nil

    buying url for the screening

  • :cinema_name (String)

    name of the cinema

  • :cinema_id (String)

    website id of the cinema

  • :dimension (String) — default: '2d'

    dimension of the screening

  • :film_name (String)

    name of the film

  • :starting_at (Time)

    listed start time of the performance



# File 'lib/odeon_uk/performance.rb', line 15

Instance Attribute Details

#booking_urlString (readonly)

Returns the booking URL on the cinema website.

Returns:

  • (String)

    the booking URL on the cinema website



# File 'lib/odeon_uk/performance.rb', line 4

#cinema_idString (readonly)

Returns the cinema id.

Returns:

  • (String)

    the cinema id



# File 'lib/odeon_uk/performance.rb', line 4

#cinema_nameString (readonly)

Returns the cinema name.

Returns:

  • (String)

    the cinema name



# File 'lib/odeon_uk/performance.rb', line 4

#dimensionString (readonly)

Returns 2d or 3d.

Returns:

  • (String)

    2d or 3d



# File 'lib/odeon_uk/performance.rb', line 4

#film_nameString (readonly)

Returns the film name.

Returns:

  • (String)

    the film name



# File 'lib/odeon_uk/performance.rb', line 4

Class Method Details

.at(cinema_id) ⇒ Array<OdeonUk::Performance>

All currently listed films showing at a cinema

Parameters:

  • cinema_id (Integer)

    id of the cinema on the website

Returns:



27
28
29
30
31
32
33
34
35
36
37
# File 'lib/odeon_uk/performance.rb', line 27

def self.at(cinema_id)
  cinema_id = cinema_id.to_i
  film_ids_at(cinema_id).flat_map do |film_id|
    api_response.film_times(cinema_id, film_id).flat_map do |day|
      performance_days(day).map do |hash|
        new(hash.merge(cinema_hash(cinema_id))
                .merge(film_name: film_name(film_id)))
      end
    end
  end
end

Instance Method Details

#showing_onDate

The date of the screening

Returns:

  • (Date)


# File 'lib/odeon_uk/performance.rb', line 39

#starting_atTime

UTC time of the screening

Returns:

  • (Time)


# File 'lib/odeon_uk/performance.rb', line 43

#variantArray[String]

The kinds of screening (IMAX, kids, baby, senior)

Returns:

  • (Array[String])


# File 'lib/odeon_uk/performance.rb', line 47