Class: Yapi::PlaceInfo
- Inherits:
-
Object
- Object
- Yapi::PlaceInfo
- Defined in:
- lib/yapi/placeinfo.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
Instance Method Summary collapse
- #configure(options = {}) ⇒ Object
- #get(lat, lon) ⇒ Object
-
#initialize(api_key) ⇒ PlaceInfo
constructor
A new instance of PlaceInfo.
Constructor Details
#initialize(api_key) ⇒ PlaceInfo
Returns a new instance of PlaceInfo.
9 10 11 12 |
# File 'lib/yapi/placeinfo.rb', line 9 def initialize(api_key) @client = Client.new(api_key) self.config = {} end |
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
7 8 9 |
# File 'lib/yapi/placeinfo.rb', line 7 def config @config end |
Instance Method Details
#configure(options = {}) ⇒ Object
14 15 16 17 18 |
# File 'lib/yapi/placeinfo.rb', line 14 def configure( = {}) .each do |key, value| self.config[key] = value end end |
#get(lat, lon) ⇒ Object
20 21 22 23 |
# File 'lib/yapi/placeinfo.rb', line 20 def get lat,lon req_url = "http://placeinfo.olp.yahooapis.jp/V1/get?appid=#{@client.get_api_key}#{@client.build_url(self.config)}&output=xml&lat=#{lat}&lon=#{lon}" return @client.xml_to_json(open(URI.encode(req_url)).read) end |