lothianbusestimetable 0.1.2 → 0.1.3

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: 0b7bf8aeef769426238502b70bc808bb96258991
4
- data.tar.gz: 5b873a112b7ef446268c1dc70d09bba89d2f0f3d
3
+ metadata.gz: b04bea73d8b5ad4e895b25d94eb1ffa0a94d3c91
4
+ data.tar.gz: af832e2b5850a9b705f141b996d88abf7ea88425
5
5
  SHA512:
6
- metadata.gz: 4e32b9855b1cdd5cfe12802edd4d029d3ce04c0363676a32ab47a4ea6fa04510326c95a43e77c1d0dd13c1105c7a63b3c78a0b195fd0609bc592d16ecf12c684
7
- data.tar.gz: ec151da37d9a6c8555be33edc9d0301d1c11f30c1ff91d178bd3e7ebb628ddb3082d668b6325a87e6aead2f9aeadfa7f6943c4307a9340df4b4a3842ba7feef7
6
+ metadata.gz: 8419029b14414ead0461fc50f123964428342b48a4f7670db6b0eec7a6ccd906eb8a62dea7a343bf2e6663e4f91ea9efa2b2811d0f816a8326e5471594faa405
7
+ data.tar.gz: 5e040323094473cc03d9e10eee45af0be233285d816d53b2c48e8a3a0e455b648225ea3650d3efb2f86e607ef10623920447178adf1341d5fa0c6812301ad13c
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -45,7 +45,7 @@ class LothianBusesTimetable
45
45
  table.xpath('tr').each do |tr|
46
46
 
47
47
  # get the name
48
- a = tr.xpath('td//text()').map(&:to_s)
48
+ a = tr.xpath('td//text()').map(&:unescape)
49
49
 
50
50
  col1 = a.shift.strip
51
51
 
@@ -217,4 +217,28 @@ class LothianBusesTimetable
217
217
  @timetable = master
218
218
 
219
219
  end
220
+
221
+ def services()
222
+
223
+ return @services if @services
224
+
225
+ url = @base_url + '1'
226
+
227
+ doc = Nokorexi.new(url).to_doc
228
+
229
+ o = doc.root.xpath('//optgroup').map do |options|
230
+
231
+ [
232
+ options.attributes[:label].sub(' services',''),
233
+ options.xpath('option/text()').map do |x|
234
+ %i(number name).zip(x.to_s.split(/ - /,2)).to_h
235
+ end
236
+ ]
237
+
238
+ end
239
+
240
+ @services = o.to_h
241
+
242
+ end
243
+
220
244
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lothianbusestimetable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -31,7 +31,7 @@ cert_chain:
31
31
  K7yWGJq+eGl34xrLaucvTbO8Ua3rHayCkBzgfx5LVcch22Axj8quw+YGsPnhuosr
32
32
  BHdCmx9eUF/TKg==
33
33
  -----END CERTIFICATE-----
34
- date: 2017-08-22 00:00:00.000000000 Z
34
+ date: 2017-08-25 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: nokorexi
metadata.gz.sig CHANGED
Binary file