demarches-normaliennes/app/lib/carto/bano/driver.rb
2016-12-02 17:03:52 +01:00

22 lines
445 B
Ruby

module Carto
module Bano
# input : string (address)
# output : json
class Driver
def initialize(address, limit = 1)
@address = address
@limit = limit
end
def call
RestClient.get api_url, params: { q: @address, limit: @limit }
rescue RestClient::ServiceUnavailable
nil
end
def api_url
'http://api-adresse.data.gouv.fr/search'
end
end
end
end