Class: CineworldUk::Internal::ScreeningParser Private
- Inherits:
-
Object
- Object
- CineworldUk::Internal::ScreeningParser
- Defined in:
- lib/cineworld_uk/internal/screening_parser.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.
parse a single performance
Constant Summary collapse
- DATE_REGEX =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
regex for date in url
/date\=(\d{4})(\d{2})(\d{2})/- TIME_REGEX =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
regex for time in url
/time\=(\d{2})\:(\d{2})/- DIMENSION_CSS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
css selector for dimension
'.icon-service-2d, .icon-service-3d'- BABY_CSS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
css selector for baby screening
'.icon-service-cb'- DBOX_CSS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
css selector for d-box screening
'.icon-service-dx'- HFR_CSS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
css selector for hfr screening
'.icon-service-hfr'- IMAX_CSS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
css selector for imax screening
'.icon-service-ix'- KIDS_CSS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
css selector for kids screening
'.icon-service-m4j'
Instance Method Summary collapse
-
#booking_url ⇒ String
private
url to book this screening.
-
#dimension ⇒ String
private
the dimension of the screening.
-
#initialize(html) ⇒ ScreeningParser
constructor
private
A new instance of ScreeningParser.
-
#time ⇒ Time
private
utc time of the screening.
-
#to_hash ⇒ Hash
private
a attributes of a single screening.
-
#variant ⇒ Array<String>
private
anything special about the screening.
Constructor Details
#initialize(html) ⇒ ScreeningParser
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 ScreeningParser.
26 27 28 |
# File 'lib/cineworld_uk/internal/screening_parser.rb', line 26 def initialize(html) @html = html.to_s end |
Instance Method Details
#booking_url ⇒ 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.
url to book this screening
32 33 34 35 |
# File 'lib/cineworld_uk/internal/screening_parser.rb', line 32 def booking_url return unless bookable? 'http://www.cineworld.co.uk' + doc.css('a').attribute('href') end |
#dimension ⇒ 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.
the dimension of the screening
39 40 41 42 |
# File 'lib/cineworld_uk/internal/screening_parser.rb', line 39 def dimension return unless bookable? doc.css(DIMENSION_CSS).text.downcase end |
#time ⇒ Time
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.
utc time of the screening
46 47 48 49 |
# File 'lib/cineworld_uk/internal/screening_parser.rb', line 46 def time return unless bookable? timezone.local_to_utc(Time.utc(*date_array + time_array)) end |
#to_hash ⇒ 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.
a attributes of a single screening
71 72 73 74 75 76 77 78 79 |
# File 'lib/cineworld_uk/internal/screening_parser.rb', line 71 def to_hash return unless bookable? { booking_url: booking_url, dimension: dimension, time: time, variant: variant } end |
#variant ⇒ Array<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.
anything special about the screening
56 57 58 59 |
# File 'lib/cineworld_uk/internal/screening_parser.rb', line 56 def variant return unless bookable? [baby, dbox, hfr, imax, kids].compact end |