odeon_uk 3.0.4 → 3.0.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a93bd99698e1107ba48963d63c856bb30db8fe04
4
- data.tar.gz: 0f34f24b21b31c018ee33973125cdabd6db51407
3
+ metadata.gz: 923b9fdff96d0fa70efea9e1f4e3e6b98ff6e13e
4
+ data.tar.gz: 9009c376a212f175d79ee583f99a686983e758e5
5
5
  SHA512:
6
- metadata.gz: e457d07343eeac1b78ccbb80f1b1821ac83e11c8e24c6d77e8cf2ab0bffd8b4c724794b787f17f7f291f22e2c41f94baf0b80c226308680835fcfe1a6350b312
7
- data.tar.gz: d96d6d0229ca9408259d1f798b3fa6ea88430a318cd7f09bc831c5c6154f79a8e95b04def2728ed5cf047dc6e130e809b8722669b461356763a83291cd0afc48
6
+ metadata.gz: 87307021efaed1bfc13f4b0cbf3ae0375f1b52d21412953ac64a7a7512e58a108a8206da35f6c983e9d47b45df5a77daba1a62e53a14f0f1400817bc7dfc25e6
7
+ data.tar.gz: ff6fcc044f3fe51a54558304bb944a050da392786b6cead54ff9bbf8ab6b35863d9c4845adfe4e4f48053828998d4a7aa78a677c1df4bc8d91a04cf33b996d5b
@@ -1,5 +1,10 @@
1
1
  ## 3.0.4 - 2015-05-06
2
2
 
3
+ ### Fixed
4
+ - API use for screenings
5
+
6
+ ## 3.0.4 - 2015-05-06
7
+
3
8
  ### Added
4
9
  - URLs created for api cinemas
5
10
 
@@ -7,6 +7,7 @@ module OdeonUk
7
7
  module Api
8
8
  # Utility class to make calls to the odeon website
9
9
  class Response
10
+ # iOS app API version
10
11
  VERSION = '2.1'
11
12
 
12
13
  # cinemas information
@@ -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
- cinema = { cinema_id: cinema_id, cinema_name: Cinema.new(cinema_id).name }
38
-
39
- parser.at(cinema_id).map { |hash| new(hash.merge(cinema)) }
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.parser
64
- Html::Screenings
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
@@ -1,6 +1,6 @@
1
1
  # Ruby interface for http://www.odeon.co.uk
2
- # @version 3.0.4
2
+ # @version 3.0.5
3
3
  module OdeonUk
4
4
  # Gem version
5
- VERSION = '3.0.4'
5
+ VERSION = '3.0.5'
6
6
  end
@@ -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
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-05-06 00:00:00.000000000 Z
11
+ date: 2015-07-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake