fulfil-io 0.4.2 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -13
- data/lib/fulfil/client.rb +10 -4
- data/lib/fulfil/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d1e18bf38ef0d20058704b439d3b633cd2a2d6c36d6eb3498764473ecdc18542
|
4
|
+
data.tar.gz: ef37d25469b610f6d1d7ef4e1ef41e681b514f39d147e652338464fd9a2fb977
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d33dc2d8553c14c08284d6823bd0285c28bb168785e9c9885cfd9718e8233d804860348cd7ea2bcec56141de976153bd605dfabab4ce73ce958a4935abc9a17d
|
7
|
+
data.tar.gz: 634d58e4e9780873f4ff9c1823ab8fb1a08de125e6906ed48d50773b838015e7ea4cf8abd65ee3df26f035eab6a1131ab75a56511b3f55400e2b67f17a7b42f0
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
## 0.4.3
|
2
|
+
|
3
|
+
* Add Client errors for more granular handling.
|
4
|
+
* Send along info when a `NotAuthorizedError` is raised.
|
5
|
+
|
1
6
|
## 0.4.2
|
2
7
|
|
3
8
|
* Raise an `UnhandledTypeError` and reveal the offender.
|
@@ -6,7 +11,8 @@
|
|
6
11
|
|
7
12
|
## 0.4.1
|
8
13
|
|
9
|
-
* @cdmwebs screwed up the release process, so this is a tiny bump to fix. No
|
14
|
+
* @cdmwebs screwed up the release process, so this is a tiny bump to fix. No
|
15
|
+
code changes.
|
10
16
|
|
11
17
|
## 0.4.0
|
12
18
|
|
@@ -18,18 +24,16 @@
|
|
18
24
|
|
19
25
|
## 0.2.0
|
20
26
|
|
21
|
-
|
22
|
-
, because initially implemented in
|
23
|
-
|
24
|
-
|
25
|
-
' class.
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
- Add Gemfile.lock to .gitignore and remove it from git-tree - it shouldn't be stored in git for a gem.
|
27
|
+
* Make token optional and allow specifying headers at least for enabling
|
28
|
+
authentication via 'X-API-KEY' header , because initially implemented in
|
29
|
+
0.1.0 bearer auth isn't working.
|
30
|
+
* Fix Query `build_search_term` and `build_exclude_term` to be compatible with
|
31
|
+
Ruby < 2.4, analyzing value for 'Fixnum ' class.
|
32
|
+
* Fix the gem's name in gemspec to 'fulfil-io', as registered at RubyGems.
|
33
|
+
* Remove Rake version constraint from gemspec.
|
34
|
+
* Add Gemfile.lock to .gitignore and remove it from git-tree - it shouldn't be
|
35
|
+
stored in git for a gem.
|
32
36
|
|
33
37
|
## 0.1.0
|
34
38
|
|
35
|
-
* Initial gem release
|
39
|
+
* Initial gem release.
|
data/lib/fulfil/client.rb
CHANGED
@@ -10,6 +10,11 @@ module Fulfil
|
|
10
10
|
OAUTH_TOKEN = ENV['FULFIL_TOKEN']
|
11
11
|
|
12
12
|
class Client
|
13
|
+
class NotAuthorizedError < StandardError; end
|
14
|
+
class UnknownHTTPError < StandardError; end
|
15
|
+
class ConnectionError < StandardError; end
|
16
|
+
class ResponseError < StandardError; end
|
17
|
+
|
13
18
|
def initialize(subdomain: SUBDOMAIN, token: OAUTH_TOKEN, headers: { 'X-API-KEY' => API_KEY }, debug: false)
|
14
19
|
@subdomain = subdomain
|
15
20
|
@token = token
|
@@ -105,19 +110,20 @@ module Fulfil
|
|
105
110
|
if response.status.ok? || response.status.created?
|
106
111
|
response.parse
|
107
112
|
elsif response.code == 401
|
108
|
-
|
113
|
+
error = response.parse
|
114
|
+
raise NotAuthorizedError, "Not authorized: #{error['error']}: #{error['error_description']}"
|
109
115
|
else
|
110
116
|
puts response.body.to_s
|
111
117
|
raise Error, 'Error encountered while processing response:'
|
112
118
|
end
|
113
119
|
rescue HTTP::Error => e
|
114
120
|
puts e
|
115
|
-
raise
|
121
|
+
raise UnknownHTTPError, 'Unhandled HTTP error encountered'
|
116
122
|
rescue HTTP::ConnectionError => e
|
117
123
|
puts "Couldn't connect"
|
118
|
-
raise
|
124
|
+
raise ConnectionError, "Can't connect to #{base_url}"
|
119
125
|
rescue HTTP::ResponseError => ex
|
120
|
-
raise
|
126
|
+
raise ResponseError, "Can't process response: #{ex}"
|
121
127
|
[]
|
122
128
|
end
|
123
129
|
|
data/lib/fulfil/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fulfil-io
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Moore
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-11-
|
12
|
+
date: 2020-11-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: http
|