Initial commit

This commit is contained in:
zhongjin
2020-06-15 10:58:47 +08:00
commit 4f1dfe7564
8590 changed files with 1516878 additions and 0 deletions
@@ -0,0 +1,30 @@
require_relative 'client'
require_relative 'convert'
module Carto
module Gme
# The responsibility of this class is to geocode addresses by requesting gme.
class GeocoderClient
attr_reader :client
def initialize(client)
@client = client
end
def geocode(address=nil, components=nil, bounds=nil, region=nil, language=nil)
params = {}
params['address'] = address if address
params['components'] = Convert.components(components) if components # TODO convert
params['bounds'] = Convert.bounds(bounds) if bounds # TODO convert
params['region'] = region if region
params['language'] = language if language
client.get('/maps/api/geocode/json', params)
end
end
end
end