aranha-parsers 0.8.4 → 0.8.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 122956cfc78e267310a3c1815bd77374141197e733e536ae6e5e1ba767fd848e
4
- data.tar.gz: 8bd3001180026392e7b2893155c09001e6902ee786efd10dd45c00765fd7367a
3
+ metadata.gz: 9fd66650df384bfd84cc234f0ed901e426f0000a7f11bd8cdcec959d5690efdb
4
+ data.tar.gz: a0b80baee8f763633753c9fefacd5a0ab528a8047a8f14a876a08f0cd443c6a1
5
5
  SHA512:
6
- metadata.gz: 7cb4b401b91de088cc8c3196561cf33f5b6056643dcd8467909b1d2f27a98118701902bb0e45f9c0e79a4bd08e0385db5df0f782d51617473eb9b015e1576acc
7
- data.tar.gz: f5288fc459db6b41ecdbacf6f49591b8b39b307150ef371f9a36e9886bca74966d14197d74224d4a3afa0f41b29283d3836ab93e30b57311f200e24c1401d646
6
+ metadata.gz: f9bd1e8d032eb4f782526e45b549aecdf6951a9c28ba55296293128d4a655a14f8cafda545560d794c5f39a4798c65b96c39e2e5dcea324057a85c5dec492d01
7
+ data.tar.gz: 577bd16ed893fa9df121de6be1844aefc1f178790871aa89caa9073633e83682059f326de48d8561a7928857d26c08f57bbc655d0205b2a7ef7126dd922e2398
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Aranha
4
+ module Parsers
5
+ class SourceAddress
6
+ class FetchContentError < ::RuntimeError
7
+ end
8
+ end
9
+ end
10
+ end
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'addressable'
4
4
  require 'curb'
5
+ require 'aranha/parsers/source_address/fetch_content_error'
5
6
 
6
7
  module Aranha
7
8
  module Parsers
@@ -34,15 +35,27 @@ module Aranha
34
35
  def content
35
36
  c = ::Curl::Easy.new(url)
36
37
  c.follow_location = true
37
- raise "Curl perform failed (URL: #{url})" unless c.perform
38
+ curl_perform(c)
38
39
  return c.body_str if c.status.to_i == 200
39
40
 
40
- raise "Get #{url} returned #{c.status.to_i}"
41
+ raise ::Aranha::Parsers::SourceAddress::FetchContentError,
42
+ "Get #{url} returned #{c.status.to_i}"
41
43
  end
42
44
 
43
45
  def serialize
44
46
  url
45
47
  end
48
+
49
+ private
50
+
51
+ def curl_perform(curl)
52
+ unless curl.perform
53
+ raise(::Aranha::Parsers::SourceAddress::FetchContentError,
54
+ "Curl perform failed (URL: #{url})")
55
+ end
56
+ rescue Curl::Err::CurlError => e
57
+ raise ::Aranha::Parsers::SourceAddress::FetchContentError, "CURL error: #{e.class.name}"
58
+ end
46
59
  end
47
60
  end
48
61
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Aranha
4
4
  module Parsers
5
- VERSION = '0.8.4'
5
+ VERSION = '0.8.5'
6
6
  end
7
7
  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.8.4
4
+ version: 0.8.5
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-09-04 00:00:00.000000000 Z
11
+ date: 2021-09-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -86,6 +86,26 @@ dependencies:
86
86
  - - ">="
87
87
  - !ruby/object:Gem::Version
88
88
  version: 2.8.3
89
+ - !ruby/object:Gem::Dependency
90
+ name: nokogiri
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - "~>"
94
+ - !ruby/object:Gem::Version
95
+ version: '1.12'
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ version: 1.12.4
99
+ type: :runtime
100
+ prerelease: false
101
+ version_requirements: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - "~>"
104
+ - !ruby/object:Gem::Version
105
+ version: '1.12'
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ version: 1.12.4
89
109
  - !ruby/object:Gem::Dependency
90
110
  name: ofx-parser
91
111
  requirement: !ruby/object:Gem::Requirement
@@ -143,6 +163,7 @@ files:
143
163
  - lib/aranha/parsers/rspec/setup.rb
144
164
  - lib/aranha/parsers/rspec/shared_examples/source_target_fixtures.rb
145
165
  - lib/aranha/parsers/source_address.rb
166
+ - lib/aranha/parsers/source_address/fetch_content_error.rb
146
167
  - lib/aranha/parsers/source_address/file.rb
147
168
  - lib/aranha/parsers/source_address/hash_http_get.rb
148
169
  - lib/aranha/parsers/source_address/hash_http_post.rb