Class: Yapi::OpenLocalPlatform::ContentsGeoCoder
- Inherits:
-
Object
- Object
- Yapi::OpenLocalPlatform::ContentsGeoCoder
- 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
- #contentsGeoCoder(query) ⇒ Object
-
#initialize(api_key) ⇒ ContentsGeoCoder
constructor
A new instance of ContentsGeoCoder.
Constructor Details
#initialize(api_key) ⇒ ContentsGeoCoder
Returns a new instance of ContentsGeoCoder.
50 51 52 53 |
# File 'lib/yapi/open_local_platform.rb', line 50 def initialize(api_key) @client = Client.new(api_key) self.config = {} end |
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
48 49 50 |
# File 'lib/yapi/open_local_platform.rb', line 48 def config @config end |
Instance Method Details
#configure(options = {}) ⇒ Object
55 56 57 58 59 |
# File 'lib/yapi/open_local_platform.rb', line 55 def configure( = {}) .each do |key, value| self.config[key] = value end end |
#contentsGeoCoder(query) ⇒ Object
61 62 63 64 |
# File 'lib/yapi/open_local_platform.rb', line 61 def contentsGeoCoder query req_url = "http://contents.search.olp.yahooapis.jp/OpenLocalPlatform/V1/contentsGeoCoder?appid=#{@client.get_api_key}#{@client.build_url(self.config)}&query=#{query}" return @client.xml_to_json(open(URI.encode(req_url)).read) end |