frontapp 0.0.5 → 0.0.6
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 +4 -4
- data/lib/frontapp/client.rb +3 -0
- data/lib/frontapp/error.rb +3 -1
- data/lib/frontapp/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 21123924669ec3ed3acb06f3c09cdce576f44f9e
|
4
|
+
data.tar.gz: 28fa78c13403a6be89b933b9e6762db018a82c6a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22cf99e634ae53981d14c257ce5e33830b31addb21d98d725651cbc49670c0be6e389b44ae6a664918530fcbc3244ab9f3ea554d8c7812cac609092e01f3c8cf
|
7
|
+
data.tar.gz: c4a1897cd45b6fb2ec90278240f57efd125d7948b4d289a268df62a4ca6cd1f8a3cc92a54e62b2a9498d0caeacd807e211caaf1e571a05abae826d70c4b8a2e2
|
data/lib/frontapp/client.rb
CHANGED
@@ -53,6 +53,9 @@ module Frontapp
|
|
53
53
|
url = "#{base_url}#{path}?#{query}"
|
54
54
|
until last_page
|
55
55
|
res = @headers.get(url)
|
56
|
+
if !res.status.success?
|
57
|
+
raise Error.from_response(res)
|
58
|
+
end
|
56
59
|
response = JSON.parse(res.to_s)
|
57
60
|
items.concat(response["_results"]) if response["_results"]
|
58
61
|
pagination = response["_pagination"]
|
data/lib/frontapp/error.rb
CHANGED
@@ -3,9 +3,10 @@ module Frontapp
|
|
3
3
|
def self.from_response(response)
|
4
4
|
error_class = case response.status
|
5
5
|
when 400 then BadRequestError
|
6
|
+
when 401 then UnauthorizedError
|
6
7
|
when 404 then NotFoundError
|
7
8
|
when 409 then ConflictError
|
8
|
-
else self
|
9
|
+
else self
|
9
10
|
end
|
10
11
|
error_class.new(response)
|
11
12
|
end
|
@@ -19,4 +20,5 @@ module Frontapp
|
|
19
20
|
class BadRequestError < Error; end
|
20
21
|
class NotFoundError < Error; end
|
21
22
|
class ConflictError < Error; end
|
23
|
+
class UnauthorizedError < Error; end
|
22
24
|
end
|
data/lib/frontapp/version.rb
CHANGED