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,138 @@
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
+ # An object describing the opening hours of a place.
8
+ class PlaceOpeningHours < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # A boolean value indicating if the place is open at the current time.
13
+ # @return [TrueClass | FalseClass]
14
+ attr_accessor :open_now
15
+
16
+ # An array of opening periods covering seven days, starting from Sunday, in
17
+ # chronological order.
18
+ # @return [Array[PlaceOpeningHoursPeriod]]
19
+ attr_accessor :periods
20
+
21
+ # An array of up to seven entries corresponding to the next seven days.
22
+ # @return [Array[PlaceSpecialDay]]
23
+ attr_accessor :special_days
24
+
25
+ # A type string used to identify the type of secondary hours (for example,
26
+ # `DRIVE_THROUGH`, `HAPPY_HOUR`, `DELIVERY`, `TAKEOUT`, `KITCHEN`,
27
+ # `BREAKFAST`, `LUNCH`, `DINNER`, `BRUNCH`, `PICKUP`, `SENIOR_HOURS`). Set
28
+ # for `secondary_opening_hours` only.
29
+ # @return [String]
30
+ attr_accessor :type
31
+
32
+ # An array of strings describing in human-readable text the hours of the
33
+ # place.
34
+ # @return [Array[String]]
35
+ attr_accessor :weekday_text
36
+
37
+ # A mapping from model property names to API property names.
38
+ def self.names
39
+ @_hash = {} if @_hash.nil?
40
+ @_hash['open_now'] = 'open_now'
41
+ @_hash['periods'] = 'periods'
42
+ @_hash['special_days'] = 'special_days'
43
+ @_hash['type'] = 'type'
44
+ @_hash['weekday_text'] = 'weekday_text'
45
+ @_hash
46
+ end
47
+
48
+ # An array for optional fields
49
+ def self.optionals
50
+ %w[
51
+ open_now
52
+ periods
53
+ special_days
54
+ type
55
+ weekday_text
56
+ ]
57
+ end
58
+
59
+ # An array for nullable fields
60
+ def self.nullables
61
+ []
62
+ end
63
+
64
+ def initialize(open_now: SKIP, periods: SKIP, special_days: SKIP,
65
+ type: SKIP, weekday_text: SKIP, additional_properties: nil)
66
+ # Add additional model properties to the instance
67
+ additional_properties = {} if additional_properties.nil?
68
+
69
+ @open_now = open_now unless open_now == SKIP
70
+ @periods = periods unless periods == SKIP
71
+ @special_days = special_days unless special_days == SKIP
72
+ @type = type unless type == SKIP
73
+ @weekday_text = weekday_text unless weekday_text == SKIP
74
+ @additional_properties = additional_properties
75
+ end
76
+
77
+ # Creates an instance of the object from a hash.
78
+ def self.from_hash(hash)
79
+ return nil unless hash
80
+
81
+ # Extract variables from the hash.
82
+ open_now = hash.key?('open_now') ? hash['open_now'] : SKIP
83
+ # Parameter is an array, so we need to iterate through it
84
+ periods = nil
85
+ unless hash['periods'].nil?
86
+ periods = []
87
+ hash['periods'].each do |structure|
88
+ periods << (PlaceOpeningHoursPeriod.from_hash(structure) if structure)
89
+ end
90
+ end
91
+
92
+ periods = SKIP unless hash.key?('periods')
93
+ # Parameter is an array, so we need to iterate through it
94
+ special_days = nil
95
+ unless hash['special_days'].nil?
96
+ special_days = []
97
+ hash['special_days'].each do |structure|
98
+ special_days << (PlaceSpecialDay.from_hash(structure) if structure)
99
+ end
100
+ end
101
+
102
+ special_days = SKIP unless hash.key?('special_days')
103
+ type = hash.key?('type') ? hash['type'] : SKIP
104
+ weekday_text = hash.key?('weekday_text') ? hash['weekday_text'] : SKIP
105
+
106
+ # Create a new hash for additional properties, removing known properties.
107
+ new_hash = hash.reject { |k, _| names.value?(k) }
108
+
109
+ additional_properties = APIHelper.get_additional_properties(
110
+ new_hash, proc { |value| value }
111
+ )
112
+
113
+ # Create object from extracted values.
114
+ PlaceOpeningHours.new(open_now: open_now,
115
+ periods: periods,
116
+ special_days: special_days,
117
+ type: type,
118
+ weekday_text: weekday_text,
119
+ additional_properties: additional_properties)
120
+ end
121
+
122
+ # Provides a human-readable string representation of the object.
123
+ def to_s
124
+ class_name = self.class.name.split('::').last
125
+ "<#{class_name} open_now: #{@open_now}, periods: #{@periods}, special_days:"\
126
+ " #{@special_days}, type: #{@type}, weekday_text: #{@weekday_text}, additional_properties:"\
127
+ " #{@additional_properties}>"
128
+ end
129
+
130
+ # Provides a debugging-friendly string with detailed object information.
131
+ def inspect
132
+ class_name = self.class.name.split('::').last
133
+ "<#{class_name} open_now: #{@open_now.inspect}, periods: #{@periods.inspect}, special_days:"\
134
+ " #{@special_days.inspect}, type: #{@type.inspect}, weekday_text: #{@weekday_text.inspect},"\
135
+ " additional_properties: #{@additional_properties}>"
136
+ end
137
+ end
138
+ end
@@ -0,0 +1,84 @@
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
+ # PlaceOpeningHoursPeriod Model.
8
+ class PlaceOpeningHoursPeriod < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [PlaceOpeningHoursPeriodDetail]
14
+ attr_accessor :open
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [PlaceOpeningHoursPeriodDetail]
18
+ attr_accessor :close
19
+
20
+ # A mapping from model property names to API property names.
21
+ def self.names
22
+ @_hash = {} if @_hash.nil?
23
+ @_hash['open'] = 'open'
24
+ @_hash['close'] = 'close'
25
+ @_hash
26
+ end
27
+
28
+ # An array for optional fields
29
+ def self.optionals
30
+ %w[
31
+ close
32
+ ]
33
+ end
34
+
35
+ # An array for nullable fields
36
+ def self.nullables
37
+ []
38
+ end
39
+
40
+ def initialize(open:, close: SKIP, additional_properties: nil)
41
+ # Add additional model properties to the instance
42
+ additional_properties = {} if additional_properties.nil?
43
+
44
+ @open = open
45
+ @close = close unless close == SKIP
46
+ @additional_properties = additional_properties
47
+ end
48
+
49
+ # Creates an instance of the object from a hash.
50
+ def self.from_hash(hash)
51
+ return nil unless hash
52
+
53
+ # Extract variables from the hash.
54
+ open = PlaceOpeningHoursPeriodDetail.from_hash(hash['open']) if hash['open']
55
+ close = PlaceOpeningHoursPeriodDetail.from_hash(hash['close']) if hash['close']
56
+
57
+ # Create a new hash for additional properties, removing known properties.
58
+ new_hash = hash.reject { |k, _| names.value?(k) }
59
+
60
+ additional_properties = APIHelper.get_additional_properties(
61
+ new_hash, proc { |value| value }
62
+ )
63
+
64
+ # Create object from extracted values.
65
+ PlaceOpeningHoursPeriod.new(open: open,
66
+ close: close,
67
+ additional_properties: additional_properties)
68
+ end
69
+
70
+ # Provides a human-readable string representation of the object.
71
+ def to_s
72
+ class_name = self.class.name.split('::').last
73
+ "<#{class_name} open: #{@open}, close: #{@close}, additional_properties:"\
74
+ " #{@additional_properties}>"
75
+ end
76
+
77
+ # Provides a debugging-friendly string with detailed object information.
78
+ def inspect
79
+ class_name = self.class.name.split('::').last
80
+ "<#{class_name} open: #{@open.inspect}, close: #{@close.inspect}, additional_properties:"\
81
+ " #{@additional_properties}>"
82
+ end
83
+ end
84
+ end
@@ -0,0 +1,108 @@
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
+ # PlaceOpeningHoursPeriodDetail Model.
8
+ class PlaceOpeningHoursPeriodDetail < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # A date expressed in RFC3339 format in the local timezone for the place,
13
+ # for example 2010-12-31.
14
+ # @return [String]
15
+ attr_accessor :date
16
+
17
+ # A number from 0–6, corresponding to the days of the week, starting on
18
+ # Sunday. For example, 2 means Tuesday.
19
+ # @return [Float]
20
+ attr_accessor :day
21
+
22
+ # May contain a time of day in 24-hour hhmm format. Values are in the range
23
+ # 0000–2359. The time will be reported in the place’s time zone.
24
+ # @return [String]
25
+ attr_accessor :time
26
+
27
+ # True if a given period was truncated due to a seven-day cutoff, where the
28
+ # period starts before midnight on the date of the request and/or ends at or
29
+ # after midnight on the last day. This property indicates that the period
30
+ # for open or close can extend past this seven-day cutoff.
31
+ # @return [TrueClass | FalseClass]
32
+ attr_accessor :truncated
33
+
34
+ # A mapping from model property names to API property names.
35
+ def self.names
36
+ @_hash = {} if @_hash.nil?
37
+ @_hash['date'] = 'date'
38
+ @_hash['day'] = 'day'
39
+ @_hash['time'] = 'time'
40
+ @_hash['truncated'] = 'truncated'
41
+ @_hash
42
+ end
43
+
44
+ # An array for optional fields
45
+ def self.optionals
46
+ %w[
47
+ date
48
+ truncated
49
+ ]
50
+ end
51
+
52
+ # An array for nullable fields
53
+ def self.nullables
54
+ []
55
+ end
56
+
57
+ def initialize(day:, time:, date: SKIP, truncated: SKIP,
58
+ additional_properties: nil)
59
+ # Add additional model properties to the instance
60
+ additional_properties = {} if additional_properties.nil?
61
+
62
+ @date = date unless date == SKIP
63
+ @day = day
64
+ @time = time
65
+ @truncated = truncated unless truncated == SKIP
66
+ @additional_properties = additional_properties
67
+ end
68
+
69
+ # Creates an instance of the object from a hash.
70
+ def self.from_hash(hash)
71
+ return nil unless hash
72
+
73
+ # Extract variables from the hash.
74
+ day = hash.key?('day') ? hash['day'] : nil
75
+ time = hash.key?('time') ? hash['time'] : nil
76
+ date = hash.key?('date') ? hash['date'] : SKIP
77
+ truncated = hash.key?('truncated') ? hash['truncated'] : SKIP
78
+
79
+ # Create a new hash for additional properties, removing known properties.
80
+ new_hash = hash.reject { |k, _| names.value?(k) }
81
+
82
+ additional_properties = APIHelper.get_additional_properties(
83
+ new_hash, proc { |value| value }
84
+ )
85
+
86
+ # Create object from extracted values.
87
+ PlaceOpeningHoursPeriodDetail.new(day: day,
88
+ time: time,
89
+ date: date,
90
+ truncated: truncated,
91
+ additional_properties: additional_properties)
92
+ end
93
+
94
+ # Provides a human-readable string representation of the object.
95
+ def to_s
96
+ class_name = self.class.name.split('::').last
97
+ "<#{class_name} date: #{@date}, day: #{@day}, time: #{@time}, truncated: #{@truncated},"\
98
+ " additional_properties: #{@additional_properties}>"
99
+ end
100
+
101
+ # Provides a debugging-friendly string with detailed object information.
102
+ def inspect
103
+ class_name = self.class.name.split('::').last
104
+ "<#{class_name} date: #{@date.inspect}, day: #{@day.inspect}, time: #{@time.inspect},"\
105
+ " truncated: #{@truncated.inspect}, additional_properties: #{@additional_properties}>"
106
+ end
107
+ end
108
+ end
@@ -0,0 +1,109 @@
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
+ # A photo of a Place. The photo can be accesed via the [Place
8
+ # Photo](https://developers.google.com/places/web-service/photos) API using an
9
+ # url in the following pattern: ```
10
+ # https://maps.googleapis.com/maps/api/place/photo?maxwidth=400&photo_referenc
11
+ # e=photo_reference&key=YOUR_API_KEY ``` See [Place
12
+ # Photos](https://developers.google.com/places/web-service/photos) for more
13
+ # information.
14
+ class PlacePhoto < BaseModel
15
+ SKIP = Object.new
16
+ private_constant :SKIP
17
+
18
+ # The height of the photo.
19
+ # @return [Float]
20
+ attr_accessor :height
21
+
22
+ # The width of the photo.
23
+ # @return [Float]
24
+ attr_accessor :width
25
+
26
+ # The HTML attributions for the photo.
27
+ # @return [Array[String]]
28
+ attr_accessor :html_attributions
29
+
30
+ # A string used to identify the photo when you perform a Photo request.
31
+ # @return [String]
32
+ attr_accessor :photo_reference
33
+
34
+ # A mapping from model property names to API property names.
35
+ def self.names
36
+ @_hash = {} if @_hash.nil?
37
+ @_hash['height'] = 'height'
38
+ @_hash['width'] = 'width'
39
+ @_hash['html_attributions'] = 'html_attributions'
40
+ @_hash['photo_reference'] = 'photo_reference'
41
+ @_hash
42
+ end
43
+
44
+ # An array for optional fields
45
+ def self.optionals
46
+ []
47
+ end
48
+
49
+ # An array for nullable fields
50
+ def self.nullables
51
+ []
52
+ end
53
+
54
+ def initialize(height:, width:, html_attributions:, photo_reference:,
55
+ additional_properties: nil)
56
+ # Add additional model properties to the instance
57
+ additional_properties = {} if additional_properties.nil?
58
+
59
+ @height = height
60
+ @width = width
61
+ @html_attributions = html_attributions
62
+ @photo_reference = photo_reference
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
+ height = hash.key?('height') ? hash['height'] : nil
72
+ width = hash.key?('width') ? hash['width'] : nil
73
+ html_attributions =
74
+ hash.key?('html_attributions') ? hash['html_attributions'] : nil
75
+ photo_reference =
76
+ hash.key?('photo_reference') ? hash['photo_reference'] : nil
77
+
78
+ # Create a new hash for additional properties, removing known properties.
79
+ new_hash = hash.reject { |k, _| names.value?(k) }
80
+
81
+ additional_properties = APIHelper.get_additional_properties(
82
+ new_hash, proc { |value| value }
83
+ )
84
+
85
+ # Create object from extracted values.
86
+ PlacePhoto.new(height: height,
87
+ width: width,
88
+ html_attributions: html_attributions,
89
+ photo_reference: photo_reference,
90
+ additional_properties: additional_properties)
91
+ end
92
+
93
+ # Provides a human-readable string representation of the object.
94
+ def to_s
95
+ class_name = self.class.name.split('::').last
96
+ "<#{class_name} height: #{@height}, width: #{@width}, html_attributions:"\
97
+ " #{@html_attributions}, photo_reference: #{@photo_reference}, additional_properties:"\
98
+ " #{@additional_properties}>"
99
+ end
100
+
101
+ # Provides a debugging-friendly string with detailed object information.
102
+ def inspect
103
+ class_name = self.class.name.split('::').last
104
+ "<#{class_name} height: #{@height.inspect}, width: #{@width.inspect}, html_attributions:"\
105
+ " #{@html_attributions.inspect}, photo_reference: #{@photo_reference.inspect},"\
106
+ " additional_properties: #{@additional_properties}>"
107
+ end
108
+ end
109
+ end
@@ -0,0 +1,186 @@
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
+ # A review of the place submitted by a user.
8
+ class PlaceReview < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The name of the user who submitted the review. Anonymous reviews are
13
+ # attributed to "A Google user".
14
+ # @return [String]
15
+ attr_accessor :author_name
16
+
17
+ # The URL to the user's Google Maps Local Guides profile, if available.
18
+ # @return [String]
19
+ attr_accessor :author_url
20
+
21
+ # The URL to the user's profile photo, if available.
22
+ # @return [String]
23
+ attr_accessor :profile_photo_url
24
+
25
+ # An IETF language code indicating the language of the returned review.
26
+ # This field contains the main language tag only, and not the secondary tag
27
+ # indicating country or region. For example, all the English reviews are
28
+ # tagged as 'en', and not 'en-AU' or 'en-UK' and so on.
29
+ # This field is empty if there is only a rating with no review text.
30
+ # @return [String]
31
+ attr_accessor :language
32
+
33
+ # An IETF language code indicating the original language of the review. If
34
+ # the review has been translated, then `original_language` != `language`.
35
+ # This field contains the main language tag only, and not the secondary tag
36
+ # indicating country or region. For example, all the English reviews are
37
+ # tagged as 'en', and not 'en-AU' or 'en-UK' and so on.
38
+ # This field is empty if there is only a rating with no review text.
39
+ # @return [String]
40
+ attr_accessor :original_language
41
+
42
+ # The user's overall rating for this place. This is a whole number, ranging
43
+ # from 1 to 5.
44
+ # @return [Float]
45
+ attr_accessor :rating
46
+
47
+ # The time that the review was submitted in text, relative to the current
48
+ # time.
49
+ # @return [String]
50
+ attr_accessor :relative_time_description
51
+
52
+ # The user's review. When reviewing a location with Google Places, text
53
+ # reviews are considered optional. Therefore, this field may be empty. Note
54
+ # that this field may include simple HTML markup. For example, the entity
55
+ # reference `&amp;` may represent an ampersand character.
56
+ # @return [String]
57
+ attr_accessor :text
58
+
59
+ # The time that the review was submitted, measured in the number of seconds
60
+ # since since midnight, January 1, 1970 UTC.
61
+ # @return [Float]
62
+ attr_accessor :time
63
+
64
+ # A boolean value indicating if the review was translated from the original
65
+ # language it was written in.
66
+ # If a review has been translated, corresponding to a value of true, Google
67
+ # recommends that you indicate this to your users. For example, you can add
68
+ # the following string, “Translated by Google”, to the review.
69
+ # @return [TrueClass | FalseClass]
70
+ attr_accessor :translated
71
+
72
+ # A mapping from model property names to API property names.
73
+ def self.names
74
+ @_hash = {} if @_hash.nil?
75
+ @_hash['author_name'] = 'author_name'
76
+ @_hash['author_url'] = 'author_url'
77
+ @_hash['profile_photo_url'] = 'profile_photo_url'
78
+ @_hash['language'] = 'language'
79
+ @_hash['original_language'] = 'original_language'
80
+ @_hash['rating'] = 'rating'
81
+ @_hash['relative_time_description'] = 'relative_time_description'
82
+ @_hash['text'] = 'text'
83
+ @_hash['time'] = 'time'
84
+ @_hash['translated'] = 'translated'
85
+ @_hash
86
+ end
87
+
88
+ # An array for optional fields
89
+ def self.optionals
90
+ %w[
91
+ author_url
92
+ profile_photo_url
93
+ language
94
+ original_language
95
+ text
96
+ translated
97
+ ]
98
+ end
99
+
100
+ # An array for nullable fields
101
+ def self.nullables
102
+ []
103
+ end
104
+
105
+ def initialize(author_name:, rating:, relative_time_description:, time:,
106
+ author_url: SKIP, profile_photo_url: SKIP, language: SKIP,
107
+ original_language: SKIP, text: SKIP, translated: SKIP,
108
+ additional_properties: nil)
109
+ # Add additional model properties to the instance
110
+ additional_properties = {} if additional_properties.nil?
111
+
112
+ @author_name = author_name
113
+ @author_url = author_url unless author_url == SKIP
114
+ @profile_photo_url = profile_photo_url unless profile_photo_url == SKIP
115
+ @language = language unless language == SKIP
116
+ @original_language = original_language unless original_language == SKIP
117
+ @rating = rating
118
+ @relative_time_description = relative_time_description
119
+ @text = text unless text == SKIP
120
+ @time = time
121
+ @translated = translated unless translated == SKIP
122
+ @additional_properties = additional_properties
123
+ end
124
+
125
+ # Creates an instance of the object from a hash.
126
+ def self.from_hash(hash)
127
+ return nil unless hash
128
+
129
+ # Extract variables from the hash.
130
+ author_name = hash.key?('author_name') ? hash['author_name'] : nil
131
+ rating = hash.key?('rating') ? hash['rating'] : nil
132
+ relative_time_description =
133
+ hash.key?('relative_time_description') ? hash['relative_time_description'] : nil
134
+ time = hash.key?('time') ? hash['time'] : nil
135
+ author_url = hash.key?('author_url') ? hash['author_url'] : SKIP
136
+ profile_photo_url =
137
+ hash.key?('profile_photo_url') ? hash['profile_photo_url'] : SKIP
138
+ language = hash.key?('language') ? hash['language'] : SKIP
139
+ original_language =
140
+ hash.key?('original_language') ? hash['original_language'] : SKIP
141
+ text = hash.key?('text') ? hash['text'] : SKIP
142
+ translated = hash.key?('translated') ? hash['translated'] : SKIP
143
+
144
+ # Create a new hash for additional properties, removing known properties.
145
+ new_hash = hash.reject { |k, _| names.value?(k) }
146
+
147
+ additional_properties = APIHelper.get_additional_properties(
148
+ new_hash, proc { |value| value }
149
+ )
150
+
151
+ # Create object from extracted values.
152
+ PlaceReview.new(author_name: author_name,
153
+ rating: rating,
154
+ relative_time_description: relative_time_description,
155
+ time: time,
156
+ author_url: author_url,
157
+ profile_photo_url: profile_photo_url,
158
+ language: language,
159
+ original_language: original_language,
160
+ text: text,
161
+ translated: translated,
162
+ additional_properties: additional_properties)
163
+ end
164
+
165
+ # Provides a human-readable string representation of the object.
166
+ def to_s
167
+ class_name = self.class.name.split('::').last
168
+ "<#{class_name} author_name: #{@author_name}, author_url: #{@author_url},"\
169
+ " profile_photo_url: #{@profile_photo_url}, language: #{@language}, original_language:"\
170
+ " #{@original_language}, rating: #{@rating}, relative_time_description:"\
171
+ " #{@relative_time_description}, text: #{@text}, time: #{@time}, translated: #{@translated},"\
172
+ " additional_properties: #{@additional_properties}>"
173
+ end
174
+
175
+ # Provides a debugging-friendly string with detailed object information.
176
+ def inspect
177
+ class_name = self.class.name.split('::').last
178
+ "<#{class_name} author_name: #{@author_name.inspect}, author_url: #{@author_url.inspect},"\
179
+ " profile_photo_url: #{@profile_photo_url.inspect}, language: #{@language.inspect},"\
180
+ " original_language: #{@original_language.inspect}, rating: #{@rating.inspect},"\
181
+ " relative_time_description: #{@relative_time_description.inspect}, text: #{@text.inspect},"\
182
+ " time: #{@time.inspect}, translated: #{@translated.inspect}, additional_properties:"\
183
+ " #{@additional_properties}>"
184
+ end
185
+ end
186
+ end