Class: Geocoder
- Inherits:
-
Object
- Object
- Geocoder
- Defined in:
- lib/kamelopard/geocode.rb
Overview
Geocoder base class. You should use a subclass. It is your responsibility to ensure you comply with all API licensing and usage requirements. Kamelopard won’t do it for you.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#host ⇒ Object
Returns the value of attribute host.
-
#params ⇒ Object
Returns the value of attribute params.
-
#path ⇒ Object
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize ⇒ Geocoder
constructor
A new instance of Geocoder.
- #parse_response(r) ⇒ Object
- #processParam(value, key = 'location') ⇒ Object
Constructor Details
#initialize ⇒ Geocoder
Returns a new instance of Geocoder.
15 16 17 |
# File 'lib/kamelopard/geocode.rb', line 15 def initialize @params = {} end |
Instance Attribute Details
#host ⇒ Object
Returns the value of attribute host.
14 15 16 |
# File 'lib/kamelopard/geocode.rb', line 14 def host @host end |
#params ⇒ Object
Returns the value of attribute params.
14 15 16 |
# File 'lib/kamelopard/geocode.rb', line 14 def params @params end |
#path ⇒ Object
Returns the value of attribute path.
14 15 16 |
# File 'lib/kamelopard/geocode.rb', line 14 def path @path end |
Instance Method Details
#parse_response(r) ⇒ Object
29 30 31 |
# File 'lib/kamelopard/geocode.rb', line 29 def parse_response(r) raise "Unimplemented -- use a child of the Geocoder class" end |
#processParam(value, key = 'location') ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/kamelopard/geocode.rb', line 19 def processParam(value, key = 'location') return ["#{key}=#{value}"] if key == 'key' if value.kind_of? Hash then p = value.map { |k, v| "#{CGI.escape(k)}=#{CGI.escape(v)}" } else p = ["#{CGI.escape(key)}=#{CGI.escape(value)}"] end return p end |