Class: CineworldUk::Internal::Parser::Api::PerformancesByDay Private

Inherits:
Object
  • Object
show all
Defined in:
lib/cineworld_uk/internal/parser/api/performances_by_day.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

A day of performances, a parser for a single API call

Instance Method Summary collapse

Constructor Details

#initialize(cinema_id, date, film_lookup) ⇒ PerformancesByDay

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of PerformancesByDay.



8
9
10
11
12
# File 'lib/cineworld_uk/internal/parser/api/performances_by_day.rb', line 8

def initialize(cinema_id, date, film_lookup)
  @cinema_id = cinema_id
  @date = date
  @film_lookup = film_lookup
end

Instance Method Details

#to_aArray<Hash>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Details of performance from single day :starting_at, :variant

Returns:

  • (Array<Hash>)

    :booking_url, :dimension, :film_name,



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/cineworld_uk/internal/parser/api/performances_by_day.rb', line 17

def to_a
  performances.map do |performance|
    film = @film_lookup[performance.film_id]
    {
      booking_url: performance.booking_url,
      dimension: film.dimension,
      film_name: film.name,
      starting_at: utc(performance.starting_at),
      variant: (performance.variant + film.variant).sort
    }
  end
end