frontapp 0.0.5 → 0.0.6

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
  SHA1:
3
- metadata.gz: e74de615d1ace8618f995ce0726d5bfd7c04db4a
4
- data.tar.gz: 75e276ab77531bfa9b62f06133d6c9a4f5d1aa57
3
+ metadata.gz: 21123924669ec3ed3acb06f3c09cdce576f44f9e
4
+ data.tar.gz: 28fa78c13403a6be89b933b9e6762db018a82c6a
5
5
  SHA512:
6
- metadata.gz: cff32f334a4226301d08f8e35f84e22c43e490bfbd50dae690726130a84d4db21626a63369fa9edb4352d9e5688480d165dbdb4092ec2c7c2b604e710e7373e5
7
- data.tar.gz: 5bda12ca94202746d869934855e0fb979aea48eef57c0c95f502963b0f07f7e4ffe2a74b1fbf3f387fc8f94b7477d984dcbe9374d36bc7bfe48c0040ac1c7296
6
+ metadata.gz: 22cf99e634ae53981d14c257ce5e33830b31addb21d98d725651cbc49670c0be6e389b44ae6a664918530fcbc3244ab9f3ea554d8c7812cac609092e01f3c8cf
7
+ data.tar.gz: c4a1897cd45b6fb2ec90278240f57efd125d7948b4d289a268df62a4ca6cd1f8a3cc92a54e62b2a9498d0caeacd807e211caaf1e571a05abae826d70c4b8a2e2
@@ -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"]
@@ -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.class
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
@@ -1,3 +1,3 @@
1
1
  module Frontapp
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: frontapp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Niels van der Zanden