odeon_uk 4.0.0 → 5.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.
- checksums.yaml +5 -5
- data/.github/workflows/test.yml +43 -0
- data/.gitignore +1 -1
- data/.ruby-version +1 -0
- data/CHANGELOG.md +33 -0
- data/README.md +90 -21
- data/Rakefile +14 -15
- data/lib/odeon_uk/cinema.rb +41 -23
- data/lib/odeon_uk/internal/api_response.rb +19 -39
- data/lib/odeon_uk/internal/guest_token.rb +23 -0
- data/lib/odeon_uk/internal/parser/api/showtime.rb +80 -0
- data/lib/odeon_uk/internal/title_sanitizer.rb +3 -8
- data/lib/odeon_uk/performance.rb +34 -40
- data/lib/odeon_uk/version.rb +3 -3
- data/lib/odeon_uk.rb +16 -2
- data/odeon_uk.gemspec +10 -6
- data/test/fixtures/api/showtimes-824.json +66 -0
- data/test/fixtures/api/sites.json +32 -0
- data/test/lib/odeon_uk/cinema_test.rb +66 -215
- data/test/lib/odeon_uk/internal/api_response_test.rb +48 -29
- data/test/lib/odeon_uk/internal/fixture_shape_test.rb +14 -0
- data/test/lib/odeon_uk/internal/guest_token_test.rb +84 -0
- data/test/lib/odeon_uk/internal/parser/api/showtime_test.rb +68 -0
- data/test/lib/odeon_uk/internal/title_sanitizer_test.rb +109 -89
- data/test/lib/odeon_uk/performance_test.rb +124 -123
- data/test/lib/odeon_uk/version_test.rb +3 -3
- data/test/live/api_shape_test.rb +19 -0
- data/test/live/integration_test.rb +21 -0
- data/test/live/live_helper.rb +11 -0
- data/test/package_test.rb +56 -0
- data/test/support/api_fixtures_helper.rb +5 -30
- data/test/support/api_shapes.rb +46 -0
- data/test/support/fake_api_response.rb +9 -6
- data/test/test_helper.rb +6 -3
- metadata +66 -89
- data/.travis.yml +0 -7
- data/lib/odeon_uk/internal/parser/api/film_lookup.rb +0 -34
- data/lib/odeon_uk/internal/parser/api/performance_day.rb +0 -92
- data/rake/fixture_creator.rb +0 -46
- data/test/fixtures/api/all_cinemas.plist +0 -0
- data/test/fixtures/api/app_init.plist +0 -0
- data/test/fixtures/api/film_times/71-14876.plist +0 -0
- data/test/fixtures/api/film_times/71-15408.plist +0 -0
- data/test/fixtures/api/film_times/71-15684.plist +0 -0
- data/test/fixtures/api/film_times/71-15866.plist +0 -0
- data/test/fixtures/api/film_times/71-15868.plist +0 -0
- data/test/fixtures/api/film_times/71-15961.plist +0 -0
- data/test/fixtures/api/film_times/71-15963.plist +0 -0
- data/test/fixtures/api/film_times/71-15965.plist +0 -0
- data/test/fixtures/api/film_times/71-15967.plist +0 -0
- data/test/fixtures/api/film_times/71-15969.plist +0 -0
- data/test/fixtures/api/film_times/71-15977.plist +0 -0
- data/test/fixtures/api/film_times/71-15980.plist +0 -0
- data/test/fixtures/api/film_times/71-16037.plist +0 -0
- data/test/fixtures/api/film_times/71-16136.plist +0 -0
- data/test/fixtures/api/film_times/71-16142.plist +0 -0
- data/test/fixtures/api/film_times/71-16143.plist +0 -0
- data/test/fixtures/api/film_times/71-16187.plist +0 -0
- data/test/fixtures/api/film_times/71-16369.plist +0 -0
- data/test/fixtures/api/film_times/71-16370.plist +0 -0
- data/test/fixtures/api/film_times/71-16374.plist +0 -0
- data/test/fixtures/api/film_times/71-16386.plist +0 -0
- data/test/fixtures/api/film_times/71-16387.plist +0 -0
- data/test/fixtures/api/film_times/71-16388.plist +0 -0
- data/test/fixtures/api/film_times/71-16438.plist +0 -0
- data/test/fixtures/api/film_times/71-16454.plist +0 -0
- data/test/fixtures/api/film_times/71-16457.plist +0 -0
- data/test/fixtures/api/film_times/71-16477.plist +0 -0
- data/test/fixtures/api/film_times/71-16478.plist +0 -0
- data/test/fixtures/api/film_times/71-16480.plist +0 -0
- data/test/fixtures/api/film_times/71-16482.plist +0 -0
- data/test/fixtures/api/film_times/71-16489.plist +0 -0
metadata
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: odeon_uk
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 5.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Andy Croll
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
|
-
name:
|
|
13
|
+
name: base64
|
|
15
14
|
requirement: !ruby/object:Gem::Requirement
|
|
16
15
|
requirements:
|
|
17
16
|
- - ">="
|
|
@@ -25,7 +24,21 @@ dependencies:
|
|
|
25
24
|
- !ruby/object:Gem::Version
|
|
26
25
|
version: '0'
|
|
27
26
|
- !ruby/object:Gem::Dependency
|
|
28
|
-
name:
|
|
27
|
+
name: bundler
|
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - ">="
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '2.0'
|
|
33
|
+
type: :development
|
|
34
|
+
prerelease: false
|
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - ">="
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '2.0'
|
|
40
|
+
- !ruby/object:Gem::Dependency
|
|
41
|
+
name: minitest-mock
|
|
29
42
|
requirement: !ruby/object:Gem::Requirement
|
|
30
43
|
requirements:
|
|
31
44
|
- - ">="
|
|
@@ -39,7 +52,7 @@ dependencies:
|
|
|
39
52
|
- !ruby/object:Gem::Version
|
|
40
53
|
version: '0'
|
|
41
54
|
- !ruby/object:Gem::Dependency
|
|
42
|
-
name:
|
|
55
|
+
name: minitest-reporters
|
|
43
56
|
requirement: !ruby/object:Gem::Requirement
|
|
44
57
|
requirements:
|
|
45
58
|
- - ">="
|
|
@@ -53,7 +66,7 @@ dependencies:
|
|
|
53
66
|
- !ruby/object:Gem::Version
|
|
54
67
|
version: '0'
|
|
55
68
|
- !ruby/object:Gem::Dependency
|
|
56
|
-
name:
|
|
69
|
+
name: rake
|
|
57
70
|
requirement: !ruby/object:Gem::Requirement
|
|
58
71
|
requirements:
|
|
59
72
|
- - ">="
|
|
@@ -67,13 +80,27 @@ dependencies:
|
|
|
67
80
|
- !ruby/object:Gem::Version
|
|
68
81
|
version: '0'
|
|
69
82
|
- !ruby/object:Gem::Dependency
|
|
70
|
-
name:
|
|
83
|
+
name: simplecov
|
|
84
|
+
requirement: !ruby/object:Gem::Requirement
|
|
85
|
+
requirements:
|
|
86
|
+
- - "<"
|
|
87
|
+
- !ruby/object:Gem::Version
|
|
88
|
+
version: '1'
|
|
89
|
+
type: :development
|
|
90
|
+
prerelease: false
|
|
91
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
92
|
+
requirements:
|
|
93
|
+
- - "<"
|
|
94
|
+
- !ruby/object:Gem::Version
|
|
95
|
+
version: '1'
|
|
96
|
+
- !ruby/object:Gem::Dependency
|
|
97
|
+
name: webmock
|
|
71
98
|
requirement: !ruby/object:Gem::Requirement
|
|
72
99
|
requirements:
|
|
73
100
|
- - ">="
|
|
74
101
|
- !ruby/object:Gem::Version
|
|
75
102
|
version: '0'
|
|
76
|
-
type: :
|
|
103
|
+
type: :development
|
|
77
104
|
prerelease: false
|
|
78
105
|
version_requirements: !ruby/object:Gem::Requirement
|
|
79
106
|
requirements:
|
|
@@ -86,23 +113,24 @@ dependencies:
|
|
|
86
113
|
requirements:
|
|
87
114
|
- - "~>"
|
|
88
115
|
- !ruby/object:Gem::Version
|
|
89
|
-
version: '
|
|
116
|
+
version: '5.2'
|
|
90
117
|
type: :runtime
|
|
91
118
|
prerelease: false
|
|
92
119
|
version_requirements: !ruby/object:Gem::Requirement
|
|
93
120
|
requirements:
|
|
94
121
|
- - "~>"
|
|
95
122
|
- !ruby/object:Gem::Version
|
|
96
|
-
version: '
|
|
97
|
-
description: Pull movie & cinema information from the
|
|
123
|
+
version: '5.2'
|
|
124
|
+
description: Pull movie & cinema information from the ODEON Vista API
|
|
98
125
|
email:
|
|
99
126
|
- andy@goodscary.com
|
|
100
127
|
executables: []
|
|
101
128
|
extensions: []
|
|
102
129
|
extra_rdoc_files: []
|
|
103
130
|
files:
|
|
131
|
+
- ".github/workflows/test.yml"
|
|
104
132
|
- ".gitignore"
|
|
105
|
-
- ".
|
|
133
|
+
- ".ruby-version"
|
|
106
134
|
- CHANGELOG.md
|
|
107
135
|
- COMM-LICENSE
|
|
108
136
|
- Gemfile
|
|
@@ -112,60 +140,35 @@ files:
|
|
|
112
140
|
- lib/odeon_uk.rb
|
|
113
141
|
- lib/odeon_uk/cinema.rb
|
|
114
142
|
- lib/odeon_uk/internal/api_response.rb
|
|
115
|
-
- lib/odeon_uk/internal/
|
|
116
|
-
- lib/odeon_uk/internal/parser/api/
|
|
143
|
+
- lib/odeon_uk/internal/guest_token.rb
|
|
144
|
+
- lib/odeon_uk/internal/parser/api/showtime.rb
|
|
117
145
|
- lib/odeon_uk/internal/title_sanitizer.rb
|
|
118
146
|
- lib/odeon_uk/performance.rb
|
|
119
147
|
- lib/odeon_uk/version.rb
|
|
120
148
|
- odeon_uk.gemspec
|
|
121
|
-
-
|
|
122
|
-
- test/fixtures/api/
|
|
123
|
-
- test/fixtures/api/app_init.plist
|
|
124
|
-
- test/fixtures/api/film_times/71-14876.plist
|
|
125
|
-
- test/fixtures/api/film_times/71-15408.plist
|
|
126
|
-
- test/fixtures/api/film_times/71-15684.plist
|
|
127
|
-
- test/fixtures/api/film_times/71-15866.plist
|
|
128
|
-
- test/fixtures/api/film_times/71-15868.plist
|
|
129
|
-
- test/fixtures/api/film_times/71-15961.plist
|
|
130
|
-
- test/fixtures/api/film_times/71-15963.plist
|
|
131
|
-
- test/fixtures/api/film_times/71-15965.plist
|
|
132
|
-
- test/fixtures/api/film_times/71-15967.plist
|
|
133
|
-
- test/fixtures/api/film_times/71-15969.plist
|
|
134
|
-
- test/fixtures/api/film_times/71-15977.plist
|
|
135
|
-
- test/fixtures/api/film_times/71-15980.plist
|
|
136
|
-
- test/fixtures/api/film_times/71-16037.plist
|
|
137
|
-
- test/fixtures/api/film_times/71-16136.plist
|
|
138
|
-
- test/fixtures/api/film_times/71-16142.plist
|
|
139
|
-
- test/fixtures/api/film_times/71-16143.plist
|
|
140
|
-
- test/fixtures/api/film_times/71-16187.plist
|
|
141
|
-
- test/fixtures/api/film_times/71-16369.plist
|
|
142
|
-
- test/fixtures/api/film_times/71-16370.plist
|
|
143
|
-
- test/fixtures/api/film_times/71-16374.plist
|
|
144
|
-
- test/fixtures/api/film_times/71-16386.plist
|
|
145
|
-
- test/fixtures/api/film_times/71-16387.plist
|
|
146
|
-
- test/fixtures/api/film_times/71-16388.plist
|
|
147
|
-
- test/fixtures/api/film_times/71-16438.plist
|
|
148
|
-
- test/fixtures/api/film_times/71-16454.plist
|
|
149
|
-
- test/fixtures/api/film_times/71-16457.plist
|
|
150
|
-
- test/fixtures/api/film_times/71-16477.plist
|
|
151
|
-
- test/fixtures/api/film_times/71-16478.plist
|
|
152
|
-
- test/fixtures/api/film_times/71-16480.plist
|
|
153
|
-
- test/fixtures/api/film_times/71-16482.plist
|
|
154
|
-
- test/fixtures/api/film_times/71-16489.plist
|
|
149
|
+
- test/fixtures/api/showtimes-824.json
|
|
150
|
+
- test/fixtures/api/sites.json
|
|
155
151
|
- test/lib/odeon_uk/cinema_test.rb
|
|
156
152
|
- test/lib/odeon_uk/internal/api_response_test.rb
|
|
153
|
+
- test/lib/odeon_uk/internal/fixture_shape_test.rb
|
|
154
|
+
- test/lib/odeon_uk/internal/guest_token_test.rb
|
|
155
|
+
- test/lib/odeon_uk/internal/parser/api/showtime_test.rb
|
|
157
156
|
- test/lib/odeon_uk/internal/title_sanitizer_test.rb
|
|
158
157
|
- test/lib/odeon_uk/performance_test.rb
|
|
159
158
|
- test/lib/odeon_uk/version_test.rb
|
|
159
|
+
- test/live/api_shape_test.rb
|
|
160
|
+
- test/live/integration_test.rb
|
|
161
|
+
- test/live/live_helper.rb
|
|
162
|
+
- test/package_test.rb
|
|
160
163
|
- test/support/api_fixtures_helper.rb
|
|
164
|
+
- test/support/api_shapes.rb
|
|
161
165
|
- test/support/fake_api_response.rb
|
|
162
166
|
- test/test_helper.rb
|
|
163
|
-
homepage:
|
|
167
|
+
homepage: https://github.com/andycroll/odeon_uk
|
|
164
168
|
licenses:
|
|
165
169
|
- AGPL
|
|
166
170
|
- MIT
|
|
167
171
|
metadata: {}
|
|
168
|
-
post_install_message:
|
|
169
172
|
rdoc_options: []
|
|
170
173
|
require_paths:
|
|
171
174
|
- lib
|
|
@@ -173,58 +176,32 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
173
176
|
requirements:
|
|
174
177
|
- - ">="
|
|
175
178
|
- !ruby/object:Gem::Version
|
|
176
|
-
version: '
|
|
179
|
+
version: '3.4'
|
|
177
180
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
178
181
|
requirements:
|
|
179
182
|
- - ">="
|
|
180
183
|
- !ruby/object:Gem::Version
|
|
181
184
|
version: '0'
|
|
182
185
|
requirements: []
|
|
183
|
-
|
|
184
|
-
rubygems_version: 2.4.5
|
|
185
|
-
signing_key:
|
|
186
|
+
rubygems_version: 4.0.20
|
|
186
187
|
specification_version: 4
|
|
187
188
|
summary: It's a scraper, but a nice one
|
|
188
189
|
test_files:
|
|
189
|
-
- test/fixtures/api/
|
|
190
|
-
- test/fixtures/api/
|
|
191
|
-
- test/fixtures/api/film_times/71-14876.plist
|
|
192
|
-
- test/fixtures/api/film_times/71-15408.plist
|
|
193
|
-
- test/fixtures/api/film_times/71-15684.plist
|
|
194
|
-
- test/fixtures/api/film_times/71-15866.plist
|
|
195
|
-
- test/fixtures/api/film_times/71-15868.plist
|
|
196
|
-
- test/fixtures/api/film_times/71-15961.plist
|
|
197
|
-
- test/fixtures/api/film_times/71-15963.plist
|
|
198
|
-
- test/fixtures/api/film_times/71-15965.plist
|
|
199
|
-
- test/fixtures/api/film_times/71-15967.plist
|
|
200
|
-
- test/fixtures/api/film_times/71-15969.plist
|
|
201
|
-
- test/fixtures/api/film_times/71-15977.plist
|
|
202
|
-
- test/fixtures/api/film_times/71-15980.plist
|
|
203
|
-
- test/fixtures/api/film_times/71-16037.plist
|
|
204
|
-
- test/fixtures/api/film_times/71-16136.plist
|
|
205
|
-
- test/fixtures/api/film_times/71-16142.plist
|
|
206
|
-
- test/fixtures/api/film_times/71-16143.plist
|
|
207
|
-
- test/fixtures/api/film_times/71-16187.plist
|
|
208
|
-
- test/fixtures/api/film_times/71-16369.plist
|
|
209
|
-
- test/fixtures/api/film_times/71-16370.plist
|
|
210
|
-
- test/fixtures/api/film_times/71-16374.plist
|
|
211
|
-
- test/fixtures/api/film_times/71-16386.plist
|
|
212
|
-
- test/fixtures/api/film_times/71-16387.plist
|
|
213
|
-
- test/fixtures/api/film_times/71-16388.plist
|
|
214
|
-
- test/fixtures/api/film_times/71-16438.plist
|
|
215
|
-
- test/fixtures/api/film_times/71-16454.plist
|
|
216
|
-
- test/fixtures/api/film_times/71-16457.plist
|
|
217
|
-
- test/fixtures/api/film_times/71-16477.plist
|
|
218
|
-
- test/fixtures/api/film_times/71-16478.plist
|
|
219
|
-
- test/fixtures/api/film_times/71-16480.plist
|
|
220
|
-
- test/fixtures/api/film_times/71-16482.plist
|
|
221
|
-
- test/fixtures/api/film_times/71-16489.plist
|
|
190
|
+
- test/fixtures/api/showtimes-824.json
|
|
191
|
+
- test/fixtures/api/sites.json
|
|
222
192
|
- test/lib/odeon_uk/cinema_test.rb
|
|
223
193
|
- test/lib/odeon_uk/internal/api_response_test.rb
|
|
194
|
+
- test/lib/odeon_uk/internal/fixture_shape_test.rb
|
|
195
|
+
- test/lib/odeon_uk/internal/guest_token_test.rb
|
|
196
|
+
- test/lib/odeon_uk/internal/parser/api/showtime_test.rb
|
|
224
197
|
- test/lib/odeon_uk/internal/title_sanitizer_test.rb
|
|
225
198
|
- test/lib/odeon_uk/performance_test.rb
|
|
226
199
|
- test/lib/odeon_uk/version_test.rb
|
|
200
|
+
- test/live/api_shape_test.rb
|
|
201
|
+
- test/live/integration_test.rb
|
|
202
|
+
- test/live/live_helper.rb
|
|
203
|
+
- test/package_test.rb
|
|
227
204
|
- test/support/api_fixtures_helper.rb
|
|
205
|
+
- test/support/api_shapes.rb
|
|
228
206
|
- test/support/fake_api_response.rb
|
|
229
207
|
- test/test_helper.rb
|
|
230
|
-
has_rdoc:
|
data/.travis.yml
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
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
|
|
@@ -1,92 +0,0 @@
|
|
|
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
|
data/rake/fixture_creator.rb
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
module FixtureCreator
|
|
2
|
-
class Api
|
|
3
|
-
def all_cinemas!
|
|
4
|
-
write_fixture(:all_cinemas)
|
|
5
|
-
end
|
|
6
|
-
|
|
7
|
-
def app_init!
|
|
8
|
-
write_fixture(:app_init)
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
def film_times!(cinema_id)
|
|
12
|
-
OdeonUk::Performance.send(:film_ids_at, cinema_id).each do |i|
|
|
13
|
-
write_film_times_fixture(cinema_id, i)
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
private
|
|
18
|
-
|
|
19
|
-
def fixture(name)
|
|
20
|
-
File.expand_path("../../test/fixtures/api/#{name}.plist", __FILE__)
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
def log(message)
|
|
24
|
-
puts "Create API fixture: #{message}"
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
def write_film_times_fixture(cinema_id, film_id)
|
|
28
|
-
FileUtils.mkdir_p 'film_times'
|
|
29
|
-
text = "film_times/#{cinema_id}-#{film_id}"
|
|
30
|
-
File.open(fixture(text), 'w+') do |file|
|
|
31
|
-
log(text)
|
|
32
|
-
file.write OdeonUk::Internal::ApiResponse.new.send(:film_times_raw,
|
|
33
|
-
cinema_id,
|
|
34
|
-
film_id)
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
def write_fixture(kind)
|
|
39
|
-
FileUtils.mkdir_p kind.to_s
|
|
40
|
-
File.open(fixture(kind), 'w+') do |file|
|
|
41
|
-
log(kind)
|
|
42
|
-
file.write OdeonUk::Internal::ApiResponse.new.send("#{kind}_raw".to_sym)
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
|
-
end
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|