national-rail 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'mechanize'
|
2
2
|
require 'hpricot'
|
3
3
|
require 'active_support'
|
4
|
+
require 'tidy_ffi'
|
4
5
|
|
5
6
|
module NationalRail
|
6
7
|
|
@@ -9,7 +10,7 @@ module NationalRail
|
|
9
10
|
class HpricotParser < Mechanize::Page
|
10
11
|
attr_reader :doc
|
11
12
|
def initialize(uri = nil, response = nil, body = nil, code = nil)
|
12
|
-
@doc = Hpricot(body)
|
13
|
+
@doc = Hpricot(TidyFFI::Tidy.new(body).clean)
|
13
14
|
super(uri, response, body, code)
|
14
15
|
end
|
15
16
|
end
|
@@ -131,8 +132,8 @@ module NationalRail
|
|
131
132
|
form["_includeOvertakenTrains"] = "on"
|
132
133
|
end.click_button(button)
|
133
134
|
|
134
|
-
if (times_page.doc/"error-message").any?
|
135
|
-
raise (times_page.doc/"error-message").first.inner_text.gsub(/\s+/, " ").strip
|
135
|
+
if (times_page.doc/".error-message").any?
|
136
|
+
raise (times_page.doc/".error-message").first.inner_text.gsub(/\s+/, " ").strip
|
136
137
|
end
|
137
138
|
|
138
139
|
date = Date.parse((times_page.doc/".journey-details span:nth-child(0)").first.inner_text.gsub(/\s+/, " ").gsub(/\+ 1 day/, '').strip)
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'mechanize'
|
2
2
|
require 'hpricot'
|
3
|
+
require 'tidy_ffi'
|
3
4
|
|
4
5
|
module NationalRail
|
5
6
|
|
@@ -8,7 +9,7 @@ module NationalRail
|
|
8
9
|
class HpricotParser < Mechanize::Page
|
9
10
|
attr_reader :doc
|
10
11
|
def initialize(uri = nil, response = nil, body = nil, code = nil)
|
11
|
-
@doc = Hpricot(body)
|
12
|
+
@doc = Hpricot(TidyFFI::Tidy.new(body).clean)
|
12
13
|
super(uri, response, body, code)
|
13
14
|
end
|
14
15
|
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'mechanize'
|
2
2
|
require 'hpricot'
|
3
|
+
require 'tidy_ffi'
|
3
4
|
|
4
5
|
module NationalRail
|
5
6
|
|
@@ -59,7 +60,7 @@ module NationalRail
|
|
59
60
|
class HpricotParser < Mechanize::Page
|
60
61
|
attr_reader :doc
|
61
62
|
def initialize(uri = nil, response = nil, body = nil, code = nil)
|
62
|
-
@doc = Hpricot(body)
|
63
|
+
@doc = Hpricot(TidyFFI::Tidy.new(body).clean)
|
63
64
|
super(uri, response, body, code)
|
64
65
|
end
|
65
66
|
end
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: national-rail
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 21
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 3
|
8
|
-
-
|
9
|
-
version: 0.3.
|
9
|
+
- 3
|
10
|
+
version: 0.3.3
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- James Mead
|
@@ -14,16 +15,18 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2010-11-
|
18
|
+
date: 2010-11-12 00:00:00 +00:00
|
18
19
|
default_executable:
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
21
22
|
name: mechanize
|
22
23
|
prerelease: false
|
23
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
24
26
|
requirements:
|
25
27
|
- - ~>
|
26
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 23
|
27
30
|
segments:
|
28
31
|
- 1
|
29
32
|
- 0
|
@@ -35,9 +38,11 @@ dependencies:
|
|
35
38
|
name: hpricot
|
36
39
|
prerelease: false
|
37
40
|
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
38
42
|
requirements:
|
39
43
|
- - ~>
|
40
44
|
- !ruby/object:Gem::Version
|
45
|
+
hash: 59
|
41
46
|
segments:
|
42
47
|
- 0
|
43
48
|
- 8
|
@@ -49,9 +54,11 @@ dependencies:
|
|
49
54
|
name: activesupport
|
50
55
|
prerelease: false
|
51
56
|
requirement: &id003 !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
52
58
|
requirements:
|
53
59
|
- - ~>
|
54
60
|
- !ruby/object:Gem::Version
|
61
|
+
hash: 7
|
55
62
|
segments:
|
56
63
|
- 3
|
57
64
|
- 0
|
@@ -59,6 +66,22 @@ dependencies:
|
|
59
66
|
version: 3.0.0
|
60
67
|
type: :runtime
|
61
68
|
version_requirements: *id003
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: tidy_ffi
|
71
|
+
prerelease: false
|
72
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
hash: 29
|
78
|
+
segments:
|
79
|
+
- 0
|
80
|
+
- 1
|
81
|
+
- 3
|
82
|
+
version: 0.1.3
|
83
|
+
type: :runtime
|
84
|
+
version_requirements: *id004
|
62
85
|
description:
|
63
86
|
email: james@floehopper.org
|
64
87
|
executables: []
|
@@ -85,23 +108,27 @@ rdoc_options: []
|
|
85
108
|
require_paths:
|
86
109
|
- lib
|
87
110
|
required_ruby_version: !ruby/object:Gem::Requirement
|
111
|
+
none: false
|
88
112
|
requirements:
|
89
113
|
- - ">="
|
90
114
|
- !ruby/object:Gem::Version
|
115
|
+
hash: 3
|
91
116
|
segments:
|
92
117
|
- 0
|
93
118
|
version: "0"
|
94
119
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
120
|
+
none: false
|
95
121
|
requirements:
|
96
122
|
- - ">="
|
97
123
|
- !ruby/object:Gem::Version
|
124
|
+
hash: 3
|
98
125
|
segments:
|
99
126
|
- 0
|
100
127
|
version: "0"
|
101
128
|
requirements: []
|
102
129
|
|
103
130
|
rubyforge_project: national-rail
|
104
|
-
rubygems_version: 1.3.
|
131
|
+
rubygems_version: 1.3.7
|
105
132
|
signing_key:
|
106
133
|
specification_version: 3
|
107
134
|
summary: A Ruby API for the National Rail website
|