Class: GoogleMapsPlatform::StreetViewStatus

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

Overview

The status field within the Streetview Metadata response object contains the status of the request. The status field may contain the following values: - OK indicates that no errors occurred; a panorama is found and metadata is returned. - INVALID_REQUEST indicates that the request was malformed. - NOT_FOUND indicates that the address string provided in the location parameter could not be found. This may occur if a non-existent address is given. - ZERO_RESULTS indicates that no panorama could be found near the provided location. This may occur if a non-existent or invalid pano id is given. - OVER_QUERY_LIMIT indicates the requestor has exceeded quota. - REQUEST_DENIED indicates that your request was denied. This may occur if you did not [authorize](developers.google.com/maps/documentation/streetview/get- api-key) your request, or if the Street View Static API is not activated in the Google Cloud Console project containing your API key. - UNKNOWN_ERROR indicates that the request could not be processed due to a server error. This is often a temporary status. The request may succeed if you try again

Constant Summary collapse

STREET_VIEW_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 NOT_FOUND
  NOT_FOUND = 'NOT_FOUND'.freeze,

  # TODO: Write general description for ZERO_RESULTS
  ZERO_RESULTS = 'ZERO_RESULTS'.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
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = OK) ⇒ Object



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/google_maps_platform/models/street_view_status.rb', line 53

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 'not_found' then NOT_FOUND
  when 'zero_results' then ZERO_RESULTS
  when 'over_query_limit' then OVER_QUERY_LIMIT
  when 'request_denied' then REQUEST_DENIED
  when 'unknown_error' then UNKNOWN_ERROR
  else
    default_value
  end
end

.validate(value) ⇒ Object



47
48
49
50
51
# File 'lib/google_maps_platform/models/street_view_status.rb', line 47

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

  STREET_VIEW_STATUS.include?(value)
end