google-maps-api-sdk 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +28 -0
  3. data/README.md +169 -0
  4. data/bin/console +15 -0
  5. data/lib/google_maps_platform/api_helper.rb +10 -0
  6. data/lib/google_maps_platform/client.rb +123 -0
  7. data/lib/google_maps_platform/configuration.rb +181 -0
  8. data/lib/google_maps_platform/controllers/base_controller.rb +67 -0
  9. data/lib/google_maps_platform/controllers/directions_api_controller.rb +341 -0
  10. data/lib/google_maps_platform/controllers/distance_matrix_api_controller.rb +224 -0
  11. data/lib/google_maps_platform/controllers/elevation_api_controller.rb +71 -0
  12. data/lib/google_maps_platform/controllers/geocoding_api_controller.rb +214 -0
  13. data/lib/google_maps_platform/controllers/geolocation_api_controller.rb +46 -0
  14. data/lib/google_maps_platform/controllers/places_api_controller.rb +866 -0
  15. data/lib/google_maps_platform/controllers/roads_api_controller.rb +81 -0
  16. data/lib/google_maps_platform/controllers/street_view_api_controller.rb +198 -0
  17. data/lib/google_maps_platform/controllers/time_zone_api_controller.rb +65 -0
  18. data/lib/google_maps_platform/exceptions/api_exception.rb +21 -0
  19. data/lib/google_maps_platform/exceptions/error_response_exception.rb +48 -0
  20. data/lib/google_maps_platform/exceptions/nearest_roads_error_response_exception.rb +46 -0
  21. data/lib/google_maps_platform/http/api_response.rb +19 -0
  22. data/lib/google_maps_platform/http/auth/custom_query_authentication.rb +52 -0
  23. data/lib/google_maps_platform/http/http_call_back.rb +10 -0
  24. data/lib/google_maps_platform/http/http_method_enum.rb +10 -0
  25. data/lib/google_maps_platform/http/http_request.rb +10 -0
  26. data/lib/google_maps_platform/http/http_response.rb +10 -0
  27. data/lib/google_maps_platform/http/proxy_settings.rb +22 -0
  28. data/lib/google_maps_platform/logging/configuration/api_logging_configuration.rb +186 -0
  29. data/lib/google_maps_platform/logging/sdk_logger.rb +17 -0
  30. data/lib/google_maps_platform/models/address_component.rb +97 -0
  31. data/lib/google_maps_platform/models/base_model.rb +110 -0
  32. data/lib/google_maps_platform/models/bounds.rb +85 -0
  33. data/lib/google_maps_platform/models/business_status.rb +41 -0
  34. data/lib/google_maps_platform/models/cell_tower.rb +146 -0
  35. data/lib/google_maps_platform/models/directions_geocoded_waypoint.rb +181 -0
  36. data/lib/google_maps_platform/models/directions_leg.rb +224 -0
  37. data/lib/google_maps_platform/models/directions_polyline.rb +93 -0
  38. data/lib/google_maps_platform/models/directions_response.rb +185 -0
  39. data/lib/google_maps_platform/models/directions_route.rb +188 -0
  40. data/lib/google_maps_platform/models/directions_status.rb +94 -0
  41. data/lib/google_maps_platform/models/directions_step.rb +216 -0
  42. data/lib/google_maps_platform/models/directions_traffic_speed_entry.rb +84 -0
  43. data/lib/google_maps_platform/models/directions_transit_agency.rb +95 -0
  44. data/lib/google_maps_platform/models/directions_transit_details.rb +176 -0
  45. data/lib/google_maps_platform/models/directions_transit_line.rb +152 -0
  46. data/lib/google_maps_platform/models/directions_transit_stop.rb +83 -0
  47. data/lib/google_maps_platform/models/directions_transit_vehicle.rb +126 -0
  48. data/lib/google_maps_platform/models/directions_via_waypoint.rb +99 -0
  49. data/lib/google_maps_platform/models/distance_matrix_element.rb +132 -0
  50. data/lib/google_maps_platform/models/distance_matrix_element_status.rb +48 -0
  51. data/lib/google_maps_platform/models/distance_matrix_response.rb +149 -0
  52. data/lib/google_maps_platform/models/distance_matrix_row.rb +89 -0
  53. data/lib/google_maps_platform/models/distance_matrix_status.rb +74 -0
  54. data/lib/google_maps_platform/models/elevation_response.rb +132 -0
  55. data/lib/google_maps_platform/models/elevation_result.rb +99 -0
  56. data/lib/google_maps_platform/models/elevation_status.rb +65 -0
  57. data/lib/google_maps_platform/models/error_detail.rb +135 -0
  58. data/lib/google_maps_platform/models/error_object.rb +130 -0
  59. data/lib/google_maps_platform/models/fare.rb +92 -0
  60. data/lib/google_maps_platform/models/field_violation.rb +82 -0
  61. data/lib/google_maps_platform/models/geocoder_status.rb +37 -0
  62. data/lib/google_maps_platform/models/geocoding_geometry.rb +117 -0
  63. data/lib/google_maps_platform/models/geocoding_response.rb +140 -0
  64. data/lib/google_maps_platform/models/geocoding_result.rb +174 -0
  65. data/lib/google_maps_platform/models/geocoding_status.rb +71 -0
  66. data/lib/google_maps_platform/models/geolocation_request.rb +166 -0
  67. data/lib/google_maps_platform/models/geolocation_response.rb +91 -0
  68. data/lib/google_maps_platform/models/geometry.rb +84 -0
  69. data/lib/google_maps_platform/models/inputtype.rb +36 -0
  70. data/lib/google_maps_platform/models/language.rb +240 -0
  71. data/lib/google_maps_platform/models/lat_lng_literal.rb +83 -0
  72. data/lib/google_maps_platform/models/latitude_longitude_literal.rb +83 -0
  73. data/lib/google_maps_platform/models/location_type.rb +54 -0
  74. data/lib/google_maps_platform/models/location_type1.rb +44 -0
  75. data/lib/google_maps_platform/models/maneuver.rb +110 -0
  76. data/lib/google_maps_platform/models/maps_api_elevation_json_response.rb +132 -0
  77. data/lib/google_maps_platform/models/maxprice.rb +48 -0
  78. data/lib/google_maps_platform/models/minprice.rb +48 -0
  79. data/lib/google_maps_platform/models/mode.rb +44 -0
  80. data/lib/google_maps_platform/models/nearest_roads_error.rb +90 -0
  81. data/lib/google_maps_platform/models/nearest_roads_response.rb +86 -0
  82. data/lib/google_maps_platform/models/place.rb +647 -0
  83. data/lib/google_maps_platform/models/place_autocomplete_matched_substring.rb +82 -0
  84. data/lib/google_maps_platform/models/place_autocomplete_prediction.rb +181 -0
  85. data/lib/google_maps_platform/models/place_autocomplete_structured_format.rb +136 -0
  86. data/lib/google_maps_platform/models/place_autocomplete_term.rb +83 -0
  87. data/lib/google_maps_platform/models/place_editorial_summary.rb +87 -0
  88. data/lib/google_maps_platform/models/place_opening_hours.rb +138 -0
  89. data/lib/google_maps_platform/models/place_opening_hours_period.rb +84 -0
  90. data/lib/google_maps_platform/models/place_opening_hours_period_detail.rb +108 -0
  91. data/lib/google_maps_platform/models/place_photo.rb +109 -0
  92. data/lib/google_maps_platform/models/place_review.rb +186 -0
  93. data/lib/google_maps_platform/models/place_special_day.rb +93 -0
  94. data/lib/google_maps_platform/models/places_autocomplete_response.rb +141 -0
  95. data/lib/google_maps_platform/models/places_autocomplete_status.rb +66 -0
  96. data/lib/google_maps_platform/models/places_details_response.rb +131 -0
  97. data/lib/google_maps_platform/models/places_details_status.rb +71 -0
  98. data/lib/google_maps_platform/models/places_find_place_from_text_response.rb +145 -0
  99. data/lib/google_maps_platform/models/places_nearby_search_response.rb +171 -0
  100. data/lib/google_maps_platform/models/places_query_autocomplete_response.rb +141 -0
  101. data/lib/google_maps_platform/models/places_search_status.rb +66 -0
  102. data/lib/google_maps_platform/models/places_text_search_response.rb +171 -0
  103. data/lib/google_maps_platform/models/plus_code.rb +92 -0
  104. data/lib/google_maps_platform/models/rankby.rb +36 -0
  105. data/lib/google_maps_platform/models/region.rb +1052 -0
  106. data/lib/google_maps_platform/models/result.rb +96 -0
  107. data/lib/google_maps_platform/models/result_type.rb +112 -0
  108. data/lib/google_maps_platform/models/snap_to_roads_response.rb +96 -0
  109. data/lib/google_maps_platform/models/snapped_point.rb +103 -0
  110. data/lib/google_maps_platform/models/source.rb +36 -0
  111. data/lib/google_maps_platform/models/street_view_response.rb +135 -0
  112. data/lib/google_maps_platform/models/street_view_status.rb +71 -0
  113. data/lib/google_maps_platform/models/text_value_object.rb +82 -0
  114. data/lib/google_maps_platform/models/time_zone_response.rb +154 -0
  115. data/lib/google_maps_platform/models/time_zone_status.rb +68 -0
  116. data/lib/google_maps_platform/models/time_zone_text_value_object.rb +94 -0
  117. data/lib/google_maps_platform/models/traffic_model.rb +40 -0
  118. data/lib/google_maps_platform/models/transit_routing_preference.rb +36 -0
  119. data/lib/google_maps_platform/models/travel_mode.rb +48 -0
  120. data/lib/google_maps_platform/models/type.rb +140 -0
  121. data/lib/google_maps_platform/models/type1.rb +112 -0
  122. data/lib/google_maps_platform/models/units.rb +36 -0
  123. data/lib/google_maps_platform/models/wi_fi_access_point.rb +119 -0
  124. data/lib/google_maps_platform/utilities/date_time_helper.rb +11 -0
  125. data/lib/google_maps_platform/utilities/file_wrapper.rb +28 -0
  126. data/lib/google_maps_platform.rb +154 -0
  127. metadata +210 -0
@@ -0,0 +1,96 @@
1
+ # google_maps_platform
2
+ #
3
+ # This file was automatically generated by APIMATIC
4
+ # v3.0 ( https://www.apimatic.io ).
5
+
6
+ module GoogleMapsPlatform
7
+ # Result Model.
8
+ class Result < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [Float]
14
+ attr_accessor :elevation
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [Float]
18
+ attr_accessor :resolution
19
+
20
+ # An object describing a specific location with Latitude and Longitude in
21
+ # decimal degrees.
22
+ # @return [LatLngLiteral]
23
+ attr_accessor :location
24
+
25
+ # A mapping from model property names to API property names.
26
+ def self.names
27
+ @_hash = {} if @_hash.nil?
28
+ @_hash['elevation'] = 'elevation'
29
+ @_hash['resolution'] = 'resolution'
30
+ @_hash['location'] = 'location'
31
+ @_hash
32
+ end
33
+
34
+ # An array for optional fields
35
+ def self.optionals
36
+ %w[
37
+ elevation
38
+ resolution
39
+ location
40
+ ]
41
+ end
42
+
43
+ # An array for nullable fields
44
+ def self.nullables
45
+ []
46
+ end
47
+
48
+ def initialize(elevation: SKIP, resolution: SKIP, location: SKIP,
49
+ additional_properties: nil)
50
+ # Add additional model properties to the instance
51
+ additional_properties = {} if additional_properties.nil?
52
+
53
+ @elevation = elevation unless elevation == SKIP
54
+ @resolution = resolution unless resolution == SKIP
55
+ @location = location unless location == SKIP
56
+ @additional_properties = additional_properties
57
+ end
58
+
59
+ # Creates an instance of the object from a hash.
60
+ def self.from_hash(hash)
61
+ return nil unless hash
62
+
63
+ # Extract variables from the hash.
64
+ elevation = hash.key?('elevation') ? hash['elevation'] : SKIP
65
+ resolution = hash.key?('resolution') ? hash['resolution'] : SKIP
66
+ location = LatLngLiteral.from_hash(hash['location']) if hash['location']
67
+
68
+ # Create a new hash for additional properties, removing known properties.
69
+ new_hash = hash.reject { |k, _| names.value?(k) }
70
+
71
+ additional_properties = APIHelper.get_additional_properties(
72
+ new_hash, proc { |value| value }
73
+ )
74
+
75
+ # Create object from extracted values.
76
+ Result.new(elevation: elevation,
77
+ resolution: resolution,
78
+ location: location,
79
+ additional_properties: additional_properties)
80
+ end
81
+
82
+ # Provides a human-readable string representation of the object.
83
+ def to_s
84
+ class_name = self.class.name.split('::').last
85
+ "<#{class_name} elevation: #{@elevation}, resolution: #{@resolution}, location:"\
86
+ " #{@location}, additional_properties: #{@additional_properties}>"
87
+ end
88
+
89
+ # Provides a debugging-friendly string with detailed object information.
90
+ def inspect
91
+ class_name = self.class.name.split('::').last
92
+ "<#{class_name} elevation: #{@elevation.inspect}, resolution: #{@resolution.inspect},"\
93
+ " location: #{@location.inspect}, additional_properties: #{@additional_properties}>"
94
+ end
95
+ end
96
+ end
@@ -0,0 +1,112 @@
1
+ # google_maps_platform
2
+ #
3
+ # This file was automatically generated by APIMATIC
4
+ # v3.0 ( https://www.apimatic.io ).
5
+
6
+ module GoogleMapsPlatform
7
+ # result_type.
8
+ class ResultType
9
+ RESULT_TYPE = [
10
+ # TODO: Write general description for ADMINISTRATIVE_AREA_LEVEL_1
11
+ ADMINISTRATIVE_AREA_LEVEL_1 = 'administrative_area_level_1'.freeze,
12
+
13
+ # TODO: Write general description for ADMINISTRATIVE_AREA_LEVEL_2
14
+ ADMINISTRATIVE_AREA_LEVEL_2 = 'administrative_area_level_2'.freeze,
15
+
16
+ # TODO: Write general description for ADMINISTRATIVE_AREA_LEVEL_3
17
+ ADMINISTRATIVE_AREA_LEVEL_3 = 'administrative_area_level_3'.freeze,
18
+
19
+ # TODO: Write general description for ADMINISTRATIVE_AREA_LEVEL_4
20
+ ADMINISTRATIVE_AREA_LEVEL_4 = 'administrative_area_level_4'.freeze,
21
+
22
+ # TODO: Write general description for ADMINISTRATIVE_AREA_LEVEL_5
23
+ ADMINISTRATIVE_AREA_LEVEL_5 = 'administrative_area_level_5'.freeze,
24
+
25
+ # TODO: Write general description for AIRPORT
26
+ AIRPORT = 'airport'.freeze,
27
+
28
+ # TODO: Write general description for COLLOQUIAL_AREA
29
+ COLLOQUIAL_AREA = 'colloquial_area'.freeze,
30
+
31
+ # TODO: Write general description for COUNTRY
32
+ COUNTRY = 'country'.freeze,
33
+
34
+ # TODO: Write general description for INTERSECTION
35
+ INTERSECTION = 'intersection'.freeze,
36
+
37
+ # TODO: Write general description for LOCALITY
38
+ LOCALITY = 'locality'.freeze,
39
+
40
+ # TODO: Write general description for NATURAL_FEATURE
41
+ NATURAL_FEATURE = 'natural_feature'.freeze,
42
+
43
+ # TODO: Write general description for NEIGHBORHOOD
44
+ NEIGHBORHOOD = 'neighborhood'.freeze,
45
+
46
+ # TODO: Write general description for PARK
47
+ PARK = 'park'.freeze,
48
+
49
+ # TODO: Write general description for PLUS_CODE
50
+ PLUS_CODE = 'plus_code'.freeze,
51
+
52
+ # TODO: Write general description for POLITICAL
53
+ POLITICAL = 'political'.freeze,
54
+
55
+ # TODO: Write general description for POSTAL_CODE
56
+ POSTAL_CODE = 'postal_code'.freeze,
57
+
58
+ # TODO: Write general description for PREMISE
59
+ PREMISE = 'premise'.freeze,
60
+
61
+ # TODO: Write general description for ROUTE
62
+ ROUTE = 'route'.freeze,
63
+
64
+ # TODO: Write general description for STREET_ADDRESS
65
+ STREET_ADDRESS = 'street_address'.freeze,
66
+
67
+ # TODO: Write general description for SUBLOCALITY
68
+ SUBLOCALITY = 'sublocality'.freeze,
69
+
70
+ # TODO: Write general description for SUBPREMISE
71
+ SUBPREMISE = 'subpremise'.freeze
72
+ ].freeze
73
+
74
+ def self.validate(value)
75
+ return false if value.nil?
76
+
77
+ RESULT_TYPE.include?(value)
78
+ end
79
+
80
+ def self.from_value(value, default_value = ADMINISTRATIVE_AREA_LEVEL_1)
81
+ return default_value if value.nil?
82
+
83
+ str = value.to_s.strip
84
+
85
+ case str.downcase
86
+ when 'administrative_area_level_1' then ADMINISTRATIVE_AREA_LEVEL_1
87
+ when 'administrative_area_level_2' then ADMINISTRATIVE_AREA_LEVEL_2
88
+ when 'administrative_area_level_3' then ADMINISTRATIVE_AREA_LEVEL_3
89
+ when 'administrative_area_level_4' then ADMINISTRATIVE_AREA_LEVEL_4
90
+ when 'administrative_area_level_5' then ADMINISTRATIVE_AREA_LEVEL_5
91
+ when 'airport' then AIRPORT
92
+ when 'colloquial_area' then COLLOQUIAL_AREA
93
+ when 'country' then COUNTRY
94
+ when 'intersection' then INTERSECTION
95
+ when 'locality' then LOCALITY
96
+ when 'natural_feature' then NATURAL_FEATURE
97
+ when 'neighborhood' then NEIGHBORHOOD
98
+ when 'park' then PARK
99
+ when 'plus_code' then PLUS_CODE
100
+ when 'political' then POLITICAL
101
+ when 'postal_code' then POSTAL_CODE
102
+ when 'premise' then PREMISE
103
+ when 'route' then ROUTE
104
+ when 'street_address' then STREET_ADDRESS
105
+ when 'sublocality' then SUBLOCALITY
106
+ when 'subpremise' then SUBPREMISE
107
+ else
108
+ default_value
109
+ end
110
+ end
111
+ end
112
+ end
@@ -0,0 +1,96 @@
1
+ # google_maps_platform
2
+ #
3
+ # This file was automatically generated by APIMATIC
4
+ # v3.0 ( https://www.apimatic.io ).
5
+
6
+ module GoogleMapsPlatform
7
+ # SnapToRoadsResponse Model.
8
+ class SnapToRoadsResponse < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # An array of snapped points.
13
+ # @return [Array[SnappedPoint]]
14
+ attr_accessor :snapped_points
15
+
16
+ # A string containing a user-visible warning.
17
+ # @return [String]
18
+ attr_accessor :warning_message
19
+
20
+ # A mapping from model property names to API property names.
21
+ def self.names
22
+ @_hash = {} if @_hash.nil?
23
+ @_hash['snapped_points'] = 'snappedPoints'
24
+ @_hash['warning_message'] = 'warningMessage'
25
+ @_hash
26
+ end
27
+
28
+ # An array for optional fields
29
+ def self.optionals
30
+ %w[
31
+ snapped_points
32
+ warning_message
33
+ ]
34
+ end
35
+
36
+ # An array for nullable fields
37
+ def self.nullables
38
+ []
39
+ end
40
+
41
+ def initialize(snapped_points: SKIP, warning_message: SKIP,
42
+ additional_properties: nil)
43
+ # Add additional model properties to the instance
44
+ additional_properties = {} if additional_properties.nil?
45
+
46
+ @snapped_points = snapped_points unless snapped_points == SKIP
47
+ @warning_message = warning_message unless warning_message == SKIP
48
+ @additional_properties = additional_properties
49
+ end
50
+
51
+ # Creates an instance of the object from a hash.
52
+ def self.from_hash(hash)
53
+ return nil unless hash
54
+
55
+ # Extract variables from the hash.
56
+ # Parameter is an array, so we need to iterate through it
57
+ snapped_points = nil
58
+ unless hash['snappedPoints'].nil?
59
+ snapped_points = []
60
+ hash['snappedPoints'].each do |structure|
61
+ snapped_points << (SnappedPoint.from_hash(structure) if structure)
62
+ end
63
+ end
64
+
65
+ snapped_points = SKIP unless hash.key?('snappedPoints')
66
+ warning_message =
67
+ hash.key?('warningMessage') ? hash['warningMessage'] : SKIP
68
+
69
+ # Create a new hash for additional properties, removing known properties.
70
+ new_hash = hash.reject { |k, _| names.value?(k) }
71
+
72
+ additional_properties = APIHelper.get_additional_properties(
73
+ new_hash, proc { |value| value }
74
+ )
75
+
76
+ # Create object from extracted values.
77
+ SnapToRoadsResponse.new(snapped_points: snapped_points,
78
+ warning_message: warning_message,
79
+ additional_properties: additional_properties)
80
+ end
81
+
82
+ # Provides a human-readable string representation of the object.
83
+ def to_s
84
+ class_name = self.class.name.split('::').last
85
+ "<#{class_name} snapped_points: #{@snapped_points}, warning_message: #{@warning_message},"\
86
+ " additional_properties: #{@additional_properties}>"
87
+ end
88
+
89
+ # Provides a debugging-friendly string with detailed object information.
90
+ def inspect
91
+ class_name = self.class.name.split('::').last
92
+ "<#{class_name} snapped_points: #{@snapped_points.inspect}, warning_message:"\
93
+ " #{@warning_message.inspect}, additional_properties: #{@additional_properties}>"
94
+ end
95
+ end
96
+ end
@@ -0,0 +1,103 @@
1
+ # google_maps_platform
2
+ #
3
+ # This file was automatically generated by APIMATIC
4
+ # v3.0 ( https://www.apimatic.io ).
5
+
6
+ module GoogleMapsPlatform
7
+ # SnappedPoint Model.
8
+ class SnappedPoint < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # An object describing a specific location with Latitude and Longitude in
13
+ # decimal degrees.
14
+ # @return [LatitudeLongitudeLiteral]
15
+ attr_accessor :location
16
+
17
+ # An integer that indicates the corresponding value in the original request.
18
+ # Each value in the request should map to a snapped value in the response.
19
+ # However, if you've set interpolate=true or if you're using nearest roads,
20
+ # then it's possible that the response will contain more coordinates than
21
+ # the request. Interpolated values will not have an `originalIndex`. These
22
+ # values are indexed from `0`, so a point with an originalIndex of `4` will
23
+ # be the snapped value of the 5th latitude/longitude passed to the path
24
+ # parameter. Nearest Roads points may contain several points for single
25
+ # coordinates with differing location or placeId.
26
+ # @return [Float]
27
+ attr_accessor :original_index
28
+
29
+ # A unique identifier for a place. All place IDs returned by the Roads API
30
+ # correspond to road segments.
31
+ # @return [String]
32
+ attr_accessor :place_id
33
+
34
+ # A mapping from model property names to API property names.
35
+ def self.names
36
+ @_hash = {} if @_hash.nil?
37
+ @_hash['location'] = 'location'
38
+ @_hash['original_index'] = 'originalIndex'
39
+ @_hash['place_id'] = 'placeId'
40
+ @_hash
41
+ end
42
+
43
+ # An array for optional fields
44
+ def self.optionals
45
+ %w[
46
+ original_index
47
+ ]
48
+ end
49
+
50
+ # An array for nullable fields
51
+ def self.nullables
52
+ []
53
+ end
54
+
55
+ def initialize(location:, place_id:, original_index: SKIP,
56
+ additional_properties: nil)
57
+ # Add additional model properties to the instance
58
+ additional_properties = {} if additional_properties.nil?
59
+
60
+ @location = location
61
+ @original_index = original_index unless original_index == SKIP
62
+ @place_id = place_id
63
+ @additional_properties = additional_properties
64
+ end
65
+
66
+ # Creates an instance of the object from a hash.
67
+ def self.from_hash(hash)
68
+ return nil unless hash
69
+
70
+ # Extract variables from the hash.
71
+ location = LatitudeLongitudeLiteral.from_hash(hash['location']) if hash['location']
72
+ place_id = hash.key?('placeId') ? hash['placeId'] : nil
73
+ original_index = hash.key?('originalIndex') ? hash['originalIndex'] : SKIP
74
+
75
+ # Create a new hash for additional properties, removing known properties.
76
+ new_hash = hash.reject { |k, _| names.value?(k) }
77
+
78
+ additional_properties = APIHelper.get_additional_properties(
79
+ new_hash, proc { |value| value }
80
+ )
81
+
82
+ # Create object from extracted values.
83
+ SnappedPoint.new(location: location,
84
+ place_id: place_id,
85
+ original_index: original_index,
86
+ additional_properties: additional_properties)
87
+ end
88
+
89
+ # Provides a human-readable string representation of the object.
90
+ def to_s
91
+ class_name = self.class.name.split('::').last
92
+ "<#{class_name} location: #{@location}, original_index: #{@original_index}, place_id:"\
93
+ " #{@place_id}, additional_properties: #{@additional_properties}>"
94
+ end
95
+
96
+ # Provides a debugging-friendly string with detailed object information.
97
+ def inspect
98
+ class_name = self.class.name.split('::').last
99
+ "<#{class_name} location: #{@location.inspect}, original_index: #{@original_index.inspect},"\
100
+ " place_id: #{@place_id.inspect}, additional_properties: #{@additional_properties}>"
101
+ end
102
+ end
103
+ end
@@ -0,0 +1,36 @@
1
+ # google_maps_platform
2
+ #
3
+ # This file was automatically generated by APIMATIC
4
+ # v3.0 ( https://www.apimatic.io ).
5
+
6
+ module GoogleMapsPlatform
7
+ # source.
8
+ class Source
9
+ SOURCE = [
10
+ # TODO: Write general description for DEFAULT
11
+ DEFAULT = 'default'.freeze,
12
+
13
+ # TODO: Write general description for OUTDOOR
14
+ OUTDOOR = 'outdoor'.freeze
15
+ ].freeze
16
+
17
+ def self.validate(value)
18
+ return false if value.nil?
19
+
20
+ SOURCE.include?(value)
21
+ end
22
+
23
+ def self.from_value(value, default_value = DEFAULT)
24
+ return default_value if value.nil?
25
+
26
+ str = value.to_s.strip
27
+
28
+ case str.downcase
29
+ when 'default' then DEFAULT
30
+ when 'outdoor' then OUTDOOR
31
+ else
32
+ default_value
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,135 @@
1
+ # google_maps_platform
2
+ #
3
+ # This file was automatically generated by APIMATIC
4
+ # v3.0 ( https://www.apimatic.io ).
5
+
6
+ module GoogleMapsPlatform
7
+ # StreetViewResponse Model.
8
+ class StreetViewResponse < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Contains the copyright notices associated with this panorama.
13
+ # @return [String]
14
+ attr_accessor :copyright
15
+
16
+ # A string indicating year and month that the panorama was captured.
17
+ # @return [String]
18
+ attr_accessor :date
19
+
20
+ # An object describing a specific location with Latitude and Longitude in
21
+ # decimal degrees.
22
+ # @return [LatLngLiteral]
23
+ attr_accessor :location
24
+
25
+ # A specific panorama ID. These are generally stable, though panoramas may
26
+ # change ID over time as imagery is refreshed.
27
+ # @return [String]
28
+ attr_accessor :pano_id
29
+
30
+ # The `status` field within the Streetview Metadata response object contains
31
+ # the status of the request. The `status` field may contain the following
32
+ # values:
33
+ # - `OK` indicates that no errors occurred; a panorama is found and metadata
34
+ # is returned.
35
+ # - `INVALID_REQUEST` indicates that the request was malformed.
36
+ # - `NOT_FOUND` indicates that the address string provided in the `location`
37
+ # parameter could not be found. This may occur if a non-existent address is
38
+ # given.
39
+ # - `ZERO_RESULTS` indicates that no panorama could be found near the
40
+ # provided location. This may occur if a non-existent or invalid `pano` id
41
+ # is given.
42
+ # - `OVER_QUERY_LIMIT` indicates the requestor has exceeded quota.
43
+ # - `REQUEST_DENIED` indicates that your request was denied. This may occur
44
+ # if you did not
45
+ # [authorize](https://developers.google.com/maps/documentation/streetview/ge
46
+ # t-api-key) your request, or if the Street View Static API is not activated
47
+ # in the Google Cloud Console project containing your API key.
48
+ # - `UNKNOWN_ERROR` indicates that the request could not be processed due to
49
+ # a server error. This is often a temporary status. The request may succeed
50
+ # if you try again
51
+ # @return [StreetViewStatus]
52
+ attr_accessor :status
53
+
54
+ # A mapping from model property names to API property names.
55
+ def self.names
56
+ @_hash = {} if @_hash.nil?
57
+ @_hash['copyright'] = 'copyright'
58
+ @_hash['date'] = 'date'
59
+ @_hash['location'] = 'location'
60
+ @_hash['pano_id'] = 'pano_id'
61
+ @_hash['status'] = 'status'
62
+ @_hash
63
+ end
64
+
65
+ # An array for optional fields
66
+ def self.optionals
67
+ %w[
68
+ copyright
69
+ date
70
+ location
71
+ pano_id
72
+ ]
73
+ end
74
+
75
+ # An array for nullable fields
76
+ def self.nullables
77
+ []
78
+ end
79
+
80
+ def initialize(status:, copyright: SKIP, date: SKIP, location: SKIP,
81
+ pano_id: SKIP, additional_properties: nil)
82
+ # Add additional model properties to the instance
83
+ additional_properties = {} if additional_properties.nil?
84
+
85
+ @copyright = copyright unless copyright == SKIP
86
+ @date = date unless date == SKIP
87
+ @location = location unless location == SKIP
88
+ @pano_id = pano_id unless pano_id == SKIP
89
+ @status = status
90
+ @additional_properties = additional_properties
91
+ end
92
+
93
+ # Creates an instance of the object from a hash.
94
+ def self.from_hash(hash)
95
+ return nil unless hash
96
+
97
+ # Extract variables from the hash.
98
+ status = hash.key?('status') ? hash['status'] : nil
99
+ copyright = hash.key?('copyright') ? hash['copyright'] : SKIP
100
+ date = hash.key?('date') ? hash['date'] : SKIP
101
+ location = LatLngLiteral.from_hash(hash['location']) if hash['location']
102
+ pano_id = hash.key?('pano_id') ? hash['pano_id'] : SKIP
103
+
104
+ # Create a new hash for additional properties, removing known properties.
105
+ new_hash = hash.reject { |k, _| names.value?(k) }
106
+
107
+ additional_properties = APIHelper.get_additional_properties(
108
+ new_hash, proc { |value| value }
109
+ )
110
+
111
+ # Create object from extracted values.
112
+ StreetViewResponse.new(status: status,
113
+ copyright: copyright,
114
+ date: date,
115
+ location: location,
116
+ pano_id: pano_id,
117
+ additional_properties: additional_properties)
118
+ end
119
+
120
+ # Provides a human-readable string representation of the object.
121
+ def to_s
122
+ class_name = self.class.name.split('::').last
123
+ "<#{class_name} copyright: #{@copyright}, date: #{@date}, location: #{@location}, pano_id:"\
124
+ " #{@pano_id}, status: #{@status}, additional_properties: #{@additional_properties}>"
125
+ end
126
+
127
+ # Provides a debugging-friendly string with detailed object information.
128
+ def inspect
129
+ class_name = self.class.name.split('::').last
130
+ "<#{class_name} copyright: #{@copyright.inspect}, date: #{@date.inspect}, location:"\
131
+ " #{@location.inspect}, pano_id: #{@pano_id.inspect}, status: #{@status.inspect},"\
132
+ " additional_properties: #{@additional_properties}>"
133
+ end
134
+ end
135
+ end
@@ -0,0 +1,71 @@
1
+ # google_maps_platform
2
+ #
3
+ # This file was automatically generated by APIMATIC
4
+ # v3.0 ( https://www.apimatic.io ).
5
+
6
+ module GoogleMapsPlatform
7
+ # The `status` field within the Streetview Metadata response object contains
8
+ # the status of the request. The `status` field may contain the following
9
+ # values: - `OK` indicates that no errors occurred; a panorama is found and
10
+ # metadata is returned. - `INVALID_REQUEST` indicates that the request was
11
+ # malformed. - `NOT_FOUND` indicates that the address string provided in the
12
+ # `location` parameter could not be found. This may occur if a non-existent
13
+ # address is given. - `ZERO_RESULTS` indicates that no panorama could be found
14
+ # near the provided location. This may occur if a non-existent or invalid
15
+ # `pano` id is given. - `OVER_QUERY_LIMIT` indicates the requestor has
16
+ # exceeded quota. - `REQUEST_DENIED` indicates that your request was denied.
17
+ # This may occur if you did not
18
+ # [authorize](https://developers.google.com/maps/documentation/streetview/get-
19
+ # api-key) your request, or if the Street View Static API is not activated in
20
+ # the Google Cloud Console project containing your API key. - `UNKNOWN_ERROR`
21
+ # indicates that the request could not be processed due to a server error.
22
+ # This is often a temporary status. The request may succeed if you try again
23
+ class StreetViewStatus
24
+ STREET_VIEW_STATUS = [
25
+ # TODO: Write general description for OK
26
+ OK = 'OK'.freeze,
27
+
28
+ # TODO: Write general description for INVALID_REQUEST
29
+ INVALID_REQUEST = 'INVALID_REQUEST'.freeze,
30
+
31
+ # TODO: Write general description for NOT_FOUND
32
+ NOT_FOUND = 'NOT_FOUND'.freeze,
33
+
34
+ # TODO: Write general description for ZERO_RESULTS
35
+ ZERO_RESULTS = 'ZERO_RESULTS'.freeze,
36
+
37
+ # TODO: Write general description for OVER_QUERY_LIMIT
38
+ OVER_QUERY_LIMIT = 'OVER_QUERY_LIMIT'.freeze,
39
+
40
+ # TODO: Write general description for REQUEST_DENIED
41
+ REQUEST_DENIED = 'REQUEST_DENIED'.freeze,
42
+
43
+ # TODO: Write general description for UNKNOWN_ERROR
44
+ UNKNOWN_ERROR = 'UNKNOWN_ERROR'.freeze
45
+ ].freeze
46
+
47
+ def self.validate(value)
48
+ return false if value.nil?
49
+
50
+ STREET_VIEW_STATUS.include?(value)
51
+ end
52
+
53
+ def self.from_value(value, default_value = OK)
54
+ return default_value if value.nil?
55
+
56
+ str = value.to_s.strip
57
+
58
+ case str.downcase
59
+ when 'ok' then OK
60
+ when 'invalid_request' then INVALID_REQUEST
61
+ when 'not_found' then NOT_FOUND
62
+ when 'zero_results' then ZERO_RESULTS
63
+ when 'over_query_limit' then OVER_QUERY_LIMIT
64
+ when 'request_denied' then REQUEST_DENIED
65
+ when 'unknown_error' then UNKNOWN_ERROR
66
+ else
67
+ default_value
68
+ end
69
+ end
70
+ end
71
+ end