diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f9fecb..e8e5c2f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ +## [0.4.0] +* Add RestClient::Gone exception handling to return nil for HTTP 410 responses +* Add test coverage for RestClient::Gone exception handling + ## [0.3.1] -* Additional fake options to make integration testing easier +* Additional fake options to make integration testing easier ## [0.3.0] * CompanyEnrichRequest diff --git a/lib/fc_enrich/http_client.rb b/lib/fc_enrich/http_client.rb index fddbdcf..2975426 100644 --- a/lib/fc_enrich/http_client.rb +++ b/lib/fc_enrich/http_client.rb @@ -8,7 +8,7 @@ def post(path, payload_hash) MultiJson.encode(payload_hash), authorization: "Bearer #{FcEnrich.api_key}") MultiJson.decode(response.body) - rescue RestClient::NotFound, RestClient::UnprocessableEntity + rescue RestClient::NotFound, RestClient::UnprocessableEntity, RestClient::Gone nil rescue RestClient::BadRequest => e raise FcEnrich::BadRequest.new(e.response) diff --git a/lib/fc_enrich/version.rb b/lib/fc_enrich/version.rb index 9217462..0a1356b 100644 --- a/lib/fc_enrich/version.rb +++ b/lib/fc_enrich/version.rb @@ -1,3 +1,3 @@ module FcEnrich - VERSION = "0.3.2" + VERSION = "0.4.0" end diff --git a/spec/fc_enrich/http_client_spec.rb b/spec/fc_enrich/http_client_spec.rb index 0abf94e..49a8def 100644 --- a/spec/fc_enrich/http_client_spec.rb +++ b/spec/fc_enrich/http_client_spec.rb @@ -57,5 +57,17 @@ module FcEnrich data = subject.post("/v3/person.enrich", { my_data: "true" }) expect(data).to be_nil end + + it 'handles 410' do + stub_request(:post, "https://api.fullcontact.com/v3/person.enrich") + .with( + body: "{\"my_data\":\"true\"}", + headers: { 'Authorization' => 'Bearer TEST!' } + ) + .and_raise(RestClient::Gone) + + data = subject.post("/v3/person.enrich", { my_data: "true" }) + expect(data).to be_nil + end end end