odeon_uk 3.0.4 → 3.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/odeon_uk/api/response.rb +1 -0
- data/lib/odeon_uk/screening.rb +9 -5
- data/lib/odeon_uk/version.rb +2 -2
- data/odeon_uk.gemspec +0 -2
- data/test/lib/odeon_uk/screening_test.rb +50 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 923b9fdff96d0fa70efea9e1f4e3e6b98ff6e13e
|
4
|
+
data.tar.gz: 9009c376a212f175d79ee583f99a686983e758e5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 87307021efaed1bfc13f4b0cbf3ae0375f1b52d21412953ac64a7a7512e58a108a8206da35f6c983e9d47b45df5a77daba1a62e53a14f0f1400817bc7dfc25e6
|
7
|
+
data.tar.gz: ff6fcc044f3fe51a54558304bb944a050da392786b6cead54ff9bbf8ab6b35863d9c4845adfe4e4f48053828998d4a7aa78a677c1df4bc8d91a04cf33b996d5b
|
data/CHANGELOG.md
CHANGED
data/lib/odeon_uk/screening.rb
CHANGED
@@ -34,9 +34,9 @@ module OdeonUk
|
|
34
34
|
# @param [Integer] cinema_id id of the cinema on the website
|
35
35
|
# @return [Array<OdeonUk::Screening>]
|
36
36
|
def self.at(cinema_id)
|
37
|
-
|
38
|
-
|
39
|
-
|
37
|
+
parser_class.at(cinema_id).map do |hash|
|
38
|
+
new(hash.merge(cinema_hash(cinema_id)))
|
39
|
+
end
|
40
40
|
end
|
41
41
|
|
42
42
|
# The date of the screening
|
@@ -60,8 +60,12 @@ module OdeonUk
|
|
60
60
|
|
61
61
|
private
|
62
62
|
|
63
|
-
def self.
|
64
|
-
|
63
|
+
def self.cinema_hash(cinema_id)
|
64
|
+
{ cinema_id: cinema_id, cinema_name: Cinema.new(cinema_id).name }
|
65
|
+
end
|
66
|
+
|
67
|
+
def self.parser_class
|
68
|
+
OdeonUk.configuration.method == :api ? Api::Screenings : Html::Screenings
|
65
69
|
end
|
66
70
|
end
|
67
71
|
end
|
data/lib/odeon_uk/version.rb
CHANGED
data/odeon_uk.gemspec
CHANGED
@@ -18,8 +18,6 @@ Gem::Specification.new do |gem|
|
|
18
18
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
19
19
|
gem.require_paths = ["lib"]
|
20
20
|
|
21
|
-
gem.version = OdeonUk::VERSION
|
22
|
-
|
23
21
|
gem.add_development_dependency 'rake'
|
24
22
|
gem.add_development_dependency 'minitest-reporters'
|
25
23
|
gem.add_development_dependency 'webmock'
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require_relative '../../test_helper'
|
2
2
|
|
3
|
-
describe OdeonUk::Screening do
|
3
|
+
describe OdeonUk::Screening, 'html' do
|
4
4
|
include WebsiteFixturesHelper
|
5
5
|
|
6
6
|
let(:described_class) { OdeonUk::Screening }
|
@@ -41,3 +41,52 @@ describe OdeonUk::Screening do
|
|
41
41
|
end
|
42
42
|
end
|
43
43
|
end
|
44
|
+
|
45
|
+
describe OdeonUk::Screening, 'api' do
|
46
|
+
include ApiFixturesHelper
|
47
|
+
|
48
|
+
let(:described_class) { OdeonUk::Screening }
|
49
|
+
|
50
|
+
let(:website) { Minitest::Mock.new }
|
51
|
+
|
52
|
+
before do
|
53
|
+
WebMock.disable_net_connect!
|
54
|
+
end
|
55
|
+
|
56
|
+
describe '.at(cinema_id)' do
|
57
|
+
subject { described_class.at(71) }
|
58
|
+
|
59
|
+
before do
|
60
|
+
OdeonUk.configure { |config| config.method = :api }
|
61
|
+
|
62
|
+
stub_post('app-init', nil, app_init_plist)
|
63
|
+
film_times_plists(71).each do |name|
|
64
|
+
film_id = name.match(/(\d+)\.plist/)[1]
|
65
|
+
stub_post('film-times',
|
66
|
+
{ s: '71', m: film_id },
|
67
|
+
film_times_plist(71, film_id))
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
after do
|
72
|
+
OdeonUk.configure { |config| config.method = :html }
|
73
|
+
end
|
74
|
+
|
75
|
+
it 'returns an array of screening attributes as hashes' do
|
76
|
+
subject.must_be_instance_of(Array)
|
77
|
+
subject.each do |screening|
|
78
|
+
screening.must_be_instance_of(described_class)
|
79
|
+
screening.cinema_name.must_equal('Brighton')
|
80
|
+
screening.cinema_id.must_equal(71)
|
81
|
+
screening.film_name.wont_be_nil
|
82
|
+
screening.showing_at.must_be_instance_of(Time)
|
83
|
+
screening.showing_on.must_be_instance_of(Date)
|
84
|
+
screening.dimension.must_match(/[23]d/)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
it 'returns correct number of screenings' do
|
89
|
+
subject.count.must_equal 159
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: odeon_uk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Croll
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-07-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|