Class: Yapi::OpenLocalPlatform::GeoCoder

Inherits:
Object
  • Object
show all
Defined in:
lib/yapi/open_local_platform.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_key) ⇒ GeoCoder

Returns a new instance of GeoCoder.



10
11
12
13
# File 'lib/yapi/open_local_platform.rb', line 10

def initialize(api_key)
  @client = Client.new(api_key)
  self.config = {}
end

Instance Attribute Details

#configObject

Returns the value of attribute config.



8
9
10
# File 'lib/yapi/open_local_platform.rb', line 8

def config
  @config
end

Instance Method Details

#configure(options = {}) ⇒ Object



15
16
17
18
19
# File 'lib/yapi/open_local_platform.rb', line 15

def configure(options = {})
  options.each do |key, value|
    self.config[key] = value
  end
end

#geoCoderObject



21
22
23
24
# File 'lib/yapi/open_local_platform.rb', line 21

def geoCoder
  req_url = "https://map.yahooapis.jp/geocode/V1/geoCoder?appid=#{@client.get_api_key}#{@client.build_url(self.config)}"
  return @client.xml_to_json(open(URI.encode(req_url)).read)
end