picturehouse_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/ci.yml +26 -0
- data/.github/workflows/release.yml +26 -0
- data/.gitignore +1 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +25 -0
- data/Rakefile +2 -2
- data/lib/picturehouse_uk/cinema.rb +30 -14
- data/lib/picturehouse_uk/internal/api.rb +42 -0
- data/lib/picturehouse_uk/internal/parser/address.rb +21 -6
- data/lib/picturehouse_uk/internal/parser/screenings.rb +85 -133
- data/lib/picturehouse_uk/internal/website.rb +10 -12
- data/lib/picturehouse_uk/version.rb +2 -2
- data/lib/picturehouse_uk.rb +1 -0
- data/picturehouse_uk.gemspec +2 -3
- data/rake/fixture_creator.rb +21 -1
- data/test/fixtures/cinemas.html +4262 -0
- data/test/fixtures/duke-of-york-s-picturehouse/cinema.html +6187 -0
- data/test/fixtures/duke-of-york-s-picturehouse/get_movies.json +120552 -0
- data/test/fixtures/duke-of-york-s-picturehouse/information.html +3725 -0
- data/test/fixtures/duke-s-at-komedia/cinema.html +6138 -0
- data/test/fixtures/duke-s-at-komedia/get_movies.json +112 -0
- data/test/fixtures/duke-s-at-komedia/information.html +3690 -0
- data/test/fixtures/home.html +6235 -555
- data/test/fixtures/phoenix-picturehouse/cinema.html +6089 -0
- data/test/fixtures/phoenix-picturehouse/get_movies.json +120552 -0
- data/test/fixtures/phoenix-picturehouse/information.html +3630 -0
- data/test/lib/picturehouse_uk/cinema_test.rb +34 -34
- data/test/lib/picturehouse_uk/internal/api_test.rb +92 -0
- data/test/lib/picturehouse_uk/internal/parser/address_test.rb +8 -8
- data/test/lib/picturehouse_uk/internal/parser/screenings_test.rb +99 -45
- data/test/lib/picturehouse_uk/internal/title_sanitizer_test.rb +48 -48
- data/test/lib/picturehouse_uk/internal/website_test.rb +12 -31
- data/test/lib/picturehouse_uk/performance_test.rb +63 -23
- data/test/lib/picturehouse_uk/version_test.rb +1 -1
- data/test/live/integration_test.rb +8 -8
- data/test/support/fake_api.rb +16 -0
- data/test/support/fake_website.rb +6 -6
- data/test/test_helper.rb +3 -2
- metadata +34 -50
- data/.travis.yml +0 -8
- data/test/fixtures/Duke_Of_Yorks/cinema.html +0 -3408
- data/test/fixtures/Duke_Of_Yorks/info.html +0 -556
- data/test/fixtures/Duke_Of_Yorks/whats_on.html +0 -3159
- data/test/fixtures/Dukes_At_Komedia/cinema.html +0 -4764
- data/test/fixtures/Dukes_At_Komedia/info.html +0 -526
- data/test/fixtures/Dukes_At_Komedia/whats_on.html +0 -4429
- data/test/fixtures/National_Media_Museum/cinema.html +0 -9200
- data/test/fixtures/National_Media_Museum/info.html +0 -606
- data/test/fixtures/National_Media_Museum/whats_on.html +0 -8850
- data/test/fixtures/Phoenix_Picturehouse/cinema.html +0 -8274
- data/test/fixtures/Phoenix_Picturehouse/info.html +0 -542
- data/test/fixtures/Phoenix_Picturehouse/whats_on.html +0 -7986
data/rake/fixture_creator.rb
CHANGED
|
@@ -1,21 +1,30 @@
|
|
|
1
1
|
# Create fitures from the live website
|
|
2
2
|
class FixtureCreator
|
|
3
3
|
def cinema(cinema_id)
|
|
4
|
-
%i(cinema
|
|
4
|
+
%i(cinema information).each do |action|
|
|
5
5
|
write_fixture_for_cinema(cinema_id, action)
|
|
6
6
|
end
|
|
7
|
+
write_api_fixture_for_cinema(cinema_id)
|
|
7
8
|
end
|
|
8
9
|
|
|
9
10
|
def home
|
|
10
11
|
write_fixture(:home)
|
|
11
12
|
end
|
|
12
13
|
|
|
14
|
+
def cinemas
|
|
15
|
+
write_fixture(:cinemas)
|
|
16
|
+
end
|
|
17
|
+
|
|
13
18
|
private
|
|
14
19
|
|
|
15
20
|
def fixture(name)
|
|
16
21
|
File.expand_path("#{fixture_path}/#{name}.html", __FILE__)
|
|
17
22
|
end
|
|
18
23
|
|
|
24
|
+
def json_fixture(name)
|
|
25
|
+
File.expand_path("#{fixture_path}/#{name}.json", __FILE__)
|
|
26
|
+
end
|
|
27
|
+
|
|
19
28
|
def fixture_path
|
|
20
29
|
'../../test/fixtures'
|
|
21
30
|
end
|
|
@@ -33,6 +42,17 @@ class FixtureCreator
|
|
|
33
42
|
end
|
|
34
43
|
end
|
|
35
44
|
|
|
45
|
+
def write_api_fixture_for_cinema(cinema_id)
|
|
46
|
+
require 'json'
|
|
47
|
+
FileUtils.mkdir_p File.expand_path("#{fixture_path}/#{cinema_id}", __FILE__)
|
|
48
|
+
text = "#{cinema_id}/get_movies"
|
|
49
|
+
File.open(json_fixture(text), 'w+') do |file|
|
|
50
|
+
log(text)
|
|
51
|
+
data = PicturehouseUk::Internal::Api.new.get_movies(cinema_id)
|
|
52
|
+
file.write JSON.pretty_generate(data)
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
36
56
|
def write_fixture(kind)
|
|
37
57
|
File.open(fixture(kind), 'w+') do |file|
|
|
38
58
|
log(kind)
|