gusto_api 0.1.1 → 0.1.2

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: 1fa7c7bc3c02cbb17c06c63005b1c6df0dca3c5ac50c43b71c6e8b6815f222e9
4
- data.tar.gz: 80c19ffd0674c03acbb59d6efc1252e0e69aa7fe5002879aaa5f2753db81551a
3
+ metadata.gz: 842a1fbf1bfbbc65589efc1cd84e3b862bb90dcc145f3ad40ee9ba23899097c3
4
+ data.tar.gz: 31a3c2ff7404edc67465e4ba76fe34072ae83a60f8a5fd84fbe2dae939cd0b95
5
5
  SHA512:
6
- metadata.gz: 4a5304b3d84de4040c5834bef86c65be86c770d926d06a8defd2fb6e8f8202071526f08eee54277d6d7f7ed06ce5fe3cfc1a93bec7e47e32691d2c2243b62713
7
- data.tar.gz: 6a2d91e0bb89dce3a6399a1e0f92e00256efaadffd91f5e025512530488a730c70292f6ea02f83927b2a62cc55e893e2a8c2c0841835238c0fe406a213a7b453
6
+ metadata.gz: 06a1cbbd5ccf2b236fbf537663075b1a24c647d3366549f61d0c795996929de8ff4703a0c6a2b9b00ac026478e52c9e1f9249099fc02d68992a55ab2ca417113
7
+ data.tar.gz: d90ecac0c15e799c51456f9c9c2109536dd546d4b8eb25c584c0d497cb2f7915b22aa810456d4c9ac85bdd2da9cccf9f95009de9db86b94e5ab4e3e7f2509c53
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.2
4
+
5
+ Handle 401 responses from API by raising `GustoApi::InvalidAuthError`
6
+
3
7
  ## 0.1.1
4
8
 
5
9
  Initial release
data/README.md CHANGED
@@ -146,6 +146,14 @@ This will return a hash:
146
146
 
147
147
  ```
148
148
 
149
+ ### Errors
150
+
151
+ If you're missing an argument or something, the gem will raise `GustoApi::Error` with a hopefully helpful message.
152
+
153
+ If Gusto responds to an API call with a `401`, the gem will raise `GustoApi::InvalidAuthError`.
154
+
155
+ Other errors are not yet handled and you'll get a `HTTParty::Response` instance which responds to `code`.
156
+
149
157
  ### Getting a Company's Employees
150
158
 
151
159
  This and most other endpoints require getting an `access_token` via OAuth.
@@ -10,6 +10,7 @@ require "gusto_api/current_user"
10
10
 
11
11
  module GustoApi
12
12
  class Error < StandardError; end
13
+ class InvalidAuthError < Error; end
13
14
 
14
15
  class << self
15
16
  attr_writer :configuration
@@ -13,7 +13,9 @@ module GustoApi
13
13
  end
14
14
 
15
15
  def submit
16
- HTTParty.send(method, url, options)
16
+ HTTParty.send(method, url, options).tap do |response|
17
+ raise InvalidAuthError.new("Invalid or expired auth token") if response.code == 401
18
+ end
17
19
  end
18
20
 
19
21
  private
@@ -1,3 +1,3 @@
1
1
  module GustoApi
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gusto_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jon Evans