requestor 0.1.3 → 0.1.4
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.
- data/lib/requestor.rb +4 -3
- metadata +1 -1
data/lib/requestor.rb
CHANGED
|
@@ -4,11 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
require 'open-uri'
|
|
6
6
|
require 'net/http'
|
|
7
|
-
require '
|
|
7
|
+
require 'rexml/document'
|
|
8
8
|
|
|
9
9
|
class Requestor
|
|
10
10
|
|
|
11
11
|
class Filex
|
|
12
|
+
include REXML
|
|
12
13
|
|
|
13
14
|
attr_reader :code
|
|
14
15
|
|
|
@@ -38,7 +39,7 @@ class Requestor
|
|
|
38
39
|
|
|
39
40
|
if url.file_list? then
|
|
40
41
|
@file_list = true
|
|
41
|
-
@
|
|
42
|
+
@doc = Document.new(open(url, 'UserAgent' => 'Ruby-REXML').read)
|
|
42
43
|
end
|
|
43
44
|
end
|
|
44
45
|
|
|
@@ -46,7 +47,7 @@ class Requestor
|
|
|
46
47
|
|
|
47
48
|
unless @names.include? file then
|
|
48
49
|
if @file_list then
|
|
49
|
-
url = @
|
|
50
|
+
url = XPath.first(@doc.root, "records/file[name='#{file}']/url/text()").to_s
|
|
50
51
|
else
|
|
51
52
|
file += '.rb' unless file[/\.rb$/]
|
|
52
53
|
url = @url + file
|