Sha256: b88a39de815e0151626d146fd64d2b287648f3d83681fea6f75868eefadd3607
Contents?: true
Size: 994 Bytes
Versions: 1
Compression:
Stored size: 994 Bytes
Contents
module GmapsTz class Error < StandardError def self.from_response(uri, response) json = JSON.parse(response.body) klass = case json["status"] when "INVALID_REQUEST" InvalidRequestError when "OVER_QUERY_LIMIT" OverQueryLimitError when "REQUEST_DENIED" RequestDeniedError when "UNKNOWN_ERROR" UnknownError when "ZERO_RESULTS" ZeroResultsError else UnexpectedResponseError end klass.new(uri, response) end attr_accessor :uri, :result def initialize(uri, result) @uri = uri @result = result end end class InvalidRequestError < Error; end class OverQueryLimitError < Error; end class RequestDeniedError < Error; end class UnknownError < Error; end class ZeroResultsError < Error; end class UnexpectedResponseError < Error; end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
gmaps_tz-0.0.1 | lib/gmaps_tz/error.rb |