Class: Yapi::OpenLocalPlatform::ReverseGeoCoder
- Inherits:
-
Object
- Object
- Yapi::OpenLocalPlatform::ReverseGeoCoder
- Defined in:
- lib/yapi/open_local_platform.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
Instance Method Summary collapse
- #configure(options = {}) ⇒ Object
- #geoCoder(lat, lon) ⇒ Object
-
#initialize(api_key) ⇒ ReverseGeoCoder
constructor
A new instance of ReverseGeoCoder.
Constructor Details
#initialize(api_key) ⇒ ReverseGeoCoder
Returns a new instance of ReverseGeoCoder.
30 31 32 33 |
# File 'lib/yapi/open_local_platform.rb', line 30 def initialize(api_key) @client = Client.new(api_key) self.config = {} end |
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
28 29 30 |
# File 'lib/yapi/open_local_platform.rb', line 28 def config @config end |
Instance Method Details
#configure(options = {}) ⇒ Object
35 36 37 38 39 |
# File 'lib/yapi/open_local_platform.rb', line 35 def configure( = {}) .each do |key, value| self.config[key] = value end end |
#geoCoder(lat, lon) ⇒ Object
41 42 43 44 |
# File 'lib/yapi/open_local_platform.rb', line 41 def geoCoder lat,lon req_url = "https://map.yahooapis.jp/geoapi/V1/reverseGeoCoder?appid=#{@client.get_api_key}#{@client.build_url(self.config)}&lat=#{lat}&lon=#{lon}" return @client.xml_to_json(open(URI.encode(req_url)).read) end |