odeon_uk 3.0.6 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +5 -3
  3. data/CHANGELOG.md +14 -0
  4. data/{LICENSE.txt → COMM-LICENSE} +0 -0
  5. data/LICENSE +617 -0
  6. data/README.md +58 -29
  7. data/Rakefile +7 -21
  8. data/lib/odeon_uk.rb +5 -14
  9. data/lib/odeon_uk/cinema.rb +123 -75
  10. data/lib/odeon_uk/{api/response.rb → internal/api_response.rb} +3 -3
  11. data/lib/odeon_uk/internal/parser/api/film_lookup.rb +34 -0
  12. data/lib/odeon_uk/internal/parser/api/performance_day.rb +92 -0
  13. data/lib/odeon_uk/internal/title_sanitizer.rb +34 -39
  14. data/lib/odeon_uk/performance.rb +87 -0
  15. data/lib/odeon_uk/version.rb +2 -2
  16. data/odeon_uk.gemspec +19 -21
  17. data/rake/fixture_creator.rb +5 -57
  18. data/test/fixtures/api/all_cinemas.plist +0 -0
  19. data/test/fixtures/api/app_init.plist +0 -0
  20. data/test/fixtures/api/film_times/71-14876.plist +0 -0
  21. data/test/fixtures/api/film_times/71-15408.plist +0 -0
  22. data/test/fixtures/api/film_times/71-15684.plist +0 -0
  23. data/test/fixtures/api/film_times/71-15866.plist +0 -0
  24. data/test/fixtures/api/film_times/71-15868.plist +0 -0
  25. data/test/fixtures/api/film_times/71-15961.plist +0 -0
  26. data/test/fixtures/api/film_times/71-15963.plist +0 -0
  27. data/test/fixtures/api/film_times/71-15965.plist +0 -0
  28. data/test/fixtures/api/film_times/71-15967.plist +0 -0
  29. data/test/fixtures/api/film_times/71-15969.plist +0 -0
  30. data/test/fixtures/api/film_times/71-15977.plist +0 -0
  31. data/test/fixtures/api/film_times/71-15980.plist +0 -0
  32. data/test/fixtures/api/film_times/71-16037.plist +0 -0
  33. data/test/fixtures/api/film_times/71-16136.plist +0 -0
  34. data/test/fixtures/api/film_times/71-16142.plist +0 -0
  35. data/test/fixtures/api/film_times/71-16143.plist +0 -0
  36. data/test/fixtures/api/film_times/71-16187.plist +0 -0
  37. data/test/fixtures/api/film_times/71-16369.plist +0 -0
  38. data/test/fixtures/api/film_times/71-16370.plist +0 -0
  39. data/test/fixtures/api/film_times/71-16374.plist +0 -0
  40. data/test/fixtures/api/film_times/71-16386.plist +0 -0
  41. data/test/fixtures/api/film_times/71-16387.plist +0 -0
  42. data/test/fixtures/api/film_times/71-16388.plist +0 -0
  43. data/test/fixtures/api/film_times/71-16438.plist +0 -0
  44. data/test/fixtures/api/film_times/71-16454.plist +0 -0
  45. data/test/fixtures/api/film_times/71-16457.plist +0 -0
  46. data/test/fixtures/api/film_times/71-16477.plist +0 -0
  47. data/test/fixtures/api/film_times/71-16478.plist +0 -0
  48. data/test/fixtures/api/film_times/71-16480.plist +0 -0
  49. data/test/fixtures/api/film_times/71-16482.plist +0 -0
  50. data/test/fixtures/api/film_times/71-16489.plist +0 -0
  51. data/test/lib/odeon_uk/cinema_test.rb +154 -373
  52. data/test/lib/odeon_uk/{api/response_test.rb → internal/api_response_test.rb} +7 -4
  53. data/test/lib/odeon_uk/performance_test.rb +149 -0
  54. data/test/lib/odeon_uk/version_test.rb +3 -5
  55. data/test/support/api_fixtures_helper.rb +9 -3
  56. data/test/support/fake_api_response.rb +17 -0
  57. data/test/test_helper.rb +9 -3
  58. metadata +89 -145
  59. data/.rdoc_options +0 -16
  60. data/lib/odeon_uk/api/cinema.rb +0 -67
  61. data/lib/odeon_uk/api/screenings.rb +0 -103
  62. data/lib/odeon_uk/configuration.rb +0 -21
  63. data/lib/odeon_uk/html/cinema.rb +0 -101
  64. data/lib/odeon_uk/html/parser/film_with_screenings.rb +0 -160
  65. data/lib/odeon_uk/html/screenings.rb +0 -38
  66. data/lib/odeon_uk/html/website.rb +0 -38
  67. data/lib/odeon_uk/screening.rb +0 -71
  68. data/test/fixtures/api/film_times/71-100747.plist +0 -0
  69. data/test/fixtures/api/film_times/71-100750.plist +0 -0
  70. data/test/fixtures/api/film_times/71-100790.plist +0 -0
  71. data/test/fixtures/api/film_times/71-14646.plist +0 -0
  72. data/test/fixtures/api/film_times/71-14725.plist +0 -0
  73. data/test/fixtures/api/film_times/71-15086.plist +0 -0
  74. data/test/fixtures/api/film_times/71-15096.plist +0 -0
  75. data/test/fixtures/api/film_times/71-15122.plist +0 -0
  76. data/test/fixtures/api/film_times/71-15130.plist +0 -0
  77. data/test/fixtures/api/film_times/71-15141.plist +0 -0
  78. data/test/fixtures/api/film_times/71-15142.plist +0 -0
  79. data/test/fixtures/api/film_times/71-15143.plist +0 -0
  80. data/test/fixtures/api/film_times/71-15144.plist +0 -0
  81. data/test/fixtures/api/film_times/71-15145.plist +0 -0
  82. data/test/fixtures/api/film_times/71-15170.plist +0 -0
  83. data/test/fixtures/api/film_times/71-15172.plist +0 -0
  84. data/test/fixtures/api/film_times/71-15177.plist +0 -0
  85. data/test/fixtures/api/film_times/71-15179.plist +0 -0
  86. data/test/fixtures/api/film_times/71-15182.plist +0 -0
  87. data/test/fixtures/api/film_times/71-15286.plist +0 -0
  88. data/test/fixtures/api/film_times/71-15360.plist +0 -0
  89. data/test/fixtures/api/film_times/71-15586.plist +0 -0
  90. data/test/fixtures/api/film_times/71-15700.plist +0 -0
  91. data/test/fixtures/api/film_times/71-15718.plist +0 -0
  92. data/test/fixtures/api/film_times/71-15768.plist +0 -0
  93. data/test/fixtures/api/film_times/71-15788.plist +0 -0
  94. data/test/fixtures/api/film_times/71-15793.plist +0 -0
  95. data/test/fixtures/api/film_times/71-15794.plist +0 -0
  96. data/test/fixtures/api/film_times/71-15795.plist +0 -0
  97. data/test/fixtures/api/film_times/71-15796.plist +0 -0
  98. data/test/fixtures/api/film_times/71-15799.plist +0 -0
  99. data/test/fixtures/api/film_times/71-15802.plist +0 -0
  100. data/test/fixtures/api/film_times/71-15814.plist +0 -0
  101. data/test/fixtures/api/film_times/71-15817.plist +0 -0
  102. data/test/fixtures/api/film_times/71-15840.plist +0 -0
  103. data/test/fixtures/html/cinema/105.html +0 -2622
  104. data/test/fixtures/html/cinema/211.html +0 -3241
  105. data/test/fixtures/html/cinema/71.html +0 -3448
  106. data/test/fixtures/html/showtimes/11-imax.html +0 -170
  107. data/test/fixtures/html/showtimes/171-d-box.html +0 -203
  108. data/test/fixtures/html/showtimes/71-0.html +0 -59
  109. data/test/fixtures/html/showtimes/71.html +0 -2395
  110. data/test/fixtures/html/sitemap.html +0 -1303
  111. data/test/lib/odeon_uk/api/cinema_test.rb +0 -165
  112. data/test/lib/odeon_uk/api/screenings_test.rb +0 -58
  113. data/test/lib/odeon_uk/configuration_test.rb +0 -29
  114. data/test/lib/odeon_uk/html/cinema_test.rb +0 -149
  115. data/test/lib/odeon_uk/html/parser/film_with_screenings_test.rb +0 -97
  116. data/test/lib/odeon_uk/html/screenings_test.rb +0 -44
  117. data/test/lib/odeon_uk/html/website_test.rb +0 -67
  118. data/test/lib/odeon_uk/screening_test.rb +0 -92
  119. data/test/support/website_fixtures_helper.rb +0 -30
@@ -0,0 +1,34 @@
1
+ module OdeonUk
2
+ # @api private
3
+ module Internal
4
+ module Parser
5
+ module Api
6
+ # Parses a string to derive address
7
+ class FilmLookup
8
+ # @param [Integer] cinema_id id of the cinema
9
+ # @return [Hash{Integer => OdeonUk::Internal::Parser::Api::Film}]
10
+ # contains all films keyed by id for a cinema
11
+ def at(cinema_id)
12
+ to_hash.select do |_, film_hash|
13
+ film_hash['sites'].include?(cinema_id)
14
+ end
15
+ end
16
+
17
+ # @return [Hash{Integer => OdeonUk::Internal::Parser::Api::Film}]
18
+ # contains all films & upcoming films keyed by id
19
+ def to_hash
20
+ @to_hash ||= api.each_with_object({}) do |film_hash, result|
21
+ result[film_hash['filmMasterId'].to_i] = film_hash
22
+ end
23
+ end
24
+
25
+ private
26
+
27
+ def api
28
+ @api ||= OdeonUk::Internal::ApiResponse.new.app_init['films']
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,92 @@
1
+ module OdeonUk
2
+ # @api private
3
+ module Internal
4
+ module Parser
5
+ module Api
6
+ # A single day of performances for a particular film
7
+ class PerformanceDay
8
+ def initialize(data)
9
+ @data = data
10
+ end
11
+
12
+ def to_a
13
+ performance_kinds.each_with_index.flat_map do |_, index|
14
+ starting_times(index).map do |time|
15
+ {
16
+ dimension: dimension(index),
17
+ starting_at: TimeParser.new(date, time).to_utc,
18
+ variant: variant(index)
19
+ }
20
+ end
21
+ end
22
+ end
23
+
24
+ private
25
+
26
+ def date
27
+ @data['date']
28
+ end
29
+
30
+ def dimension(index)
31
+ performance_kind(index).include?('3D') ? '3d' : '2d'
32
+ end
33
+
34
+ def performance_kinds
35
+ @data['attributes']
36
+ end
37
+
38
+ def performance_kind(index)
39
+ performance_kinds[index]['attribute']
40
+ end
41
+
42
+ def starting_times(index)
43
+ performance_kinds[index]['showtimes'][0].map do |h|
44
+ h['performanceTime']
45
+ end
46
+ end
47
+
48
+ def variant(index)
49
+ {
50
+ 'Culture' => 'arts',
51
+ 'Kids' => 'kids',
52
+ 'IMAX' => 'imax',
53
+ 'Newbies' => 'baby',
54
+ 'Silver Cinema' => 'senior'
55
+ }.select { |k, _| performance_kind(index).include?(k) }.values.uniq
56
+ end
57
+
58
+ # parse a time to utc time
59
+ TimeParser = Struct.new(:date, :time) do
60
+ def to_utc
61
+ tz.local_to_utc(parsed_time)
62
+ end
63
+
64
+ private
65
+
66
+ def early_morning_screening?
67
+ time.match(/\A00/)
68
+ end
69
+
70
+ def parsed_date
71
+ case date
72
+ when 'Today' then Time.now.strftime '%Y-%m-%d'
73
+ when 'Tomorrow' then (Time.now + 60 * 60 * 24).strftime '%Y-%m-%d'
74
+ else date.gsub('.', '').match(/\d+\s\w+\z/)[0]
75
+ end
76
+ end
77
+
78
+ def parsed_time
79
+ parsed_time = Time.parse("#{parsed_date} #{time} UTC")
80
+ # Odeon deliberately mislabel their 00:01 screenings as the day before
81
+ early_morning_screening? ? parsed_time + 60 * 60 * 24 : parsed_time
82
+ end
83
+
84
+ def tz
85
+ @tz ||= TZInfo::Timezone.get('Europe/London')
86
+ end
87
+ end
88
+ end
89
+ end
90
+ end
91
+ end
92
+ end
@@ -3,49 +3,44 @@ module OdeonUk
3
3
  # @api private
4
4
  module Internal
5
5
  # Sanitize and standardize film titles
6
- class TitleSanitizer
7
- # strings and regex to be removed
8
- REMOVE = [
9
- /\s+[23][dD]/, # dimension
10
- 'Autism Friendly Screening -', # autism screening
11
- /\ACinemagic \d{1,4} \-/, # cinemagic
12
- /\(encore.+\)/i, # encore for NT Live
13
- /\(live\)/i, # live in brackets
14
- 'UKJFF -', # UK Jewish festival prefix
15
- /\bsing\-?a\-?long\b/i, # singalong
16
- 'Autism Friendly - ', # autism friendly
17
- 'amp;', # html ampersands
18
- ]
6
+ class TitleSanitizer < Cinebase::TitleSanitizer
7
+ # @!method initialize(title)
8
+ # Constructor
9
+ # @param [String] title a film title
10
+ # @return [CineworldUk::Internal::TitleSanitizer]
19
11
 
20
- # regexes and their replacements
21
- REPLACE = {
22
- /Bolshoi - (.*)/ => 'Bolshoi: ',
23
- /Globe On Screen: (.*)/ => 'Globe: ',
24
- /Met Opera - (.*)/ => 'Met Opera: ',
25
- /National Theatre Live - (.*)/ => 'National Theatre: ',
26
- /NT Live - (.*)/ => 'National Theatre: ',
27
- /ROH - (.*)/ => 'Royal Opera House: ',
28
- /(.*)\- RSC Live \d{1,4}/ => 'Royal Shakespeare Company: '
29
- }
12
+ # @!method sanitized
13
+ # sanitized and standardized title
14
+ # @return [String] sanitised title
15
+
16
+ private
30
17
 
31
- # @param [String] title a film title
32
- def initialize(title)
33
- @title = title
18
+ # strings and regex to be removed
19
+ def remove
20
+ [
21
+ /\s+[23][dD]/, # dimension
22
+ 'Autism Friendly Screening -', # autism screening
23
+ /\ACinemagic \d{1,4} \-/, # cinemagic
24
+ /\(encore.+\)/i, # encore for NT Live
25
+ /\(live\)/i, # live in brackets
26
+ 'UKJFF -', # UK Jewish festival prefix
27
+ /\bsing\-?a\-?long\b/i, # singalong
28
+ 'Autism Friendly - ', # autism friendly
29
+ 'amp;', # html ampersands
30
+ ]
34
31
  end
35
32
 
36
- # sanitized and standardized title
37
- # @return [String] title
38
- def sanitized
39
- @sanitzed ||= begin
40
- sanitized = @title
41
- REMOVE.each do |pattern|
42
- sanitized.gsub! pattern, ''
43
- end
44
- REPLACE.each do |pattern, prefix|
45
- sanitized.gsub!(pattern) { |_| prefix + $1 }
46
- end
47
- sanitized.squeeze(' ').strip
48
- end
33
+ # regexes and their replacements
34
+ def replace
35
+ {
36
+ /Bolshoi - (.*)/ => 'Bolshoi: ',
37
+ /Globe On Screen: (.*)/ => 'Globe: ',
38
+ /Met Opera - (.*)/ => 'Met Opera: ',
39
+ /National Theatre Live - (.*)/ => 'National Theatre: ',
40
+ /NT Live - (.*)/ => 'National Theatre: ',
41
+ /ROH - (.*)/ => 'Royal Opera House: ',
42
+ /(.*)\- RSC Live \d{1,4}/ => 'Royal Shakespeare Company: '
43
+ }
49
44
  end
50
45
  end
51
46
  end
@@ -0,0 +1,87 @@
1
+ module OdeonUk
2
+ # The object representing a single screening of a film on the Odeon UK website
3
+ class Performance < Cinebase::Performance
4
+ # @!attribute [r] booking_url
5
+ # @return [String] the booking URL on the cinema website
6
+ # @!attribute [r] cinema_name
7
+ # @return [String] the cinema name
8
+ # @!attribute [r] cinema_id
9
+ # @return [String] the cinema id
10
+ # @!attribute [r] dimension
11
+ # @return [String] 2d or 3d
12
+ # @!attribute [r] film_name
13
+ # @return [String] the film name
14
+
15
+ # @!method initialize(options)
16
+ # @param [Hash] options options hash
17
+ # @option options [String] :booking_url (nil) buying url for the screening
18
+ # @option options [String] :cinema_name name of the cinema
19
+ # @option options [String] :cinema_id website id of the cinema
20
+ # @option options [String] :dimension ('2d') dimension of the screening
21
+ # @option options [String] :film_name name of the film
22
+ # @option options [Time] :starting_at listed start time of the performance
23
+
24
+ # All currently listed films showing at a cinema
25
+ # @param [Integer] cinema_id id of the cinema on the website
26
+ # @return [Array<OdeonUk::Performance>]
27
+ def self.at(cinema_id)
28
+ film_ids_at(cinema_id).flat_map do |film_id|
29
+ api_response.film_times(cinema_id, film_id).flat_map do |day|
30
+ performance_days(day).map do |hash|
31
+ new(hash.merge(cinema_hash(cinema_id))
32
+ .merge(film_name: film_name(film_id)))
33
+ end
34
+ end
35
+ end
36
+ end
37
+
38
+ # @!method showing_on
39
+ # The date of the screening
40
+ # @return [Date]
41
+
42
+ # @!method starting_at
43
+ # UTC time of the screening
44
+ # @return [Time]
45
+
46
+ # @!method variant
47
+ # The kinds of screening (IMAX, kids, baby, senior)
48
+ # @return <Array[String]>
49
+
50
+ # private
51
+
52
+ def self.api_response
53
+ @api_response ||= OdeonUk::Internal::ApiResponse.new
54
+ end
55
+ private_class_method :api_response
56
+
57
+ def self.cinema_hash(cinema_id)
58
+ { cinema_id: cinema_id, cinema_name: Cinema.new(cinema_id).name }
59
+ end
60
+ private_class_method :cinema_hash
61
+
62
+ def self.films_at(cinema_id)
63
+ film_lookup.at(cinema_id)
64
+ end
65
+ private_class_method :films_at
66
+
67
+ def self.film_lookup
68
+ @film_lookup ||= OdeonUk::Internal::Parser::Api::FilmLookup.new
69
+ end
70
+ private_class_method :film_lookup
71
+
72
+ def self.film_ids_at(cinema_id)
73
+ films_at(cinema_id).keys
74
+ end
75
+ private_class_method :film_ids_at
76
+
77
+ def self.film_name(film_id)
78
+ film_lookup.to_hash[film_id]['title']
79
+ end
80
+ private_class_method :film_name
81
+
82
+ def self.performance_days(data)
83
+ OdeonUk::Internal::Parser::Api::PerformanceDay.new(data).to_a
84
+ end
85
+ private_class_method :performance_days
86
+ end
87
+ end
@@ -1,6 +1,6 @@
1
1
  # Ruby interface for http://www.odeon.co.uk
2
- # @version 3.0.6
2
+ # @version 4.0.0
3
3
  module OdeonUk
4
4
  # Gem version
5
- VERSION = '3.0.6'
5
+ VERSION = '4.0.0'.freeze
6
6
  end
data/odeon_uk.gemspec CHANGED
@@ -1,29 +1,27 @@
1
- # -*- encoding: utf-8 -*-
2
1
  lib = File.expand_path('../lib', __FILE__)
3
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
3
  require 'odeon_uk/version'
5
4
 
6
- Gem::Specification.new do |gem|
7
- gem.name = "odeon_uk"
8
- gem.version = OdeonUk::VERSION
9
- gem.authors = ["Andy Croll"]
10
- gem.email = ["andy@goodscary.com"]
11
- gem.description = %q{An API to pull movie information from the ODEON.co.uk website}
12
- gem.summary = %q{It's a scraper, but a nice one}
13
- gem.homepage = "http://github.com/andycroll/odeon_uk"
14
- gem.license = "MIT"
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'odeon_uk'
7
+ spec.version = OdeonUk::VERSION
8
+ spec.authors = ['Andy Croll']
9
+ spec.email = ['andy@goodscary.com']
10
+ spec.description = 'Pull movie & cinema information from the Odeon iOS API'
11
+ spec.summary = "It's a scraper, but a nice one"
12
+ spec.homepage = 'http://github.com/andycroll/odeon_uk'
13
+ spec.licenses = %w(AGPL MIT)
15
14
 
16
- gem.files = `git ls-files`.split($/)
17
- gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
18
- gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
19
- gem.require_paths = ["lib"]
15
+ spec.files = `git ls-files`.split($RS)
16
+ spec.executables = spec.files.grep(%r{^bin/}).map { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ['lib']
20
19
 
21
- gem.add_development_dependency 'rake'
22
- gem.add_development_dependency 'minitest-reporters'
23
- gem.add_development_dependency 'webmock'
20
+ spec.add_development_dependency 'codeclimate-test-reporter'
21
+ spec.add_development_dependency 'minitest-reporters'
22
+ spec.add_development_dependency 'rake'
23
+ spec.add_development_dependency 'webmock'
24
24
 
25
- gem.add_runtime_dependency 'CFPropertyList'
26
- gem.add_runtime_dependency 'nokogiri'
27
- gem.add_runtime_dependency 'tzinfo'
28
- gem.add_runtime_dependency 'tzinfo-data'
25
+ spec.add_runtime_dependency 'CFPropertyList'
26
+ spec.add_runtime_dependency 'cinebase', '~> 3.0'
29
27
  end
@@ -9,7 +9,7 @@ module FixtureCreator
9
9
  end
10
10
 
11
11
  def film_times!(cinema_id)
12
- OdeonUk::Api::Screenings.send(:film_ids, cinema_id).each do |i|
12
+ OdeonUk::Performance.send(:film_ids_at, cinema_id).each do |i|
13
13
  write_film_times_fixture(cinema_id, i)
14
14
  end
15
15
  end
@@ -29,9 +29,9 @@ module FixtureCreator
29
29
  text = "film_times/#{cinema_id}-#{film_id}"
30
30
  File.open(fixture(text), 'w+') do |file|
31
31
  log(text)
32
- file.write OdeonUk::Api::Response.new.send(:film_times_raw,
33
- cinema_id,
34
- film_id)
32
+ file.write OdeonUk::Internal::ApiResponse.new.send(:film_times_raw,
33
+ cinema_id,
34
+ film_id)
35
35
  end
36
36
  end
37
37
 
@@ -39,59 +39,7 @@ module FixtureCreator
39
39
  FileUtils.mkdir_p kind.to_s
40
40
  File.open(fixture(kind), 'w+') do |file|
41
41
  log(kind)
42
- file.write OdeonUk::Api::Response.new.send("#{kind}_raw".to_sym)
43
- end
44
- end
45
- end
46
-
47
- class Html < Struct.new(:cinema_id)
48
- def cinema!
49
- write_page_fixture(:cinema)
50
- end
51
-
52
- def film_node!(index)
53
- write_node_fixture(index)
54
- end
55
-
56
- def showtimes!
57
- write_page_fixture(:showtimes)
58
- end
59
-
60
- def sitemap!
61
- write_page_fixture(:sitemap)
62
- end
63
-
64
- private
65
-
66
- def fixture(name)
67
- File.expand_path("../../test/fixtures/html/#{name}.html", __FILE__)
68
- end
69
-
70
- def log(message)
71
- puts "Create HTML fixture: #{message}"
72
- end
73
-
74
- def write_node_fixture(index)
75
- FileUtils.mkdir_p 'showtimes'
76
- text = "showtimes/#{cinema_id}-#{index}"
77
- File.open(fixture(text), 'w+') do |file|
78
- log(text)
79
- nodes = OdeonUk::Html::Screenings.send(:film_nodes, cinema_id)
80
- node = if index.is_a?(Fixnum)
81
- nodes[index]
82
- else
83
- nodes.select { |n| !!n.to_s.match(/#{index}/i) }[0]
84
- end
85
- file.write(node.to_s)
86
- end
87
- end
88
-
89
- def write_page_fixture(kind)
90
- FileUtils.mkdir_p kind.to_s
91
- text = kind.to_s + (cinema_id ? "/#{cinema_id}" : '')
92
- File.open(fixture(text), 'w+') do |file|
93
- log(text)
94
- file.write OdeonUk::Html::Website.new.send(*[kind, cinema_id].compact)
42
+ file.write OdeonUk::Internal::ApiResponse.new.send("#{kind}_raw".to_sym)
95
43
  end
96
44
  end
97
45
  end
Binary file
Binary file