aranha 0.7.1 → 0.8.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: 60922cdd2cf85499d61a0265949a02085efab1f77af3235b88df39e1e8e317f7
|
|
4
|
+
data.tar.gz: c98e2261da5648745f3f3ca15af07c0fa49eb24b626973bee1b2270df2371c7a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 75a6acab99677f5842a96c2ed2da4fe91afaa47b15d8a5d44c67789509c8ceb8b76b3e06eae8aa31b3c83f65dda9228e97345c35cd58d2bf71e26921a11b8672
|
|
7
|
+
data.tar.gz: 6e54c2c96d6c35f0164fa1a406b64256fc7fc5e42030a839832a415775c649919f2d51fd32f8d90ba549e3345a2a74c912bc1bcbff55e15bd55cf7168dadc815
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require 'yaml'
|
|
4
4
|
require 'active_support/core_ext/module/delegation'
|
|
5
|
+
require 'aranha/parsers/source_address/hash_http_get'
|
|
5
6
|
require 'aranha/parsers/source_address/hash_http_post'
|
|
6
7
|
require 'aranha/parsers/source_address/http_get'
|
|
7
8
|
require 'aranha/parsers/source_address/file'
|
|
@@ -11,6 +12,7 @@ module Aranha
|
|
|
11
12
|
class SourceAddress
|
|
12
13
|
class << self
|
|
13
14
|
SUBS = [
|
|
15
|
+
::Aranha::Parsers::SourceAddress::HashHttpGet,
|
|
14
16
|
::Aranha::Parsers::SourceAddress::HashHttpPost,
|
|
15
17
|
::Aranha::Parsers::SourceAddress::HttpGet,
|
|
16
18
|
::Aranha::Parsers::SourceAddress::File
|
|
@@ -41,6 +43,10 @@ module Aranha
|
|
|
41
43
|
|
|
42
44
|
delegate :content, :url, to: :sub
|
|
43
45
|
|
|
46
|
+
def to_s
|
|
47
|
+
sub.url
|
|
48
|
+
end
|
|
49
|
+
|
|
44
50
|
def serialize
|
|
45
51
|
sub.serialize.strip + "\n"
|
|
46
52
|
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'aranha/parsers/source_address/hash_http_post'
|
|
4
|
+
|
|
5
|
+
module Aranha
|
|
6
|
+
module Parsers
|
|
7
|
+
class SourceAddress
|
|
8
|
+
class HashHttpGet < ::Aranha::Parsers::SourceAddress::HashHttpPost
|
|
9
|
+
class << self
|
|
10
|
+
def valid_source?(source)
|
|
11
|
+
source.is_a?(::Hash) &&
|
|
12
|
+
source.with_indifferent_access[:method].to_s.downcase.strip == 'get'
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def content
|
|
17
|
+
HTTPClient.new.get_content(
|
|
18
|
+
source[:url],
|
|
19
|
+
source[:params]
|
|
20
|
+
)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -10,7 +10,8 @@ module Aranha
|
|
|
10
10
|
class HashHttpPost
|
|
11
11
|
class << self
|
|
12
12
|
def valid_source?(source)
|
|
13
|
-
source.is_a?(::Hash) &&
|
|
13
|
+
source.is_a?(::Hash) &&
|
|
14
|
+
source.with_indifferent_access[:method].to_s.downcase.strip == 'post'
|
|
14
15
|
end
|
|
15
16
|
end
|
|
16
17
|
|
data/lib/aranha/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: aranha
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.8.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Eduardo H. Bogoni
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2019-
|
|
11
|
+
date: 2019-08-04 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: active_scaffold
|
|
@@ -151,6 +151,7 @@ files:
|
|
|
151
151
|
- lib/aranha/parsers/invalid_state_exception.rb
|
|
152
152
|
- lib/aranha/parsers/source_address.rb
|
|
153
153
|
- lib/aranha/parsers/source_address/file.rb
|
|
154
|
+
- lib/aranha/parsers/source_address/hash_http_get.rb
|
|
154
155
|
- lib/aranha/parsers/source_address/hash_http_post.rb
|
|
155
156
|
- lib/aranha/parsers/source_address/http_get.rb
|
|
156
157
|
- lib/aranha/parsers/spec/source_target_fixtures.rb
|
|
@@ -190,5 +191,5 @@ specification_version: 4
|
|
|
190
191
|
summary: Rails utilities for web crawling.
|
|
191
192
|
test_files:
|
|
192
193
|
- test/aranha_test.rb
|
|
193
|
-
- test/integration/navigation_test.rb
|
|
194
194
|
- test/test_helper.rb
|
|
195
|
+
- test/integration/navigation_test.rb
|