aranha-parsers 0.8.5 → 0.9.0
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb3631929ccd8b029ab5b097554f96f5eb0cc27dcf8767d3a8a97f050ee60b80
|
4
|
+
data.tar.gz: f30f306452ac72997887550051954d290f7e6c321b694236fd9f49bc6fff5d4a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 35ebd10ceebadd29ade03ef0c5a75ed024e8d4377b19295861d8ef4c4e3bb4e091df5ff9f74398f523c98e0e3ee65eac1352bedc39eae033000cdc8561c5b749
|
7
|
+
data.tar.gz: 68a7664bef2ffd163cf110f14779feb92305b90cfb6b23e8d254c4cf2ca6871233d64032704790dd30397383cc67fd5a5b5dc9e67a1d866f1365524707b5ebb5
|
data/lib/aranha/parsers/base.rb
CHANGED
@@ -11,7 +11,9 @@ module Aranha
|
|
11
11
|
class << self
|
12
12
|
def from_content(content)
|
13
13
|
::EacRubyUtils::Fs::Temp.on_file do |path|
|
14
|
-
path.
|
14
|
+
::File.open(path.to_s, 'w:UTF-8') do |f|
|
15
|
+
f.write content.force_encoding('UTF-8')
|
16
|
+
end
|
15
17
|
r = new(path.to_path)
|
16
18
|
r.content
|
17
19
|
r
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'aranha/parsers/base'
|
4
|
+
require 'json'
|
5
|
+
|
6
|
+
module Aranha
|
7
|
+
module Parsers
|
8
|
+
module Json
|
9
|
+
class Base < ::Aranha::Parsers::Base
|
10
|
+
def data
|
11
|
+
default_data
|
12
|
+
end
|
13
|
+
|
14
|
+
def default_data
|
15
|
+
::JSON.parse(content)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -32,6 +32,11 @@ module Aranha
|
|
32
32
|
source
|
33
33
|
end
|
34
34
|
|
35
|
+
def final_url
|
36
|
+
content unless @final_url
|
37
|
+
@final_url
|
38
|
+
end
|
39
|
+
|
35
40
|
def content
|
36
41
|
c = ::Curl::Easy.new(url)
|
37
42
|
c.follow_location = true
|
@@ -53,6 +58,7 @@ module Aranha
|
|
53
58
|
raise(::Aranha::Parsers::SourceAddress::FetchContentError,
|
54
59
|
"Curl perform failed (URL: #{url})")
|
55
60
|
end
|
61
|
+
@final_url = curl.url
|
56
62
|
rescue Curl::Err::CurlError => e
|
57
63
|
raise ::Aranha::Parsers::SourceAddress::FetchContentError, "CURL error: #{e.class.name}"
|
58
64
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aranha-parsers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Esquilo Azul Company
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-10-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -157,6 +157,8 @@ files:
|
|
157
157
|
- lib/aranha/parsers/html/node/base.rb
|
158
158
|
- lib/aranha/parsers/html/node/default.rb
|
159
159
|
- lib/aranha/parsers/invalid_state_exception.rb
|
160
|
+
- lib/aranha/parsers/json.rb
|
161
|
+
- lib/aranha/parsers/json/base.rb
|
160
162
|
- lib/aranha/parsers/patches.rb
|
161
163
|
- lib/aranha/parsers/patches/ofx_parser.rb
|
162
164
|
- lib/aranha/parsers/rspec.rb
|