Class: GoogleMapsPlatform::TimeZoneStatus

Inherits:
Object
  • Object
show all
Defined in:
lib/google_maps_platform/models/time_zone_status.rb

Overview

The status field within the Time Zone response object contains the status of the request. The status field may contain the following values: - OK indicates that the request was successful. - INVALID_REQUEST indicates that the request was malformed. - OVER_DAILY_LIMIT indicates any of the following: - The API key is missing or invalid. - Billing has not been enabled on your account. - A self-imposed usage cap has been exceeded. - The provided method of payment is no longer valid (for example, a credit card has expired). - OVER_QUERY_LIMIT indicates the requestor has exceeded quota. - REQUEST_DENIED indicates that the API did not complete the request. Confirm that the request was sent over HTTPS instead of HTTP. - UNKNOWN_ERROR indicates an unknown error. - ZERO_RESULTS indicates that no time zone data could be found for the specified position or time. Confirm that the request is for a location on land, and not over water.

Constant Summary collapse

TIME_ZONE_STATUS =
[
  # TODO: Write general description for OK
  OK = 'OK'.freeze,

  # TODO: Write general description for INVALID_REQUEST
  INVALID_REQUEST = 'INVALID_REQUEST'.freeze,

  # TODO: Write general description for OVER_DAILY_LIMIT
  OVER_DAILY_LIMIT = 'OVER_DAILY_LIMIT'.freeze,

  # TODO: Write general description for OVER_QUERY_LIMIT
  OVER_QUERY_LIMIT = 'OVER_QUERY_LIMIT'.freeze,

  # TODO: Write general description for REQUEST_DENIED
  REQUEST_DENIED = 'REQUEST_DENIED'.freeze,

  # TODO: Write general description for UNKNOWN_ERROR
  UNKNOWN_ERROR = 'UNKNOWN_ERROR'.freeze,

  # TODO: Write general description for ZERO_RESULTS
  ZERO_RESULTS = 'ZERO_RESULTS'.freeze
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = OK) ⇒ Object



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/google_maps_platform/models/time_zone_status.rb', line 50

def self.from_value(value, default_value = OK)
  return default_value if value.nil?

  str = value.to_s.strip

  case str.downcase
  when 'ok' then OK
  when 'invalid_request' then INVALID_REQUEST
  when 'over_daily_limit' then OVER_DAILY_LIMIT
  when 'over_query_limit' then OVER_QUERY_LIMIT
  when 'request_denied' then REQUEST_DENIED
  when 'unknown_error' then UNKNOWN_ERROR
  when 'zero_results' then ZERO_RESULTS
  else
    default_value
  end
end

.validate(value) ⇒ Object



44
45
46
47
48
# File 'lib/google_maps_platform/models/time_zone_status.rb', line 44

def self.validate(value)
  return false if value.nil?

  TIME_ZONE_STATUS.include?(value)
end