Class: CineworldUk::Internal::Parser::Api::Film Private

Inherits:
Object
  • Object
show all
Defined in:
lib/cineworld_uk/internal/parser/api/film.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.

Parses a hash to produce film information

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ CineworldUk::Internal::Parser::Api::Film

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.

Parameters:

  • data (Hash)

    parsed from performances JSON



13
14
15
16
# File 'lib/cineworld_uk/internal/parser/api/film.rb', line 13

def initialize(data)
  @data = data
  @id = @data['edi']
end

Instance Attribute Details

#idObject (readonly)

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.

the cineworld id for the film



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

def id
  @id
end

Instance Method Details

#dimensionString

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.

Do you need your 3D glasses?

Returns:

  • (String)

    either ā€˜2dā€™ or ā€˜3dā€™



20
21
22
# File 'lib/cineworld_uk/internal/parser/api/film.rb', line 20

def dimension
  @data['format'] =~ /3D/i ? '3d' : '2d'
end

#nameString

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.

Sanitized film name

Returns:

  • (String)


26
27
28
# File 'lib/cineworld_uk/internal/parser/api/film.rb', line 26

def name
  TitleSanitizer.new(@data['originalTitle'] || '').sanitized
end

#variantArray<String>

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.

List of strings representing different kinds of performance, such as autism, kids, imax, members or q&a

Returns:

  • (Array<String>)

    or an empty array



33
34
35
36
37
38
39
40
41
# File 'lib/cineworld_uk/internal/parser/api/film.rb', line 33

def variant
  [
    @data['title'] =~ /Autism Friendly/i ? 'autism_friendly' : nil,
    @data.fetch('format', '') =~ /IMAX/i ? 'imax' : nil,
    @data['title'] =~ /Movies for Juniors/i ? 'kids' : nil,
    @data['title'] =~ /Unlimited Screening/i ? 'members' : nil,
    @data['title'] =~ /Q (and|&) A/i ? 'q&a' : nil
  ].compact
end