rxfreader 0.1.0 → 0.1.1
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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/rxfreader.rb +21 -22
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4d727c39797772365eade04c0cb3db23b5ab88cd747ab7f3a37f290ef986abd5
|
4
|
+
data.tar.gz: 0f9f5858353eb8ed0b36ef7c6fadb6c21d99bdb39eb3df3c3d9d07c8cffbd390
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50067b4d177ae9c8d5e2945b6b3aa64e8a55d58b12d81e9d3b3c6e52cab94d570b1e1cf2cc18a19bc344f0079de3dbe41b569ca964197189093c1648eb8677c6
|
7
|
+
data.tar.gz: 8796bc6d4d63b82fd44b70f3241e5ac0f2241016f8549c3955fabd25ace15afca2d268a18e1a42d9d1b1de0cd66751e504979b00e9f26d5411a1dfd99b072295
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/rxfreader.rb
CHANGED
@@ -16,7 +16,7 @@ module RXFRead
|
|
16
16
|
class FileX
|
17
17
|
|
18
18
|
def self.read(x)
|
19
|
-
|
19
|
+
RXFReader.read(x).first
|
20
20
|
end
|
21
21
|
|
22
22
|
end
|
@@ -29,65 +29,64 @@ end
|
|
29
29
|
class RXFReader
|
30
30
|
using ColouredText
|
31
31
|
|
32
|
-
def self.read(x, h={})
|
33
|
-
|
32
|
+
def self.read(x, h={})
|
33
|
+
|
34
34
|
opt = {debug: false, auto: false}.merge(h)
|
35
|
-
|
35
|
+
|
36
36
|
debug = opt[:debug]
|
37
37
|
|
38
38
|
raise RXFReaderException, 'nil found, expected a string' if x.nil?
|
39
39
|
|
40
40
|
if x.strip[/^<(\?xml|[^\?])/] then
|
41
|
-
|
41
|
+
|
42
42
|
[x, :xml]
|
43
43
|
|
44
44
|
elsif x.lines.length == 1 then
|
45
45
|
|
46
46
|
if x[/^https?:\/\//] then
|
47
|
-
|
47
|
+
|
48
48
|
puts 'before GPDRequest'.info if debug
|
49
|
-
|
49
|
+
|
50
50
|
r = if opt[:username] and opt[:password] then
|
51
51
|
GPDRequest.new(opt[:username], opt[:password]).get(x)
|
52
52
|
else
|
53
53
|
response = RestClient.get(x)
|
54
54
|
end
|
55
|
-
|
55
|
+
|
56
56
|
case r.code
|
57
|
-
when '404'
|
57
|
+
when '404'
|
58
58
|
raise(RXFReaderException, "404 %s not found" % x)
|
59
|
-
when '401'
|
59
|
+
when '401'
|
60
60
|
raise(RXFReaderException, "401 %s unauthorized access" % x)
|
61
61
|
end
|
62
|
-
|
62
|
+
|
63
63
|
[r.body, :url]
|
64
|
-
|
64
|
+
|
65
65
|
elsif x[/^dfs:\/\//] then
|
66
|
-
|
67
|
-
r = DfsFile.read(x)
|
66
|
+
|
67
|
+
r = DfsFile.read(x).force_encoding('UTF-8')
|
68
68
|
[r, :dfs]
|
69
|
-
|
69
|
+
|
70
70
|
|
71
71
|
elsif x[/^file:\/\//] or File.exists?(x) then
|
72
|
-
|
72
|
+
|
73
73
|
puts 'RXFHelper.read before File.read' if debug
|
74
74
|
contents = File.read(File.expand_path(x.sub(%r{^file://}, '')))
|
75
|
-
|
75
|
+
|
76
76
|
[contents, :file]
|
77
|
-
|
77
|
+
|
78
78
|
elsif x =~ /\s/
|
79
79
|
[x, :text]
|
80
80
|
elsif DfsFile.exists?(x)
|
81
|
-
[DfsFile.read(x), :dfs]
|
81
|
+
[DfsFile.read(x).force_encoding('UTF-8'), :dfs]
|
82
82
|
else
|
83
83
|
[x, :unknown]
|
84
84
|
end
|
85
|
-
|
85
|
+
|
86
86
|
else
|
87
87
|
|
88
88
|
[x, :unknown]
|
89
89
|
end
|
90
90
|
end
|
91
|
-
|
92
|
-
end
|
93
91
|
|
92
|
+
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rxfreader
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
ZhYGFOGLCyFBzNWg6gwMKjzpzDZB/H0+GTRB2c3+7DVuJWqyC5SbGnVLkT4Q8+B6
|
36
36
|
Ws39Z48SRONdDWtHwAiUtnU+
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2022-02-
|
38
|
+
date: 2022-02-19 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: gpd-request
|
metadata.gz.sig
CHANGED
Binary file
|