Class: GoogleMapsPlatform::StreetViewResponse
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- GoogleMapsPlatform::StreetViewResponse
- Defined in:
- lib/google_maps_platform/models/street_view_response.rb
Overview
StreetViewResponse Model.
Instance Attribute Summary collapse
-
#copyright ⇒ String
Contains the copyright notices associated with this panorama.
-
#date ⇒ String
A string indicating year and month that the panorama was captured.
-
#location ⇒ LatLngLiteral
An object describing a specific location with Latitude and Longitude in decimal degrees.
-
#pano_id ⇒ String
A specific panorama ID.
-
#status ⇒ StreetViewStatus
The
statusfield within the Streetview Metadata response object contains the status of the request.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(status:, copyright: SKIP, date: SKIP, location: SKIP, pano_id: SKIP, additional_properties: nil) ⇒ StreetViewResponse
constructor
A new instance of StreetViewResponse.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(status:, copyright: SKIP, date: SKIP, location: SKIP, pano_id: SKIP, additional_properties: nil) ⇒ StreetViewResponse
Returns a new instance of StreetViewResponse.
80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/google_maps_platform/models/street_view_response.rb', line 80 def initialize(status:, copyright: SKIP, date: SKIP, location: SKIP, pano_id: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @copyright = copyright unless copyright == SKIP @date = date unless date == SKIP @location = location unless location == SKIP @pano_id = pano_id unless pano_id == SKIP @status = status @additional_properties = additional_properties end |
Instance Attribute Details
#copyright ⇒ String
Contains the copyright notices associated with this panorama.
14 15 16 |
# File 'lib/google_maps_platform/models/street_view_response.rb', line 14 def copyright @copyright end |
#date ⇒ String
A string indicating year and month that the panorama was captured.
18 19 20 |
# File 'lib/google_maps_platform/models/street_view_response.rb', line 18 def date @date end |
#location ⇒ LatLngLiteral
An object describing a specific location with Latitude and Longitude in decimal degrees.
23 24 25 |
# File 'lib/google_maps_platform/models/street_view_response.rb', line 23 def location @location end |
#pano_id ⇒ String
A specific panorama ID. These are generally stable, though panoramas may change ID over time as imagery is refreshed.
28 29 30 |
# File 'lib/google_maps_platform/models/street_view_response.rb', line 28 def pano_id @pano_id end |
#status ⇒ StreetViewStatus
The status field within the Streetview Metadata response object contains the status of the request. The status field may contain the following values:
-
OKindicates that no errors occurred; a panorama is found and metadata
is returned.
-
INVALID_REQUESTindicates that the request was malformed. -
NOT_FOUNDindicates that the address string provided in thelocation
parameter could not be found. This may occur if a non-existent address is given.
-
ZERO_RESULTSindicates 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_LIMITindicates the requestor has exceeded quota. -
REQUEST_DENIEDindicates that your request was denied. This may occur
if you did not [authorize](developers.google.com/maps/documentation/streetview/ge t-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_ERRORindicates 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
52 53 54 |
# File 'lib/google_maps_platform/models/street_view_response.rb', line 52 def status @status end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/google_maps_platform/models/street_view_response.rb', line 94 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. status = hash.key?('status') ? hash['status'] : nil copyright = hash.key?('copyright') ? hash['copyright'] : SKIP date = hash.key?('date') ? hash['date'] : SKIP location = LatLngLiteral.from_hash(hash['location']) if hash['location'] pano_id = hash.key?('pano_id') ? hash['pano_id'] : SKIP # Create a new hash for additional properties, removing known properties. new_hash = hash.reject { |k, _| names.value?(k) } additional_properties = APIHelper.get_additional_properties( new_hash, proc { |value| value } ) # Create object from extracted values. StreetViewResponse.new(status: status, copyright: copyright, date: date, location: location, pano_id: pano_id, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
55 56 57 58 59 60 61 62 63 |
# File 'lib/google_maps_platform/models/street_view_response.rb', line 55 def self.names @_hash = {} if @_hash.nil? @_hash['copyright'] = 'copyright' @_hash['date'] = 'date' @_hash['location'] = 'location' @_hash['pano_id'] = 'pano_id' @_hash['status'] = 'status' @_hash end |
.nullables ⇒ Object
An array for nullable fields
76 77 78 |
# File 'lib/google_maps_platform/models/street_view_response.rb', line 76 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
66 67 68 69 70 71 72 73 |
# File 'lib/google_maps_platform/models/street_view_response.rb', line 66 def self.optionals %w[ copyright date location pano_id ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
128 129 130 131 132 133 |
# File 'lib/google_maps_platform/models/street_view_response.rb', line 128 def inspect class_name = self.class.name.split('::').last "<#{class_name} copyright: #{@copyright.inspect}, date: #{@date.inspect}, location:"\ " #{@location.inspect}, pano_id: #{@pano_id.inspect}, status: #{@status.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
121 122 123 124 125 |
# File 'lib/google_maps_platform/models/street_view_response.rb', line 121 def to_s class_name = self.class.name.split('::').last "<#{class_name} copyright: #{@copyright}, date: #{@date}, location: #{@location}, pano_id:"\ " #{@pano_id}, status: #{@status}, additional_properties: #{@additional_properties}>" end |