lib/odeon_uk/api/screenings.rb in odeon_uk-3.0.2 vs lib/odeon_uk/api/screenings.rb in odeon_uk-3.0.3

- old
+ new

@@ -21,11 +21,11 @@ performances.flat_map do |p| { dimension: screening['attribute'].include?('3D') ? '3d' : '2d', film_name: films_map(cinema_id)[film_id], time: TimeParser.new(date, p[0]['performanceTime']).to_utc, - variant: '', + variant: VariantParser.new(screening['attribute']).to_a } end end end end @@ -81,9 +81,23 @@ early_morning_screening? ? parsed_time + 60 * 60 * 24 : parsed_time end def tz @tz ||= TZInfo::Timezone.get('Europe/London') + end + end + + VariantParser = Struct.new(:text) do + TRANSLATOR = { + 'Culture' => 'arts', + 'Kids' => 'kids', + 'IMAX' => 'imax', + 'Newbies' => 'baby', + 'Silver Cinema' => 'senior' + } + + def to_a + TRANSLATOR.select { |k, _| text.include?(k) }.values.uniq end end end end