Merge pull request #2838 from betagouv/rest-client

Simplify ApiCarto::API.call
This commit is contained in:
gregoirenovel 2018-10-16 10:23:11 +02:00 committed by GitHub
commit 00dd1ed806
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -12,11 +12,9 @@ class ApiCarto::API
private
def self.call(url, geojson)
verify_ssl_mode = OpenSSL::SSL::VERIFY_NONE
params = geojson.to_s
client = RestClient::Resource.new(url, verify_ssl: verify_ssl_mode)
client.post(params, content_type: 'application/json')
RestClient.post(url, params, content_type: 'application/json')
rescue RestClient::InternalServerError
raise RestClient::ResourceNotFound