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,44 @@
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
+ # location_type1.
8
+ class LocationType1
9
+ LOCATION_TYPE1 = [
10
+ # TODO: Write general description for APPROXIMATE
11
+ APPROXIMATE = 'APPROXIMATE'.freeze,
12
+
13
+ # TODO: Write general description for GEOMETRIC_CENTER
14
+ GEOMETRIC_CENTER = 'GEOMETRIC_CENTER'.freeze,
15
+
16
+ # TODO: Write general description for RANGE_INTERPOLATED
17
+ RANGE_INTERPOLATED = 'RANGE_INTERPOLATED'.freeze,
18
+
19
+ # TODO: Write general description for ROOFTOP
20
+ ROOFTOP = 'ROOFTOP'.freeze
21
+ ].freeze
22
+
23
+ def self.validate(value)
24
+ return false if value.nil?
25
+
26
+ LOCATION_TYPE1.include?(value)
27
+ end
28
+
29
+ def self.from_value(value, default_value = APPROXIMATE)
30
+ return default_value if value.nil?
31
+
32
+ str = value.to_s.strip
33
+
34
+ case str.downcase
35
+ when 'approximate' then APPROXIMATE
36
+ when 'geometric_center' then GEOMETRIC_CENTER
37
+ when 'range_interpolated' then RANGE_INTERPOLATED
38
+ when 'rooftop' then ROOFTOP
39
+ else
40
+ default_value
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,110 @@
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
+ # Contains the action to take for the current step (turn left, merge,
8
+ # straight, etc.). Values are subject to change, and new values may be
9
+ # introduced without prior notice.
10
+ class Maneuver
11
+ MANEUVER = [
12
+ # TODO: Write general description for TURNSLIGHTLEFT
13
+ TURNSLIGHTLEFT = 'turn-slight-left'.freeze,
14
+
15
+ # TODO: Write general description for TURNSHARPLEFT
16
+ TURNSHARPLEFT = 'turn-sharp-left'.freeze,
17
+
18
+ # TODO: Write general description for TURNLEFT
19
+ TURNLEFT = 'turn-left'.freeze,
20
+
21
+ # TODO: Write general description for TURNSLIGHTRIGHT
22
+ TURNSLIGHTRIGHT = 'turn-slight-right'.freeze,
23
+
24
+ # TODO: Write general description for TURNSHARPRIGHT
25
+ TURNSHARPRIGHT = 'turn-sharp-right'.freeze,
26
+
27
+ # TODO: Write general description for KEEPRIGHT
28
+ KEEPRIGHT = 'keep-right'.freeze,
29
+
30
+ # TODO: Write general description for KEEPLEFT
31
+ KEEPLEFT = 'keep-left'.freeze,
32
+
33
+ # TODO: Write general description for UTURNLEFT
34
+ UTURNLEFT = 'uturn-left'.freeze,
35
+
36
+ # TODO: Write general description for UTURNRIGHT
37
+ UTURNRIGHT = 'uturn-right'.freeze,
38
+
39
+ # TODO: Write general description for TURNRIGHT
40
+ TURNRIGHT = 'turn-right'.freeze,
41
+
42
+ # TODO: Write general description for STRAIGHT
43
+ STRAIGHT = 'straight'.freeze,
44
+
45
+ # TODO: Write general description for RAMPLEFT
46
+ RAMPLEFT = 'ramp-left'.freeze,
47
+
48
+ # TODO: Write general description for RAMPRIGHT
49
+ RAMPRIGHT = 'ramp-right'.freeze,
50
+
51
+ # TODO: Write general description for MERGE
52
+ MERGE = 'merge'.freeze,
53
+
54
+ # TODO: Write general description for FORKLEFT
55
+ FORKLEFT = 'fork-left'.freeze,
56
+
57
+ # TODO: Write general description for FORKRIGHT
58
+ FORKRIGHT = 'fork-right'.freeze,
59
+
60
+ # TODO: Write general description for FERRY
61
+ FERRY = 'ferry'.freeze,
62
+
63
+ # TODO: Write general description for FERRYTRAIN
64
+ FERRYTRAIN = 'ferry-train'.freeze,
65
+
66
+ # TODO: Write general description for ROUNDABOUTLEFT
67
+ ROUNDABOUTLEFT = 'roundabout-left'.freeze,
68
+
69
+ # TODO: Write general description for ROUNDABOUTRIGHT
70
+ ROUNDABOUTRIGHT = 'roundabout-right'.freeze
71
+ ].freeze
72
+
73
+ def self.validate(value)
74
+ return false if value.nil?
75
+
76
+ MANEUVER.include?(value)
77
+ end
78
+
79
+ def self.from_value(value, default_value = TURNSLIGHTLEFT)
80
+ return default_value if value.nil?
81
+
82
+ str = value.to_s.strip
83
+
84
+ case str.downcase
85
+ when 'turnslightleft' then TURNSLIGHTLEFT
86
+ when 'turnsharpleft' then TURNSHARPLEFT
87
+ when 'turnleft' then TURNLEFT
88
+ when 'turnslightright' then TURNSLIGHTRIGHT
89
+ when 'turnsharpright' then TURNSHARPRIGHT
90
+ when 'keepright' then KEEPRIGHT
91
+ when 'keepleft' then KEEPLEFT
92
+ when 'uturnleft' then UTURNLEFT
93
+ when 'uturnright' then UTURNRIGHT
94
+ when 'turnright' then TURNRIGHT
95
+ when 'straight' then STRAIGHT
96
+ when 'rampleft' then RAMPLEFT
97
+ when 'rampright' then RAMPRIGHT
98
+ when 'merge' then MERGE
99
+ when 'forkleft' then FORKLEFT
100
+ when 'forkright' then FORKRIGHT
101
+ when 'ferry' then FERRY
102
+ when 'ferrytrain' then FERRYTRAIN
103
+ when 'roundaboutleft' then ROUNDABOUTLEFT
104
+ when 'roundaboutright' then ROUNDABOUTRIGHT
105
+ else
106
+ default_value
107
+ end
108
+ end
109
+ end
110
+ end
@@ -0,0 +1,132 @@
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
+ # MapsApiElevationJsonResponse Model.
8
+ class MapsApiElevationJsonResponse < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # When the service returns a status code other than `OK<`, there may be an
13
+ # additional `error_message` field within the response object. This field
14
+ # contains more detailed information about thereasons behind the given
15
+ # status code. This field is not always returned, and its content is subject
16
+ # to change.
17
+ # @return [String]
18
+ attr_accessor :error_message
19
+
20
+ # Status codes returned by service.
21
+ # - `OK` indicating the API request was successful.
22
+ # - `DATA_NOT_AVAILABLE` indicating that there's no available data for the
23
+ # input locations.
24
+ # - `INVALID_REQUEST` indicating the API request was malformed.
25
+ # - `OVER_DAILY_LIMIT` indicating any of the following:
26
+ # - The API key is missing or invalid.
27
+ # - Billing has not been enabled on your account.
28
+ # - A self-imposed usage cap has been exceeded.
29
+ # - The provided method of payment is no longer valid (for example, a
30
+ # credit card has expired).
31
+ # - `OVER_QUERY_LIMIT` indicating the requestor has exceeded quota.
32
+ # - `REQUEST_DENIED` indicating the API did not complete the request.
33
+ # - `UNKNOWN_ERROR` indicating an unknown error.
34
+ # @return [ElevationStatus]
35
+ attr_accessor :status
36
+
37
+ # Status codes returned by service.
38
+ # - `OK` indicating the API request was successful.
39
+ # - `DATA_NOT_AVAILABLE` indicating that there's no available data for the
40
+ # input locations.
41
+ # - `INVALID_REQUEST` indicating the API request was malformed.
42
+ # - `OVER_DAILY_LIMIT` indicating any of the following:
43
+ # - The API key is missing or invalid.
44
+ # - Billing has not been enabled on your account.
45
+ # - A self-imposed usage cap has been exceeded.
46
+ # - The provided method of payment is no longer valid (for example, a
47
+ # credit card has expired).
48
+ # - `OVER_QUERY_LIMIT` indicating the requestor has exceeded quota.
49
+ # - `REQUEST_DENIED` indicating the API did not complete the request.
50
+ # - `UNKNOWN_ERROR` indicating an unknown error.
51
+ # @return [Array[Result]]
52
+ attr_accessor :results
53
+
54
+ # A mapping from model property names to API property names.
55
+ def self.names
56
+ @_hash = {} if @_hash.nil?
57
+ @_hash['error_message'] = 'error_message'
58
+ @_hash['status'] = 'status'
59
+ @_hash['results'] = 'results'
60
+ @_hash
61
+ end
62
+
63
+ # An array for optional fields
64
+ def self.optionals
65
+ %w[
66
+ error_message
67
+ ]
68
+ end
69
+
70
+ # An array for nullable fields
71
+ def self.nullables
72
+ []
73
+ end
74
+
75
+ def initialize(status:, results:, error_message: SKIP,
76
+ additional_properties: nil)
77
+ # Add additional model properties to the instance
78
+ additional_properties = {} if additional_properties.nil?
79
+
80
+ @error_message = error_message unless error_message == SKIP
81
+ @status = status
82
+ @results = results
83
+ @additional_properties = additional_properties
84
+ end
85
+
86
+ # Creates an instance of the object from a hash.
87
+ def self.from_hash(hash)
88
+ return nil unless hash
89
+
90
+ # Extract variables from the hash.
91
+ status = hash.key?('status') ? hash['status'] : nil
92
+ # Parameter is an array, so we need to iterate through it
93
+ results = nil
94
+ unless hash['results'].nil?
95
+ results = []
96
+ hash['results'].each do |structure|
97
+ results << (Result.from_hash(structure) if structure)
98
+ end
99
+ end
100
+
101
+ results = nil unless hash.key?('results')
102
+ error_message = hash.key?('error_message') ? hash['error_message'] : 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
+ MapsApiElevationJsonResponse.new(status: status,
113
+ results: results,
114
+ error_message: error_message,
115
+ additional_properties: additional_properties)
116
+ end
117
+
118
+ # Provides a human-readable string representation of the object.
119
+ def to_s
120
+ class_name = self.class.name.split('::').last
121
+ "<#{class_name} error_message: #{@error_message}, status: #{@status}, results: #{@results},"\
122
+ " additional_properties: #{@additional_properties}>"
123
+ end
124
+
125
+ # Provides a debugging-friendly string with detailed object information.
126
+ def inspect
127
+ class_name = self.class.name.split('::').last
128
+ "<#{class_name} error_message: #{@error_message.inspect}, status: #{@status.inspect},"\
129
+ " results: #{@results.inspect}, additional_properties: #{@additional_properties}>"
130
+ end
131
+ end
132
+ end
@@ -0,0 +1,48 @@
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
+ # maxprice.
8
+ class Maxprice
9
+ MAXPRICE = [
10
+ # TODO: Write general description for ENUM_0
11
+ ENUM_0 = '0'.freeze,
12
+
13
+ # TODO: Write general description for ENUM_1
14
+ ENUM_1 = '1'.freeze,
15
+
16
+ # TODO: Write general description for ENUM_2
17
+ ENUM_2 = '2'.freeze,
18
+
19
+ # TODO: Write general description for ENUM_3
20
+ ENUM_3 = '3'.freeze,
21
+
22
+ # TODO: Write general description for ENUM_4
23
+ ENUM_4 = '4'.freeze
24
+ ].freeze
25
+
26
+ def self.validate(value)
27
+ return false if value.nil?
28
+
29
+ MAXPRICE.include?(value)
30
+ end
31
+
32
+ def self.from_value(value, default_value = ENUM_0)
33
+ return default_value if value.nil?
34
+
35
+ str = value.to_s.strip
36
+
37
+ case str.downcase
38
+ when 'enum_0' then ENUM_0
39
+ when 'enum_1' then ENUM_1
40
+ when 'enum_2' then ENUM_2
41
+ when 'enum_3' then ENUM_3
42
+ when 'enum_4' then ENUM_4
43
+ else
44
+ default_value
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,48 @@
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
+ # minprice.
8
+ class Minprice
9
+ MINPRICE = [
10
+ # TODO: Write general description for ENUM_0
11
+ ENUM_0 = '0'.freeze,
12
+
13
+ # TODO: Write general description for ENUM_1
14
+ ENUM_1 = '1'.freeze,
15
+
16
+ # TODO: Write general description for ENUM_2
17
+ ENUM_2 = '2'.freeze,
18
+
19
+ # TODO: Write general description for ENUM_3
20
+ ENUM_3 = '3'.freeze,
21
+
22
+ # TODO: Write general description for ENUM_4
23
+ ENUM_4 = '4'.freeze
24
+ ].freeze
25
+
26
+ def self.validate(value)
27
+ return false if value.nil?
28
+
29
+ MINPRICE.include?(value)
30
+ end
31
+
32
+ def self.from_value(value, default_value = ENUM_0)
33
+ return default_value if value.nil?
34
+
35
+ str = value.to_s.strip
36
+
37
+ case str.downcase
38
+ when 'enum_0' then ENUM_0
39
+ when 'enum_1' then ENUM_1
40
+ when 'enum_2' then ENUM_2
41
+ when 'enum_3' then ENUM_3
42
+ when 'enum_4' then ENUM_4
43
+ else
44
+ default_value
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,44 @@
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
+ # mode.
8
+ class Mode
9
+ MODE = [
10
+ # TODO: Write general description for DRIVING
11
+ DRIVING = 'driving'.freeze,
12
+
13
+ # TODO: Write general description for BICYCLING
14
+ BICYCLING = 'bicycling'.freeze,
15
+
16
+ # TODO: Write general description for TRANSIT
17
+ TRANSIT = 'transit'.freeze,
18
+
19
+ # TODO: Write general description for WALKING
20
+ WALKING = 'walking'.freeze
21
+ ].freeze
22
+
23
+ def self.validate(value)
24
+ return false if value.nil?
25
+
26
+ MODE.include?(value)
27
+ end
28
+
29
+ def self.from_value(value, default_value = DRIVING)
30
+ return default_value if value.nil?
31
+
32
+ str = value.to_s.strip
33
+
34
+ case str.downcase
35
+ when 'driving' then DRIVING
36
+ when 'bicycling' then BICYCLING
37
+ when 'transit' then TRANSIT
38
+ when 'walking' then WALKING
39
+ else
40
+ default_value
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,90 @@
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
+ # NearestRoadsError Model.
8
+ class NearestRoadsError < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # This is the same as the HTTP status of the response.
13
+ # @return [Float]
14
+ attr_accessor :code
15
+
16
+ # A short description of the error.
17
+ # @return [String]
18
+ attr_accessor :message
19
+
20
+ # An error such as `INVALID_ARGUMENT`.
21
+ # @return [String]
22
+ attr_accessor :status
23
+
24
+ # A mapping from model property names to API property names.
25
+ def self.names
26
+ @_hash = {} if @_hash.nil?
27
+ @_hash['code'] = 'code'
28
+ @_hash['message'] = 'message'
29
+ @_hash['status'] = 'status'
30
+ @_hash
31
+ end
32
+
33
+ # An array for optional fields
34
+ def self.optionals
35
+ []
36
+ end
37
+
38
+ # An array for nullable fields
39
+ def self.nullables
40
+ []
41
+ end
42
+
43
+ def initialize(code:, message:, status:, additional_properties: nil)
44
+ # Add additional model properties to the instance
45
+ additional_properties = {} if additional_properties.nil?
46
+
47
+ @code = code
48
+ @message = message
49
+ @status = status
50
+ @additional_properties = additional_properties
51
+ end
52
+
53
+ # Creates an instance of the object from a hash.
54
+ def self.from_hash(hash)
55
+ return nil unless hash
56
+
57
+ # Extract variables from the hash.
58
+ code = hash.key?('code') ? hash['code'] : nil
59
+ message = hash.key?('message') ? hash['message'] : nil
60
+ status = hash.key?('status') ? hash['status'] : nil
61
+
62
+ # Create a new hash for additional properties, removing known properties.
63
+ new_hash = hash.reject { |k, _| names.value?(k) }
64
+
65
+ additional_properties = APIHelper.get_additional_properties(
66
+ new_hash, proc { |value| value }
67
+ )
68
+
69
+ # Create object from extracted values.
70
+ NearestRoadsError.new(code: code,
71
+ message: message,
72
+ status: status,
73
+ additional_properties: additional_properties)
74
+ end
75
+
76
+ # Provides a human-readable string representation of the object.
77
+ def to_s
78
+ class_name = self.class.name.split('::').last
79
+ "<#{class_name} code: #{@code}, message: #{@message}, status: #{@status},"\
80
+ " additional_properties: #{@additional_properties}>"
81
+ end
82
+
83
+ # Provides a debugging-friendly string with detailed object information.
84
+ def inspect
85
+ class_name = self.class.name.split('::').last
86
+ "<#{class_name} code: #{@code.inspect}, message: #{@message.inspect}, status:"\
87
+ " #{@status.inspect}, additional_properties: #{@additional_properties}>"
88
+ end
89
+ end
90
+ end
@@ -0,0 +1,86 @@
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
+ # NearestRoadsResponse Model.
8
+ class NearestRoadsResponse < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # An array of snapped points. Sometimes containing several snapped points
13
+ # for the same point with differing placeId or location.
14
+ # @return [Array[SnappedPoint]]
15
+ attr_accessor :snapped_points
16
+
17
+ # A mapping from model property names to API property names.
18
+ def self.names
19
+ @_hash = {} if @_hash.nil?
20
+ @_hash['snapped_points'] = 'snappedPoints'
21
+ @_hash
22
+ end
23
+
24
+ # An array for optional fields
25
+ def self.optionals
26
+ %w[
27
+ snapped_points
28
+ ]
29
+ end
30
+
31
+ # An array for nullable fields
32
+ def self.nullables
33
+ []
34
+ end
35
+
36
+ def initialize(snapped_points: SKIP, additional_properties: nil)
37
+ # Add additional model properties to the instance
38
+ additional_properties = {} if additional_properties.nil?
39
+
40
+ @snapped_points = snapped_points unless snapped_points == SKIP
41
+ @additional_properties = additional_properties
42
+ end
43
+
44
+ # Creates an instance of the object from a hash.
45
+ def self.from_hash(hash)
46
+ return nil unless hash
47
+
48
+ # Extract variables from the hash.
49
+ # Parameter is an array, so we need to iterate through it
50
+ snapped_points = nil
51
+ unless hash['snappedPoints'].nil?
52
+ snapped_points = []
53
+ hash['snappedPoints'].each do |structure|
54
+ snapped_points << (SnappedPoint.from_hash(structure) if structure)
55
+ end
56
+ end
57
+
58
+ snapped_points = SKIP unless hash.key?('snappedPoints')
59
+
60
+ # Create a new hash for additional properties, removing known properties.
61
+ new_hash = hash.reject { |k, _| names.value?(k) }
62
+
63
+ additional_properties = APIHelper.get_additional_properties(
64
+ new_hash, proc { |value| value }
65
+ )
66
+
67
+ # Create object from extracted values.
68
+ NearestRoadsResponse.new(snapped_points: snapped_points,
69
+ additional_properties: additional_properties)
70
+ end
71
+
72
+ # Provides a human-readable string representation of the object.
73
+ def to_s
74
+ class_name = self.class.name.split('::').last
75
+ "<#{class_name} snapped_points: #{@snapped_points}, additional_properties:"\
76
+ " #{@additional_properties}>"
77
+ end
78
+
79
+ # Provides a debugging-friendly string with detailed object information.
80
+ def inspect
81
+ class_name = self.class.name.split('::').last
82
+ "<#{class_name} snapped_points: #{@snapped_points.inspect}, additional_properties:"\
83
+ " #{@additional_properties}>"
84
+ end
85
+ end
86
+ end