lib/geonames_api.rb in geonames_api-0.0.1 vs lib/geonames_api.rb in geonames_api-0.0.2
- old
+ new
@@ -1,19 +1,19 @@
require 'open-uri'
require 'json'
require 'active_support/all'
require "geonames_api/version"
+require "geonames_api/hash"
+require "geonames_api/object"
require "geonames_api/country"
require "geonames_api/weather"
module GeoNamesAPI
- BASE_URL = "http://api.geonames.org/"
- def self.to_url_params(params)
- "?" + params.collect { |key, value| "#{key}=#{value}" }.join("&")
- end
-
+ mattr_accessor :url
+ @@url = "http://api.geonames.org/"
+
mattr_accessor :formatted
@@formatted = true
mattr_accessor :lang
@@lang = :en
@@ -26,17 +26,7 @@
def self.params
{ formatted: formatted, lang: lang, username: username, style: style }
end
- def self.set_default_type(value)
- case value
- when /\A\d+\Z/
- value.to_i
- when /\A\d*\.\d*\Z/
- value.to_f
- else
- value
- end
- end
end