super_parser 0.1.0 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/super_parser/client.rb +3 -1
- data/lib/super_parser/client_error.rb +2 -2
- data/lib/super_parser/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b5e0636d567f2013c3794af9fff80d0b8a25ad9ca16638b9e771a81527751510
|
4
|
+
data.tar.gz: d833ac00a7db001f0758527e3259634022809b6b6978026a1cf8e65d963c1cb5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da120f9282c2879e70c9f6886c59d32263f5e3cde9c1d32d94b001aba6db11e84ee5647d458c5ad7a8ecdb94c697656026bc19b8d27e3a936d610877c5767d49
|
7
|
+
data.tar.gz: f9e807599f26e67938f46c899618673a4af0f83815d41740d85612dc57fd64d32f4a01761ab87543dc8baa52a6c4525c7c8451280a1235aa8636f1f49acb89f3
|
data/Gemfile.lock
CHANGED
data/lib/super_parser/client.rb
CHANGED
@@ -6,6 +6,8 @@ require_relative 'client_error'
|
|
6
6
|
module SuperParser # :nodoc:
|
7
7
|
class Client
|
8
8
|
def parse(filepath)
|
9
|
+
puts "Parsing #{filepath}..."
|
10
|
+
|
9
11
|
uri = URI('https://api.superparser.com/parse')
|
10
12
|
request = Net::HTTP::Post.new(uri)
|
11
13
|
request['X-API-KEY'] = SuperParser.api_key
|
@@ -19,7 +21,7 @@ module SuperParser # :nodoc:
|
|
19
21
|
http.request(request)
|
20
22
|
end
|
21
23
|
|
22
|
-
if response.code != 200
|
24
|
+
if response.code != '200'
|
23
25
|
SuperParser::ClientError.new response
|
24
26
|
else
|
25
27
|
SuperParser::Response.new(response.body)
|
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
module SuperParser # :nodoc:
|
4
4
|
class ClientError < StandardError
|
5
|
-
attr_reader :
|
5
|
+
attr_reader :code
|
6
6
|
|
7
7
|
def initialize(response)
|
8
8
|
error = JSON.parse response.body
|
9
|
-
@
|
9
|
+
@code = response.code
|
10
10
|
super(error['message'])
|
11
11
|
end
|
12
12
|
end
|
data/lib/super_parser/version.rb
CHANGED