odeon_uk 1.1.3 → 1.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- NDQxYWI5ZWRlNDQ1YThkYjc2NzU5MWJlNTA5ZTM3MGQyMzE3ZDVhOA==
5
- data.tar.gz: !binary |-
6
- ZGRjMjg4Y2M5YTMxZDU5MWQ2ZDIxZTUyMDAyODk3ZWFlZDcwODdmOA==
2
+ SHA1:
3
+ metadata.gz: 787cfcc04a2f7849b9c3304f21cd16d7eb81b996
4
+ data.tar.gz: 07102569cea2b7440d777efb4498ba68531ca5c9
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- YjQ0ZGEzOTAwNzczOWVkZmY1NjkzODYyYThiMWQ4NGYxNjMzOWUxOGEzYzAw
10
- YzQwYzE3YzQ4ZmJhZWU2MTdmMWI2ZjZmMjUxZDQ0OTA1MWY5N2VkMDVlZjMz
11
- ZjNlYzdjOTdhNzk2M2NmYWMzYmIwZTVhMjBkODcyMTJkYTEyOTc=
12
- data.tar.gz: !binary |-
13
- NjdmNWExNzI5NWJhYTg4YjQzOTdkMTRkYjQ5ZjVjNzMyOTM2YWM3NTY5M2Vk
14
- ZmNhYTVmZTdhMmZhNWU1M2JjZTRiYzA4YWMzZDFhY2Q5MzYyMTZmNWIxMTlk
15
- YjYyODFjMWNiNzZlZWQ2OWQxMjRhZGUyOTM2OWQ3MGU1OTJmMTQ=
6
+ metadata.gz: 95d5c1d98b49227629ba71b721e6a85a5a9b17a896ed96fca5069aaddb92851b000e4020fe54e5b38492d056e6d367e255a5afeb25a6e184e9c5b4b383d779aa
7
+ data.tar.gz: 5fd9744901a138189b9bf8267b67c5fa9523640b97f0d964e24c28992f2261b82cafe3baa9ddb444783d80b942226303701c486d15b8cd762005b1c257972b24
data/CHANGELOG.md ADDED
@@ -0,0 +1,28 @@
1
+
2
+ - Added changelog
3
+
4
+ ## 1.1.3, _8th Nov 2013_
5
+
6
+ - MIT license
7
+
8
+ ## 1.1.2, _6th Nov 2013_
9
+
10
+ - version bump for fixing CI
11
+ - using UTC parsing
12
+
13
+ ## 1.1.1, _6th Nov 2013_
14
+
15
+ - version bump for fixing CI
16
+
17
+ ## 1.1.0, _5th Nov 2013_
18
+
19
+ First ready-for-public release
20
+
21
+ - added booking url to screenings
22
+ - screenings created with UTC Time objects not strings
23
+ - Removed 'London -' prefix from some cinema names
24
+ - added cinema addresses
25
+
26
+ ## 1.0.0
27
+
28
+ - Get films and screenings out of a cinema
data/README.md CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  A simple gem to parse the [Odeon UK website](http://odeon.co.uk) and spit out useful formatted info.
4
4
 
5
+ [![Gem Version](https://badge.fury.io/rb/odeon_uk.png)](http://badge.fury.io/rb/odeon_uk)
5
6
  [![Code Climate](https://codeclimate.com/github/andycroll/odeon_uk.png)](https://codeclimate.com/github/andycroll/odeon_uk)
6
7
  [![Build Status](https://travis-ci.org/andycroll/odeon_uk.png?branch=master)](https://travis-ci.org/andycroll/odeon_uk)
7
8
 
@@ -49,13 +50,13 @@ cinema.films
49
50
  #=> [<OdeonUk::Film name="Iron Man 3">, <OdeonUk::Film name="Star Trek: Into Darkness">]
50
51
 
51
52
  cinema.screenings
52
- #=> [<OdeonUk::Screening film="About Time" when="2013-09-09 11:00 UTC" varient="3d">, <OdeonUk::Screening film="Iron Man 3" when="2013-09-09 13:50 UTC" varient="kids">, <OdeonUk::Screening ..>, <OdeonUk::Screening ...>]
53
+ #=> [<OdeonUk::Screening film="About Time" when="2013-09-09 11:00 UTC" variant="3d">, <OdeonUk::Screening film="Iron Man 3" when="2013-09-09 13:50 UTC" variant="kids">, <OdeonUk::Screening ..>, <OdeonUk::Screening ...>]
53
54
 
54
55
  cinema.screenings_of 'Iron Man 3'
55
- #=> [<OdeonUk::Screening film="Iron Man 3" when="2013-09-09 11:00 UTC" varient="3d">, <OdeonUk::Screening film="Iron Man 3" when="2013-09-09 13:50 UTC" varient="kids">]
56
+ #=> [<OdeonUk::Screening film="Iron Man 3" when="2013-09-09 11:00 UTC" variant="3d">, <OdeonUk::Screening film="Iron Man 3" when="2013-09-09 13:50 UTC" variant="kids">]
56
57
 
57
58
  cinema.screenings_of <OdeonUk::Film name="Iron Man 3">
58
- #=> [<OdeonUk::Screening film="Iron Man 3" when="2013-09-09 11:00 UTC" varient="3d">, <OdeonUk::Screening film="Iron Man 3" when="2013-09-09 13:50 UTC" varient="kids">]
59
+ #=> [<OdeonUk::Screening film="Iron Man 3" when="2013-09-09 11:00 UTC" variant="3d">, <OdeonUk::Screening film="Iron Man 3" when="2013-09-09 13:50 UTC" variant="kids">]
59
60
  ```
60
61
 
61
62
  ### Film
@@ -78,6 +78,16 @@ module OdeonUk
78
78
  end.uniq
79
79
  end
80
80
 
81
+ # The name of the cinema including the brand
82
+ # @return [String]
83
+ # @example
84
+ # cinema = OdeonUk::Cinema.find('71')
85
+ # cinema.full_name
86
+ # #=> 'Odeon Brighton'
87
+ def full_name
88
+ "#{brand} #{name}"
89
+ end
90
+
81
91
  # The locality (town) of the cinema
82
92
  # @return [String]
83
93
  # @example
@@ -104,7 +114,7 @@ module OdeonUk
104
114
  # @example
105
115
  # cinema = OdeonUk::Cinema.find('71')
106
116
  # cinema.screenings
107
- # #=> [<OdeonUk::Screening film_name="Iron Man 3" cinema_name="Brighton" when="..." varient="...">, <OdeonUk::Screening ...>]
117
+ # #=> [<OdeonUk::Screening film_name="Iron Man 3" cinema_name="Brighton" when="..." variant="...">, <OdeonUk::Screening ...>]
108
118
  def screenings
109
119
  film_nodes.map do |node|
110
120
  parser = OdeonUk::Internal::FilmWithScreeningsParser.new node.to_s
@@ -122,10 +132,10 @@ module OdeonUk
122
132
  # @example
123
133
  # cinema = OdeonUk::Cinema.find('71')
124
134
  # cinema.screenings_of('Iron Man 3')
125
- # #=> [<OdeonUk::Screening film_name="Iron Man 3" cinema_name="Brighton" when="..." varient="...">, <OdeonUk::Screening ...>]
135
+ # #=> [<OdeonUk::Screening film_name="Iron Man 3" cinema_name="Brighton" when="..." variant="...">, <OdeonUk::Screening ...>]
126
136
  # iron_man_3 = OdeonUk::Film.new "Iron Man 3"
127
137
  # cinema.screenings_of(iron_man_3)
128
- # #=> [<OdeonUk::Screening film_name="Iron Man 3" cinema_name="Brighton" when="..." varient="...">, <OdeonUk::Screening ...>]
138
+ # #=> [<OdeonUk::Screening film_name="Iron Man 3" cinema_name="Brighton" when="..." variant="...">, <OdeonUk::Screening ...>]
129
139
  def screenings_of film
130
140
  film_name = (film.is_a?(OdeonUk::Film) ? film.name : film)
131
141
  screenings.select { |s| s.film_name == film_name }
@@ -50,17 +50,17 @@ module OdeonUk
50
50
  # }
51
51
  def showings
52
52
  tz = TZInfo::Timezone.get('Europe/London')
53
- @nokogiri_html.css('.times-all.accordion-group').inject({}) do |result, varient_node|
54
- varient = varient_node.css('.tech a').text.gsub('in ', '').upcase
53
+ @nokogiri_html.css('.times-all.accordion-group').inject({}) do |result, variant_node|
54
+ variant = variant_node.css('.tech a').text.gsub('in ', '').upcase
55
55
 
56
- times_url = varient_node.css('.performance-detail').map do |screening_node|
56
+ times_url = variant_node.css('.performance-detail').map do |screening_node|
57
57
  [
58
58
  tz.local_to_utc(Time.parse(screening_node['title'].match(/\d+\/\d+\/\d+ \d{2}\:\d{2}/).to_s + ' UTC')),
59
59
  "http://www.odeon.co.uk#{screening_node['href']}"
60
60
  ]
61
61
  end
62
62
 
63
- result.merge(varient => times_url)
63
+ result.merge(variant => times_url)
64
64
  end
65
65
  end
66
66
  end
@@ -12,15 +12,15 @@ module OdeonUk
12
12
  # @return [Time] the UTC time of the screening
13
13
  attr_reader :when
14
14
  # @return [String] the type of screening (2D, 3D, IMAX...)
15
- attr_reader :varient
15
+ attr_reader :variant
16
16
 
17
17
  # @param [String] film_name the film name
18
18
  # @param [String] the cinema name
19
19
  # @param [Time] time datetime of the screening (UTC preferred)
20
20
  # @param [String] booking_url direct link to the booking page for this screening
21
- # @param [String] varient the type of showing (e.g. 3d/baby/live)
22
- def initialize(film_name, cinema_name, time, booking_url=nil, varient=nil)
23
- @cinema_name, @film_name, @varient = cinema_name, film_name, varient
21
+ # @param [String] variant the type of showing (e.g. 3d/baby/live)
22
+ def initialize(film_name, cinema_name, time, booking_url=nil, variant=nil)
23
+ @cinema_name, @film_name, @variant = cinema_name, film_name, variant
24
24
  @booking_url = booking_url
25
25
  @when = time.utc? ? time : TZInfo::Timezone.get('Europe/London').local_to_utc(time)
26
26
  end
@@ -30,5 +30,11 @@ module OdeonUk
30
30
  def date
31
31
  @when.to_date
32
32
  end
33
+
34
+ # @deprecated Please use {#variant} instead, I can't spell
35
+ def varient
36
+ warn "Please use #variant instead, I can't spell"
37
+ variant
38
+ end
33
39
  end
34
40
  end
@@ -1,6 +1,6 @@
1
1
  # Ruby interface for http://www.odeon.co.uk
2
- # @version 1.1.3
2
+ # @version 1.1.4
3
3
  module OdeonUk
4
4
  # Gem version
5
- VERSION = "1.1.3"
5
+ VERSION = "1.1.4"
6
6
  end
data/odeon_uk.gemspec CHANGED
@@ -11,6 +11,7 @@ Gem::Specification.new do |gem|
11
11
  gem.description = %q{An API to pull movie information from the ODEON.co.uk website}
12
12
  gem.summary = %q{It's a scraper, but a nice one}
13
13
  gem.homepage = "http://github.com/andycroll/odeon_uk"
14
+ gem.license = "MIT"
14
15
 
15
16
  gem.files = `git ls-files`.split($/)
16
17
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
@@ -58,7 +58,8 @@ describe OdeonUk::Cinema do
58
58
  subject.slug.must_equal 'leicester-square'
59
59
  subject.url.must_equal 'http://www.odeon.co.uk/cinemas/london_leicester_square/105/'
60
60
  end
61
- end end
61
+ end
62
+ end
62
63
 
63
64
  describe '.new id, name, url' do
64
65
  it 'stores id, name, slug and url' do
@@ -133,6 +134,23 @@ describe OdeonUk::Cinema do
133
134
  end
134
135
  end
135
136
 
137
+ describe '#full_name' do
138
+ subject { cinema.full_name }
139
+
140
+ describe 'simple name (brighton)' do
141
+ let(:cinema) { OdeonUk::Cinema.new('71', 'Brighton', '/cinemas/brighton/71/') }
142
+
143
+ before do
144
+ brighton_cinema_body = File.read( File.join(File.dirname(__FILE__), '..', '..', 'fixtures', 'odeon-brighton.html') )
145
+ stub_request(:get, 'http://www.odeon.co.uk/cinemas/brighton/71/').to_return( status: 200, body: brighton_cinema_body, headers: {} )
146
+ end
147
+
148
+ it 'returns the brand in the name' do
149
+ subject.must_equal 'Odeon Brighton'
150
+ end
151
+ end
152
+ end
153
+
136
154
  describe '#locality' do
137
155
  describe 'short address' do
138
156
  let(:cinema) { OdeonUk::Cinema.new('71', 'Brighton', '/cinemas/brighton/71/') }
@@ -231,14 +249,14 @@ describe OdeonUk::Cinema do
231
249
  subject.last.when.must_equal Time.utc(2013, 9, 19, 19, 40, 0)
232
250
  end
233
251
 
234
- it 'returns screening objects with correct varients' do
252
+ it 'returns screening objects with correct variants' do
235
253
  subject.each do |screening|
236
- screening.varient.wont_be_nil
237
- screening.varient.must_match /[23]D/
254
+ screening.variant.wont_be_nil
255
+ screening.variant.must_match /[23]D/
238
256
  end
239
257
 
240
- subject.first.varient.must_equal '2D'
241
- subject.last.varient.must_equal '2D'
258
+ subject.first.variant.must_equal '2D'
259
+ subject.last.variant.must_equal '2D'
242
260
  end
243
261
 
244
262
  it 'returns screening objects with booking urls' do
@@ -108,7 +108,7 @@ describe OdeonUk::Internal::FilmWithScreeningsParser do
108
108
  describe 'passed valid film html' do
109
109
  let(:film_html) { read_film_html('about-time') }
110
110
 
111
- it 'returns an hash of varients => array of times' do
111
+ it 'returns an hash of variants => array of times' do
112
112
  subject.must_be_instance_of Hash
113
113
  subject.each do |key, value|
114
114
  key.must_equal '2D'
@@ -133,10 +133,10 @@ describe OdeonUk::Internal::FilmWithScreeningsParser do
133
133
  end
134
134
  end
135
135
 
136
- describe 'passed valid film html for multi varients' do
136
+ describe 'passed valid film html for multi variants' do
137
137
  let(:film_html) { read_film_html('thor-the-dark-world', 'manchester') }
138
138
 
139
- it 'returns an hash of varients => array of times' do
139
+ it 'returns an hash of variants => array of times' do
140
140
  subject.must_be_instance_of Hash
141
141
  subject.keys.must_equal ['2D', 'IMAX 3D', '3D']
142
142
  subject.values.each do |value|
@@ -4,23 +4,23 @@ describe OdeonUk::Screening do
4
4
 
5
5
  before { WebMock.disable_net_connect! }
6
6
 
7
- describe '#new film_name, cinema_name, date, time, varient' do
7
+ describe '#new film_name, cinema_name, date, time, variant' do
8
8
  it 'stores film_name, cinema_name & when (in UTC)' do
9
9
  screening = OdeonUk::Screening.new 'Iron Man 3', 'Brighton', Time.parse('2013-09-12 12:00') # non-UTC time
10
10
  screening.film_name.must_equal 'Iron Man 3'
11
11
  screening.cinema_name.must_equal 'Brighton'
12
12
  screening.when.must_equal Time.utc(2013, 9, 12, 11, 0)
13
13
  screening.booking_url.must_equal nil
14
- screening.varient.must_equal nil
14
+ screening.variant.must_equal nil
15
15
  end
16
16
 
17
- it 'stores varient if passed' do
17
+ it 'stores variant if passed' do
18
18
  screening = OdeonUk::Screening.new 'Iron Man 3', 'Brighton', Time.utc(2013, 9, 12, 11, 0), nil, '3d'
19
19
  screening.film_name.must_equal 'Iron Man 3'
20
20
  screening.cinema_name.must_equal 'Brighton'
21
21
  screening.when.must_equal Time.utc(2013, 9, 12, 11, 0)
22
22
  screening.booking_url.must_equal nil
23
- screening.varient.must_equal '3d'
23
+ screening.variant.must_equal '3d'
24
24
  end
25
25
 
26
26
  it 'stores booking_url if passed' do
@@ -30,7 +30,7 @@ describe OdeonUk::Screening do
30
30
  screening.when.must_equal Time.utc(2013, 9, 12, 11, 0)
31
31
  screening.when.must_equal Time.utc(2013, 9, 12, 11, 0)
32
32
  screening.booking_url.must_equal 'http://booking_url'
33
- screening.varient.must_equal nil
33
+ screening.variant.must_equal nil
34
34
  end
35
35
  end
36
36
 
@@ -41,4 +41,13 @@ describe OdeonUk::Screening do
41
41
  subject.must_equal Date.new(2013, 9, 12)
42
42
  end
43
43
  end
44
+
45
+ describe '#varient (DEPRECATED)' do
46
+ subject { screening.varient }
47
+ let(:screening) { OdeonUk::Screening.new('Iron Man 3', 'Brighton', Time.utc(2013, 9, 12, 11, 0), nil, '3d') }
48
+
49
+ it 'should return variant' do
50
+ subject.must_equal '3d'
51
+ end
52
+ end
44
53
  end
metadata CHANGED
@@ -1,97 +1,97 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: odeon_uk
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 1.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Croll
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-08 00:00:00.000000000 Z
11
+ date: 2014-02-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ! '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ! '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: webmock
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ! '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ! '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: httparty
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ! '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ! '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: nokogiri
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ! '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ! '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: tzinfo
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ! '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ! '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: tzinfo-data
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ! '>='
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ! '>='
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  description: An API to pull movie information from the ODEON.co.uk website
@@ -101,9 +101,10 @@ executables: []
101
101
  extensions: []
102
102
  extra_rdoc_files: []
103
103
  files:
104
- - .gitignore
105
- - .rdoc_options
106
- - .travis.yml
104
+ - ".gitignore"
105
+ - ".rdoc_options"
106
+ - ".travis.yml"
107
+ - CHANGELOG.md
107
108
  - Gemfile
108
109
  - LICENSE.txt
109
110
  - README.md
@@ -140,7 +141,8 @@ files:
140
141
  - test/lib/odeon_uk/version_test.rb
141
142
  - test/test_helper.rb
142
143
  homepage: http://github.com/andycroll/odeon_uk
143
- licenses: []
144
+ licenses:
145
+ - MIT
144
146
  metadata: {}
145
147
  post_install_message:
146
148
  rdoc_options: []
@@ -148,17 +150,17 @@ require_paths:
148
150
  - lib
149
151
  required_ruby_version: !ruby/object:Gem::Requirement
150
152
  requirements:
151
- - - ! '>='
153
+ - - ">="
152
154
  - !ruby/object:Gem::Version
153
155
  version: '0'
154
156
  required_rubygems_version: !ruby/object:Gem::Requirement
155
157
  requirements:
156
- - - ! '>='
158
+ - - ">="
157
159
  - !ruby/object:Gem::Version
158
160
  version: '0'
159
161
  requirements: []
160
162
  rubyforge_project:
161
- rubygems_version: 2.1.10
163
+ rubygems_version: 2.2.0
162
164
  signing_key:
163
165
  specification_version: 4
164
166
  summary: It's a scraper, but a nice one