Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/fc_enrich/http_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion lib/fc_enrich/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module FcEnrich
VERSION = "0.3.2"
VERSION = "0.4.0"
end
12 changes: 12 additions & 0 deletions spec/fc_enrich/http_client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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