lib/google_timezone/base.rb in google_timezone-0.0.1 vs lib/google_timezone/base.rb in google_timezone-0.0.3
- old
+ new
@@ -1,11 +1,14 @@
require 'json'
require 'open-uri'
module GoogleTimezone
+
+ class Error < StandardError; end
+
class Base
- @allowed_params = [:language, :sensor, :timestamp, :client, :signature]
+ @allowed_params = [:language, :sensor, :timestamp, :client, :signature, :key]
def initialize(*args)
@lat, @lon = if args.first.is_a? Array
args.first
else
@@ -22,10 +25,10 @@
Result.new(result)
end
def fetch!
result = fetch
- raise_error(result.result) unless result.success?
+ raise(GoogleTimezone::Error.new(result.result)) unless result.success?
result
end
private
def hash_to_query(hash)
\ No newline at end of file