picturehouse_uk 3.0.8 → 3.0.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4f6fb1d47bad9c9222aa24f5782e3dacf9dfdf4f
4
- data.tar.gz: 0c4675d6002c48e5a3d060ae77f14286df40dc16
3
+ metadata.gz: 437ad0e8ebc0d270642be6c4d4da06c33833be3f
4
+ data.tar.gz: 429a905ad6768ab2428c666dfe3d30c9c6148518
5
5
  SHA512:
6
- metadata.gz: 724b00074362866f62645fb0ee3cdce265e2ed50566e72a0bbcd9dab474ce247e67ee76a7c4e0dfd9fe4bd20aa7e6e3954e197349f33f48a0a68a3c68156cdd4
7
- data.tar.gz: 1880388a8387f29b76d005477195d59aea20c789bd121b3901cbb2e1d083fa83ad2779bf1c52102d68124e4c3d39bf3872be7f6498fcdb5e0109ae2343ff6924
6
+ metadata.gz: 073b9f66f5e761884c50faceb2a5b2b8aa9d13d451d112a1c9827c2f4c49d09cf53887dcc4716e9a85328e3907b60ff4d2a3245cdd5b1ebbf4286b80b93154c7
7
+ data.tar.gz: 0349ae4fd13d79da081476a63d02bb1c111d5702039fa862a3f054cf11d294ea9e577a8c9fa5994b0738cef3b6ddc74bcbbe32222016e2c8868ee53b79e2c241
data/CHANGELOG.md CHANGED
@@ -1,6 +1,14 @@
1
1
  # Change Log
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
+ ## [3.0.9] - 2015-04-12
5
+
6
+ ### Fixed
7
+ - Date parsing was busted, it's not anymore
8
+
9
+ ### Changed
10
+ - Better use of Struct
11
+
4
12
  ## [3.0.8] - 2015-04-07
5
13
 
6
14
  ### Fixed
@@ -4,16 +4,16 @@ module PicturehouseUk
4
4
  # @api private
5
5
  module Parser
6
6
  # Parses screenings page into an array of hashes for an individual cinema
7
- class Screenings < Struct.new(:cinema_id)
7
+ Screenings = Struct.new(:cinema_id) do
8
8
  # css for a day of films & screenings
9
- LISTINGS = '#this-week .listings > li, #further-ahead .listings > li'
9
+ LISTINGS = '#today .listings > li, #this-week .listings > li, #further-ahead .listings > li'
10
10
 
11
11
  # parse the cinema page into an array of screenings attributes
12
12
  # @return [Array<Hash>]
13
13
  def to_a
14
- date = nil
14
+ date = Date.today
15
15
  doc.css(LISTINGS).each_with_object([]) do |node, result|
16
- if date_parse(node.text)
16
+ if date?(node.text)
17
17
  date = date_parse(node.text)
18
18
  else
19
19
  result << FilmWithShowtimes.new(node, date).to_a
@@ -33,13 +33,17 @@ module PicturehouseUk
33
33
  @doc ||= Nokogiri::HTML(page)
34
34
  end
35
35
 
36
+ def date?(text)
37
+ !!text.match(/(Mon|Tues|Wednes|Thurs|Fri|Satur|Sun)day \d{1,2}(st|nd|th) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)/)
38
+ end
39
+
36
40
  def page
37
41
  @page ||= PicturehouseUk::Internal::Website.new.cinema(cinema_id)
38
42
  end
39
43
  end
40
44
  end
41
45
 
42
- class FilmWithShowtimes < Struct.new(:node, :date)
46
+ FilmWithShowtimes = Struct.new(:node, :date) do
43
47
  # film name css
44
48
  NAME = '.top-mg-sm a'
45
49
  # variants css
@@ -76,7 +80,7 @@ module PicturehouseUk
76
80
  end
77
81
 
78
82
  # variants can have multiple screenings
79
- class Variant < Struct.new(:node, :date)
83
+ Variant = Struct.new(:node, :date) do
80
84
  SHOWTIMES = '.btn'
81
85
  VARIANT = '.film-type-desc'
82
86
 
@@ -94,7 +98,7 @@ module PicturehouseUk
94
98
  end
95
99
 
96
100
  # parse an individual screening node
97
- class Showtime < Struct.new(:node, :date)
101
+ Showtime = Struct.new(:node, :date) do
98
102
  # the attributes of a single screening
99
103
  # @return [Hash]
100
104
  # @example
@@ -1,6 +1,6 @@
1
1
  # Ruby interface for http://www.picturehouses.co.uk
2
- # @version 3.0.8
2
+ # @version 3.0.9
3
3
  module PicturehouseUk
4
4
  # Gem version
5
- VERSION = '3.0.8'
5
+ VERSION = '3.0.9'
6
6
  end
@@ -19,7 +19,7 @@ describe PicturehouseUk::Screening do
19
19
 
20
20
  it 'returns correct number of screenings' do
21
21
  PicturehouseUk::Internal::Website.stub :new, website do
22
- subject.count.must_equal 14
22
+ subject.count.must_equal 59
23
23
  end
24
24
  end
25
25
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: picturehouse_uk
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.8
4
+ version: 3.0.9
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-04-07 00:00:00.000000000 Z
11
+ date: 2015-04-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler