ev-recharge-sdk 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +38 -21
  3. data/lib/shell_ev/client.rb +8 -8
  4. data/lib/shell_ev/configuration.rb +13 -17
  5. data/lib/shell_ev/controllers/base_controller.rb +9 -9
  6. data/lib/shell_ev/controllers/charging_controller.rb +121 -154
  7. data/lib/shell_ev/controllers/locations_controller.rb +226 -142
  8. data/lib/shell_ev/controllers/o_auth_authorization_controller.rb +8 -8
  9. data/lib/shell_ev/exceptions/bad_request_exception.rb +33 -18
  10. data/lib/shell_ev/exceptions/{m405_error_response_error1_exception.rb → internal_server_error_exception.rb} +31 -26
  11. data/lib/shell_ev/exceptions/not_found_exception.rb +36 -19
  12. data/lib/shell_ev/exceptions/o_auth_provider_exception.rb +15 -15
  13. data/lib/shell_ev/exceptions/{m400_error_response_error1_exception.rb → serviceunavailable_exception.rb} +28 -28
  14. data/lib/shell_ev/exceptions/{m401_error_response_error1_exception.rb → too_many_requests_exception.rb} +28 -28
  15. data/lib/shell_ev/exceptions/unauthorized_exception.rb +32 -18
  16. data/lib/shell_ev/http/auth/o_auth2.rb +54 -10
  17. data/lib/shell_ev/models/accessibility.rb +1 -2
  18. data/lib/shell_ev/models/active_response200_json.rb +11 -13
  19. data/lib/shell_ev/models/address.rb +1 -3
  20. data/lib/shell_ev/models/bad_request_err_msg.rb +82 -0
  21. data/lib/shell_ev/models/{stop_charge_session_request_body_json.rb → charge_error.rb} +21 -10
  22. data/lib/shell_ev/models/charge_retrieve_state.rb +63 -0
  23. data/lib/shell_ev/models/chargesession_start_body.rb +7 -9
  24. data/lib/shell_ev/models/connector_vo.rb +4 -9
  25. data/lib/shell_ev/models/coordinates.rb +1 -2
  26. data/lib/shell_ev/models/data_active.rb +27 -45
  27. data/lib/shell_ev/models/data_retrieve.rb +31 -49
  28. data/lib/shell_ev/models/electrical_properties.rb +1 -3
  29. data/lib/shell_ev/models/evse_vo.rb +3 -8
  30. data/lib/shell_ev/models/get_charge_session_retrieve_response200_json.rb +11 -13
  31. data/lib/shell_ev/models/{get_markers_list_authorization_methods_enum.rb → get_ev_locations_authorization_methods_enum.rb} +4 -4
  32. data/lib/shell_ev/models/{get_markers_list_connector_types_enum.rb → get_ev_locations_connector_types_enum.rb} +4 -4
  33. data/lib/shell_ev/models/{get_markers_list_evse_status_enum.rb → get_ev_locations_evse_status_enum.rb} +4 -4
  34. data/lib/shell_ev/models/inline_response202.rb +9 -11
  35. data/lib/shell_ev/models/inline_response2021.rb +5 -6
  36. data/lib/shell_ev/models/inline_response202_data.rb +7 -5
  37. data/lib/shell_ev/models/internal_error_object.rb +70 -0
  38. data/lib/shell_ev/models/location_respone_object.rb +4 -11
  39. data/lib/shell_ev/models/{get_locations_list_authorization_methods_enum.rb → locations_markers_authorization_methods_enum.rb} +4 -4
  40. data/lib/shell_ev/models/{get_locations_list_connector_types_enum.rb → locations_markers_connector_types_enum.rb} +4 -4
  41. data/lib/shell_ev/models/{get_locations_list_evse_status_enum.rb → locations_markers_evse_status_enum.rb} +4 -4
  42. data/lib/shell_ev/models/multi_location_marker.rb +2 -6
  43. data/lib/shell_ev/models/{get_nearby_locations_authorization_methods_enum.rb → nearby_locations_authorization_methods_enum.rb} +4 -4
  44. data/lib/shell_ev/models/{get_nearby_locations_connector_types_enum.rb → nearby_locations_connector_types_enum.rb} +4 -4
  45. data/lib/shell_ev/models/{get_nearby_locations_evse_status_enum.rb → nearby_locations_evse_status_enum.rb} +4 -4
  46. data/lib/shell_ev/models/not_found_err_msg.rb +82 -0
  47. data/lib/shell_ev/models/o_auth_token.rb +2 -6
  48. data/lib/shell_ev/models/opening_hours_object.rb +1 -3
  49. data/lib/shell_ev/models/ratelimit_err_msg.rb +82 -0
  50. data/lib/shell_ev/models/response.rb +78 -0
  51. data/lib/shell_ev/models/serviceunavailable_err_msg.rb +82 -0
  52. data/lib/shell_ev/models/single_location_marker.rb +5 -11
  53. data/lib/shell_ev/models/single_location_marker_authorization_methods_items_enum.rb +1 -1
  54. data/lib/shell_ev/models/single_location_marker_response.rb +81 -0
  55. data/lib/shell_ev/models/tariff_vo.rb +3 -7
  56. data/lib/shell_ev/models/unauthorized_err_msg.rb +82 -0
  57. data/lib/shell_ev/utilities/file_wrapper.rb +9 -9
  58. data/lib/shell_ev/utilities/union_type_lookup.rb +3 -2
  59. data/lib/shell_ev.rb +40 -60
  60. data/test/controllers/controller_test_base.rb +0 -5
  61. data/test/controllers/test_charging_controller.rb +74 -17
  62. data/test/controllers/test_locations_controller.rb +65 -0
  63. metadata +31 -49
  64. data/lib/shell_ev/exceptions/http401_error_response_exception.rb +0 -52
  65. data/lib/shell_ev/exceptions/m404_error_response_error1_exception.rb +0 -53
  66. data/lib/shell_ev/exceptions/m429_error_response_error1_exception.rb +0 -52
  67. data/lib/shell_ev/exceptions/m500_error_response_error1_exception.rb +0 -52
  68. data/lib/shell_ev/exceptions/m503_error_response_error1_exception.rb +0 -52
  69. data/lib/shell_ev/models/data_active_session_code_enum.rb +0 -44
  70. data/lib/shell_ev/models/data_active_session_state_enum.rb +0 -35
  71. data/lib/shell_ev/models/data_retrieve_session_code_enum.rb +0 -44
  72. data/lib/shell_ev/models/data_retrieve_session_state_enum.rb +0 -35
  73. data/lib/shell_ev/models/env_enum.rb +0 -23
  74. data/lib/shell_ev/models/m400_error_response.rb +0 -78
  75. data/lib/shell_ev/models/m400_error_response_error.rb +0 -80
  76. data/lib/shell_ev/models/m401_error_response.rb +0 -78
  77. data/lib/shell_ev/models/m401_error_response_error.rb +0 -80
  78. data/lib/shell_ev/models/m404_error_response.rb +0 -79
  79. data/lib/shell_ev/models/m404_error_response_error.rb +0 -80
  80. data/lib/shell_ev/models/m405_error_response.rb +0 -78
  81. data/lib/shell_ev/models/m405_error_response_error.rb +0 -80
  82. data/lib/shell_ev/models/m429_error_response.rb +0 -78
  83. data/lib/shell_ev/models/m429_error_response_error.rb +0 -80
  84. data/lib/shell_ev/models/m500_error_response.rb +0 -78
  85. data/lib/shell_ev/models/m500_error_response_error.rb +0 -80
  86. data/lib/shell_ev/models/m503_error_response.rb +0 -78
  87. data/lib/shell_ev/models/m503_error_response_error.rb +0 -80
  88. data/lib/shell_ev/models/response_base_status_enum.rb +0 -26
  89. data/lib/shell_ev/models/response_error401_all_of1.rb +0 -57
  90. data/lib/shell_ev/models/response_error401_all_of1_errors_items.rb +0 -80
  91. data/lib/shell_ev/models/success_response.rb +0 -58
@@ -8,7 +8,7 @@ module ShellEv
8
8
  class LocationsController < BaseController
9
9
  # This API provides the list of all Shell Recharge locations. The list
10
10
  # includes all Shell Recharge network and all locations available through
11
- # our roaming partners.The end point provides flexible search criteria in
11
+ # our roaming partners. The end point provides flexible search criteria in
12
12
  # order to get the list of Shell Recharge Network. The end point provides
13
13
  # the details such as the exact location/address of the site along with the
14
14
  # up-to-date status information of all the charging units in the site.
@@ -17,17 +17,21 @@ module ShellEv
17
17
  # * Based on available connector types.
18
18
  # * Based on minimum Power output (in kW) available
19
19
  # * Based on a specific charging unit ID (EVSE ID)
20
- # @param [String] request_id Required parameter: A unique request id in GUID
21
- # format. The value is written to the Shell API Platform audit log for end
22
- # to end traceability of a request.
23
- # @param [GetLocationsListEvseStatusEnum] evse_status Optional parameter:
20
+ # @param [UUID | String] request_id Required parameter: RequestId must be
21
+ # unique identifier value that can be used by the consumer to correlate each
22
+ # request /response .<br>Format.<br> Its canonical textual representation,
23
+ # the 16 octets of a UUID are represented as 32 hexadecimal (base-16)
24
+ # digits, displayed in five groups separated by hyphens, in the form
25
+ # 8-4-4-4-12 for a total of 36 characters (32 hexadecimal characters and 4
26
+ # hyphens) <br>
27
+ # @param [GetEVLocationsEvseStatusEnum] evse_status Optional parameter:
24
28
  # Filter by Locations that have the given status
25
- # @param [GetLocationsListConnectorTypesEnum] connector_types Optional
29
+ # @param [GetEVLocationsConnectorTypesEnum] connector_types Optional
26
30
  # parameter: Filter by Locations that have Connectors with the set of
27
31
  # Connector Types
28
32
  # @param [Float] connector_min_power Optional parameter: Filter by Locations
29
33
  # that have a Connector with at least this power output (in kW)
30
- # @param [GetLocationsListAuthorizationMethodsEnum] authorization_methods
34
+ # @param [GetEVLocationsAuthorizationMethodsEnum] authorization_methods
31
35
  # Optional parameter: Filter by Locations that support the given
32
36
  # Authorization Methods
33
37
  # @param [TrueClass | FalseClass] with_operator_name Optional parameter:
@@ -42,24 +46,32 @@ module ShellEv
42
46
  # externalID provided by Shell Recharge)
43
47
  # @param [Integer] page_number Optional parameter: Restrict the response
44
48
  # list by providing a specific set of page Number. Set perPage parameter
45
- # also when pageNumber is used.
49
+ # also when page Number is used.
46
50
  # @param [Integer] per_page Optional parameter: Restrict the number of sites
47
- # in reposne per page.
51
+ # in response per page.
48
52
  # @param [String] updated_since Optional parameter: ZonedDateTime as
49
53
  # string
50
- # @return [Array[LocationResponeObject]] response from the API call
51
- def get_locations_list(request_id,
52
- evse_status: nil,
53
- connector_types: nil,
54
- connector_min_power: nil,
55
- authorization_methods: nil,
56
- with_operator_name: nil,
57
- evse_id: nil,
58
- location_external_id: nil,
59
- evse_external_id: nil,
60
- page_number: nil,
61
- per_page: nil,
62
- updated_since: nil)
54
+ # @param [Array[String]] country Optional parameter: Filter by Locations
55
+ # that are at least in one of the given countries (specified using ISO
56
+ # 3166-1 alpha-3 codes)
57
+ # @param [Array[String]] exclude_country Optional parameter: Filter by
58
+ # Locations that are not in one of the given countries (specified using ISO
59
+ # 3166-1 alpha-3 codes)
60
+ # @return [Response] response from the API call
61
+ def get_ev_locations(request_id,
62
+ evse_status: nil,
63
+ connector_types: nil,
64
+ connector_min_power: nil,
65
+ authorization_methods: nil,
66
+ with_operator_name: nil,
67
+ evse_id: nil,
68
+ location_external_id: nil,
69
+ evse_external_id: nil,
70
+ page_number: nil,
71
+ per_page: nil,
72
+ updated_since: nil,
73
+ country: nil,
74
+ exclude_country: nil)
63
75
  new_api_call_builder
64
76
  .request(new_request_builder(HttpMethodEnum::GET,
65
77
  '/locations/v1/ev',
@@ -76,25 +88,35 @@ module ShellEv
76
88
  .query_param(new_parameter(page_number, key: 'pageNumber'))
77
89
  .query_param(new_parameter(per_page, key: 'perPage'))
78
90
  .query_param(new_parameter(updated_since, key: 'updatedSince'))
91
+ .query_param(new_parameter(country, key: 'country'))
92
+ .query_param(new_parameter(exclude_country, key: 'excludeCountry'))
79
93
  .header_param(new_parameter('application/json', key: 'accept'))
80
94
  .auth(Single.new('BearerAuth')))
81
95
  .response(new_response_handler
82
- .deserializer(APIHelper.method(:custom_type_deserializer))
83
- .deserialize_into(LocationResponeObject.method(:from_hash))
84
- .is_response_array(true)
85
- .local_error('400',
86
- 'The server cannot or will not process the request due to'\
87
- ' something that is perceived to be a client error (e.g.,'\
88
- ' malformed request syntax, invalid request message framing, or'\
89
- ' deceptive request routing).',
90
- BadRequestException)
91
- .local_error('401',
92
- 'The request has not been applied because it lacks valid'\
93
- ' authentication credentials for the target resource.',
94
- UnauthorizedException)
95
- .local_error('404',
96
- 'Location Not Found',
97
- NotFoundException))
96
+ .deserializer(APIHelper.method(:custom_type_deserializer))
97
+ .deserialize_into(Response.method(:from_hash))
98
+ .local_error('400',
99
+ 'The server cannot or will not process the request due to'\
100
+ ' something that is perceived to be a client error (e.g.,'\
101
+ ' malformed request syntax, invalid request message framing, or'\
102
+ ' deceptive request routing).',
103
+ BadRequestException)
104
+ .local_error('401',
105
+ 'The request has not been applied because it lacks valid'\
106
+ ' authentication credentials for the target resource.',
107
+ UnauthorizedException)
108
+ .local_error('404',
109
+ 'Location Not Found',
110
+ NotFoundException)
111
+ .local_error('429',
112
+ 'The Request reached maximum allocated rate limit',
113
+ TooManyRequestsException)
114
+ .local_error('500',
115
+ 'Internal Server error',
116
+ InternalServerErrorException)
117
+ .local_error('503',
118
+ 'Service unavailable',
119
+ ServiceunavailableException))
98
120
  .execute
99
121
  end
100
122
 
@@ -102,14 +124,24 @@ module ShellEv
102
124
  # The query for a single location is to be made using the Unique Internal
103
125
  # identifier used to refer to this Location by Shell Recharge. (Uid from
104
126
  # List of locations API)
105
- # @param [String] request_id Required parameter: A unique request id in GUID
106
- # format. The value is written to the Shell API Platform audit log for end
107
- # to end traceability of a request.
127
+ # @param [UUID | String] request_id Required parameter: RequestId must be
128
+ # unique identifier value that can be used by the consumer to correlate each
129
+ # request /response .<br>Format.<br> Its canonical textual representation,
130
+ # the 16 octets of a UUID are represented as 32 hexadecimal (base-16)
131
+ # digits, displayed in five groups separated by hyphens, in the form
132
+ # 8-4-4-4-12 for a total of 36 characters (32 hexadecimal characters and 4
133
+ # hyphens) <br>
108
134
  # @param [String] id Required parameter: Unique Uid of the location from
109
135
  # List of locations API
110
- # @return [LocationResponeObject] response from the API call
111
- def get_location_by_id(request_id,
112
- id)
136
+ # @param [String] provider_id Optional parameter: The provider id that you
137
+ # wish to see locations and tariffs for
138
+ # @param [String] since Optional parameter: to get the locations modified
139
+ # after a date
140
+ # @return [Response] response from the API call
141
+ def ev_locations_by_id(request_id,
142
+ id,
143
+ provider_id: nil,
144
+ since: nil)
113
145
  new_api_call_builder
114
146
  .request(new_request_builder(HttpMethodEnum::GET,
115
147
  '/locations/v1/ev/{id}',
@@ -117,29 +149,40 @@ module ShellEv
117
149
  .header_param(new_parameter(request_id, key: 'RequestId'))
118
150
  .template_param(new_parameter(id, key: 'id')
119
151
  .should_encode(true))
152
+ .query_param(new_parameter(provider_id, key: 'providerId'))
153
+ .query_param(new_parameter(since, key: 'since'))
120
154
  .header_param(new_parameter('application/json', key: 'accept'))
121
155
  .auth(Single.new('BearerAuth')))
122
156
  .response(new_response_handler
123
- .deserializer(APIHelper.method(:custom_type_deserializer))
124
- .deserialize_into(LocationResponeObject.method(:from_hash))
125
- .local_error('400',
126
- 'The server cannot or will not process the request due to'\
127
- ' something that is perceived to be a client error (e.g.,'\
128
- ' malformed request syntax, invalid request message framing, or'\
129
- ' deceptive request routing).',
130
- BadRequestException)
131
- .local_error('401',
132
- 'The request has not been applied because it lacks valid'\
133
- ' authentication credentials for the target resource.',
134
- UnauthorizedException)
135
- .local_error('404',
136
- 'Location Not Found',
137
- NotFoundException))
157
+ .deserializer(APIHelper.method(:custom_type_deserializer))
158
+ .deserialize_into(Response.method(:from_hash))
159
+ .local_error('400',
160
+ 'The server cannot or will not process the request due to'\
161
+ ' something that is perceived to be a client error (e.g.,'\
162
+ ' malformed request syntax, invalid request message framing, or'\
163
+ ' deceptive request routing).',
164
+ BadRequestException)
165
+ .local_error('401',
166
+ 'The request has not been applied because it lacks valid'\
167
+ ' authentication credentials for the target resource.',
168
+ UnauthorizedException)
169
+ .local_error('404',
170
+ 'Location Not Found',
171
+ NotFoundException)
172
+ .local_error('429',
173
+ 'The Request reached maximum allocated rate limit',
174
+ TooManyRequestsException)
175
+ .local_error('500',
176
+ 'Internal Server error',
177
+ InternalServerErrorException)
178
+ .local_error('503',
179
+ 'Service unavailable',
180
+ ServiceunavailableException))
138
181
  .execute
139
182
  end
140
183
 
141
- # This API provides the list of all near by Shell Recharge locations based
142
- # on the latitude and longitude provided in the request.
184
+ # This API provides the list of all nearby Shell Recharge locations based on
185
+ # the latitude and longitude provided in the request.
143
186
  # The list includes all Shell Recharge network and all sites available
144
187
  # through our roaming partners.
145
188
  # The end point provides the details such as the exact location/address of
@@ -150,9 +193,13 @@ module ShellEv
150
193
  # * Based on status of the Charging units. Eg : Available or Occupied
151
194
  # * Based on available connector types.
152
195
  # * Based on minimum Power output (in kW) available
153
- # @param [String] request_id Required parameter: A unique request id in GUID
154
- # format. The value is written to the Shell API Platform audit log for end
155
- # to end traceability of a request.
196
+ # @param [UUID | String] request_id Required parameter: RequestId must be
197
+ # unique identifier value that can be used by the consumer to correlate each
198
+ # request /response .<br>Format.<br> Its canonical textual representation,
199
+ # the 16 octets of a UUID are represented as 32 hexadecimal (base-16)
200
+ # digits, displayed in five groups separated by hyphens, in the form
201
+ # 8-4-4-4-12 for a total of 36 characters (32 hexadecimal characters and 4
202
+ # hyphens) <br>
156
203
  # @param [Float] latitude Required parameter: Latitude to get Shell Recharge
157
204
  # Locations nearby
158
205
  # @param [Float] longitude Required parameter: Longitude to get Shell
@@ -169,37 +216,45 @@ module ShellEv
169
216
  # given by the Operator, unique for that Operator
170
217
  # @param [String] operator_name Optional parameter: Filter by Locations that
171
218
  # have the given operator
172
- # @param [GetNearbyLocationsEvseStatusEnum] evse_status Optional parameter:
219
+ # @param [NearbyLocationsEvseStatusEnum] evse_status Optional parameter:
173
220
  # Filter by Locations that have the given status
174
- # @param [GetNearbyLocationsConnectorTypesEnum] connector_types Optional
221
+ # @param [NearbyLocationsConnectorTypesEnum] connector_types Optional
175
222
  # parameter: Filter by Locations that have Connectors with these Connector
176
223
  # Types
177
224
  # @param [Float] connector_min_power Optional parameter: Filter by Locations
178
225
  # that have a Connector with at least this power output (in kW)
179
- # @param [GetNearbyLocationsAuthorizationMethodsEnum] authorization_methods
226
+ # @param [NearbyLocationsAuthorizationMethodsEnum] authorization_methods
180
227
  # Optional parameter: Filter by Locations that support the given
181
228
  # Authorization Methods
182
229
  # @param [TrueClass | FalseClass] with_operator_name Optional parameter:
183
- # Return operator name in marker object (only for marker type
184
- # SingleChargePoint)
230
+ # Return operator name in marker object (only for marker type Single
231
+ # ChargePoint)
185
232
  # @param [TrueClass | FalseClass] with_max_power Optional parameter: Return
186
233
  # maximum power in kW across all locations grouped in this marker
187
234
  # (disregarding availability)
188
- # @return [LocationResponeObject] response from the API call
189
- def get_nearby_locations(request_id,
190
- latitude,
191
- longitude,
192
- limit: 25,
193
- location_external_id: nil,
194
- evse_id: nil,
195
- evse_external_id: nil,
196
- operator_name: nil,
197
- evse_status: nil,
198
- connector_types: nil,
199
- connector_min_power: nil,
200
- authorization_methods: nil,
201
- with_operator_name: nil,
202
- with_max_power: nil)
235
+ # @param [Array[String]] country Optional parameter: Filter by Locations
236
+ # that are at least in one of the given countries (specified using ISO
237
+ # 3166-1 alpha-3 codes)
238
+ # @param [Array[String]] exclude_country Optional parameter: Filter by
239
+ # Locations that are not in one of the given countries (specified using ISO
240
+ # 3166-1 alpha-3 codes)
241
+ # @return [Response] response from the API call
242
+ def nearby_locations(request_id,
243
+ latitude,
244
+ longitude,
245
+ limit: 25,
246
+ location_external_id: nil,
247
+ evse_id: nil,
248
+ evse_external_id: nil,
249
+ operator_name: nil,
250
+ evse_status: nil,
251
+ connector_types: nil,
252
+ connector_min_power: nil,
253
+ authorization_methods: nil,
254
+ with_operator_name: nil,
255
+ with_max_power: nil,
256
+ country: nil,
257
+ exclude_country: nil)
203
258
  new_api_call_builder
204
259
  .request(new_request_builder(HttpMethodEnum::GET,
205
260
  '/locations/v1/ev/nearby',
@@ -218,24 +273,35 @@ module ShellEv
218
273
  .query_param(new_parameter(authorization_methods, key: 'authorizationMethods'))
219
274
  .query_param(new_parameter(with_operator_name, key: 'withOperatorName'))
220
275
  .query_param(new_parameter(with_max_power, key: 'withMaxPower'))
276
+ .query_param(new_parameter(country, key: 'country'))
277
+ .query_param(new_parameter(exclude_country, key: 'excludeCountry'))
221
278
  .header_param(new_parameter('application/json', key: 'accept'))
222
279
  .auth(Single.new('BearerAuth')))
223
280
  .response(new_response_handler
224
- .deserializer(APIHelper.method(:custom_type_deserializer))
225
- .deserialize_into(LocationResponeObject.method(:from_hash))
226
- .local_error('400',
227
- 'The server cannot or will not process the request due to'\
228
- ' something that is perceived to be a client error (e.g.,'\
229
- ' malformed request syntax, invalid request message framing, or'\
230
- ' deceptive request routing).',
231
- BadRequestException)
232
- .local_error('401',
233
- 'The request has not been applied because it lacks valid'\
234
- ' authentication credentials for the target resource.',
235
- UnauthorizedException)
236
- .local_error('404',
237
- 'Location Not Found',
238
- NotFoundException))
281
+ .deserializer(APIHelper.method(:custom_type_deserializer))
282
+ .deserialize_into(Response.method(:from_hash))
283
+ .local_error('400',
284
+ 'The server cannot or will not process the request due to'\
285
+ ' something that is perceived to be a client error (e.g.,'\
286
+ ' malformed request syntax, invalid request message framing, or'\
287
+ ' deceptive request routing).',
288
+ BadRequestException)
289
+ .local_error('401',
290
+ 'The request has not been applied because it lacks valid'\
291
+ ' authentication credentials for the target resource.',
292
+ UnauthorizedException)
293
+ .local_error('404',
294
+ 'Location Not Found',
295
+ NotFoundException)
296
+ .local_error('429',
297
+ 'The Request reached maximum allocated rate limit',
298
+ TooManyRequestsException)
299
+ .local_error('500',
300
+ 'Internal Server error',
301
+ InternalServerErrorException)
302
+ .local_error('503',
303
+ 'Service unavailable',
304
+ ServiceunavailableException))
239
305
  .execute
240
306
  end
241
307
 
@@ -247,9 +313,13 @@ module ShellEv
247
313
  # * Based on status of the Charging units. Eg : Available or Occupied
248
314
  # * Based on available connector types.
249
315
  # * Based on minimum Power output (in kW) available
250
- # @param [String] request_id Required parameter: A unique request id in GUID
251
- # format. The value is written to the Shell API Platform audit log for end
252
- # to end traceability of a request.
316
+ # @param [UUID | String] request_id Required parameter: RequestId must be
317
+ # unique identifier value that can be used by the consumer to correlate each
318
+ # request /response .<br>Format.<br> Its canonical textual representation,
319
+ # the 16 octets of a UUID are represented as 32 hexadecimal (base-16)
320
+ # digits, displayed in five groups separated by hyphens, in the form
321
+ # 8-4-4-4-12 for a total of 36 characters (32 hexadecimal characters and 4
322
+ # hyphens) <br>
253
323
  # @param [Float] west Required parameter: Longitude of the western bound to
254
324
  # get the Shell Recharge Locations
255
325
  # @param [Float] south Required parameter: Latitude of the southern bound to
@@ -260,14 +330,14 @@ module ShellEv
260
330
  # get the Shell Recharge Locations
261
331
  # @param [String] zoom Required parameter: Zoom level to show ex: (1: World,
262
332
  # 5: Landmass/continent, 10: City, 15: Streets, 20: Buildings)
263
- # @param [GetMarkersListEvseStatusEnum] evse_status Optional parameter:
333
+ # @param [LocationsMarkersEvseStatusEnum] evse_status Optional parameter:
264
334
  # Filter by Locations that have the given status
265
- # @param [GetMarkersListConnectorTypesEnum] connector_types Optional
335
+ # @param [LocationsMarkersConnectorTypesEnum] connector_types Optional
266
336
  # parameter: Filter by Locations that have Connectors with the set of
267
337
  # Connector Types
268
338
  # @param [Float] connector_min_power Optional parameter: Filter by Locations
269
339
  # that have a Connector with at least this power output (in kW)
270
- # @param [GetMarkersListAuthorizationMethodsEnum] authorization_methods
340
+ # @param [LocationsMarkersAuthorizationMethodsEnum] authorization_methods
271
341
  # Optional parameter: Filter by Locations that support the given
272
342
  # Authorization Methods
273
343
  # @param [TrueClass | FalseClass] with_operator_name Optional parameter:
@@ -286,23 +356,31 @@ module ShellEv
286
356
  # given by the Operator, unique for that Operator
287
357
  # @param [String] operator_name Optional parameter: Filter by Locations that
288
358
  # have the given operator
289
- # @return [Array[SingleLocationMarker | MultiLocationMarker]] response from the API call
290
- def get_markers_list(request_id,
291
- west,
292
- south,
293
- east,
294
- north,
295
- zoom,
296
- evse_status: nil,
297
- connector_types: nil,
298
- connector_min_power: nil,
299
- authorization_methods: nil,
300
- with_operator_name: nil,
301
- with_max_power: nil,
302
- location_external_id: nil,
303
- evse_id: nil,
304
- evse_external_id: nil,
305
- operator_name: nil)
359
+ # @param [Array[String]] country Optional parameter: Filter by Locations
360
+ # that are at least in one of the given countries (specified using ISO
361
+ # 3166-1 alpha-3 codes)
362
+ # @param [Array[String]] exclude_country Optional parameter: Filter by
363
+ # Locations that are not in one of the given countries (specified using ISO
364
+ # 3166-1 alpha-3 codes)
365
+ # @return [SingleLocationMarkerResponse] response from the API call
366
+ def locations_markers(request_id,
367
+ west,
368
+ south,
369
+ east,
370
+ north,
371
+ zoom,
372
+ evse_status: nil,
373
+ connector_types: nil,
374
+ connector_min_power: nil,
375
+ authorization_methods: nil,
376
+ with_operator_name: nil,
377
+ with_max_power: nil,
378
+ location_external_id: nil,
379
+ evse_id: nil,
380
+ evse_external_id: nil,
381
+ operator_name: nil,
382
+ country: nil,
383
+ exclude_country: nil)
306
384
  new_api_call_builder
307
385
  .request(new_request_builder(HttpMethodEnum::GET,
308
386
  '/locations/v1/ev/markers',
@@ -323,29 +401,35 @@ module ShellEv
323
401
  .query_param(new_parameter(evse_id, key: 'evseId'))
324
402
  .query_param(new_parameter(evse_external_id, key: 'evseExternalId'))
325
403
  .query_param(new_parameter(operator_name, key: 'operatorName'))
404
+ .query_param(new_parameter(country, key: 'country'))
405
+ .query_param(new_parameter(exclude_country, key: 'excludeCountry'))
326
406
  .header_param(new_parameter('application/json', key: 'accept'))
327
407
  .auth(Single.new('BearerAuth')))
328
408
  .response(new_response_handler
329
- .deserializer(proc do |response, should_symbolize|
330
- APIHelper.deserialize_union_type(
331
- UnionTypeLookUp.get(:MarkersResponse),
332
- response, should_symbolize, true
333
- )
334
- end)
335
- .is_response_array(true)
336
- .local_error('400',
337
- 'The server cannot or will not process the request due to'\
338
- ' something that is perceived to be a client error (e.g.,'\
339
- ' malformed request syntax, invalid request message framing, or'\
340
- ' deceptive request routing).',
341
- BadRequestException)
342
- .local_error('401',
343
- 'The request has not been applied because it lacks valid'\
344
- ' authentication credentials for the target resource.',
345
- UnauthorizedException)
346
- .local_error('404',
347
- 'Location Not Found',
348
- NotFoundException))
409
+ .deserializer(APIHelper.method(:custom_type_deserializer))
410
+ .deserialize_into(SingleLocationMarkerResponse.method(:from_hash))
411
+ .local_error('400',
412
+ 'The server cannot or will not process the request due to'\
413
+ ' something that is perceived to be a client error (e.g.,'\
414
+ ' malformed request syntax, invalid request message framing, or'\
415
+ ' deceptive request routing).',
416
+ BadRequestException)
417
+ .local_error('401',
418
+ 'The request has not been applied because it lacks valid'\
419
+ ' authentication credentials for the target resource.',
420
+ UnauthorizedException)
421
+ .local_error('404',
422
+ 'Location Not Found',
423
+ NotFoundException)
424
+ .local_error('429',
425
+ 'The Request reached maximum allocated rate limit',
426
+ TooManyRequestsException)
427
+ .local_error('500',
428
+ 'Internal server error',
429
+ InternalServerErrorException)
430
+ .local_error('503',
431
+ 'Service unavailable',
432
+ ServiceunavailableException))
349
433
  .execute
350
434
  end
351
435
  end
@@ -28,14 +28,14 @@ module ShellEv
28
28
  .header_param(new_parameter('application/json', key: 'accept'))
29
29
  .additional_form_params(_field_parameters))
30
30
  .response(new_response_handler
31
- .deserializer(APIHelper.method(:custom_type_deserializer))
32
- .deserialize_into(OAuthToken.method(:from_hash))
33
- .local_error('400',
34
- 'OAuth 2 provider returned an error.',
35
- OAuthProviderException)
36
- .local_error('401',
37
- 'OAuth 2 provider says client authentication failed.',
38
- OAuthProviderException))
31
+ .deserializer(APIHelper.method(:custom_type_deserializer))
32
+ .deserialize_into(OAuthToken.method(:from_hash))
33
+ .local_error('400',
34
+ 'OAuth 2 provider returned an error.',
35
+ OAuthProviderException)
36
+ .local_error('401',
37
+ 'OAuth 2 provider says client authentication failed.',
38
+ OAuthProviderException))
39
39
  .execute
40
40
  end
41
41
  end
@@ -9,29 +9,44 @@ module ShellEv
9
9
  SKIP = Object.new
10
10
  private_constant :SKIP
11
11
 
12
- # Error code
12
+ # requestId is unique identifier value that is attached to requests and
13
+ # messages that allow reference to a particular transaction or event chain.
13
14
  # @return [String]
14
- attr_accessor :code
15
+ attr_accessor :request_id
15
16
 
16
- # Error desctiption in English
17
+ # Status of the request
17
18
  # @return [String]
18
- attr_accessor :message
19
+ attr_accessor :status
19
20
 
20
- # The constructor.
21
- # @param [String] The reason for raising an exception.
22
- # @param [HttpResponse] The HttpReponse of the API call.
23
- def initialize(reason, response)
24
- super(reason, response)
25
- hash = APIHelper.json_deserialize(@response.raw_body)
26
- unbox(hash)
27
- end
21
+ # Exception details of the error
22
+ # @return [Array[BadRequestErrMsg]]
23
+ attr_accessor :errors
24
+
25
+ # The constructor.
26
+ # @param [String] The reason for raising an exception.
27
+ # @param [HttpResponse] The HttpReponse of the API call.
28
+ def initialize(reason, response)
29
+ super(reason, response)
30
+ hash = APIHelper.json_deserialize(@response.raw_body)
31
+ unbox(hash)
32
+ end
33
+
34
+ # Populates this object by extracting properties from a hash.
35
+ # @param [Hash] The deserialized response sent by the server in the
36
+ # response body.
37
+ def unbox(hash)
38
+ @request_id = hash.key?('requestId') ? hash['requestId'] : SKIP
39
+ @status = hash.key?('status') ? hash['status'] : SKIP
40
+ # Parameter is an array, so we need to iterate through it
41
+ @errors = nil
42
+ unless hash['errors'].nil?
43
+ @errors = []
44
+ hash['errors'].each do |structure|
45
+ @errors << (BadRequestErrMsg.from_hash(structure) if structure)
46
+ end
47
+ end
28
48
 
29
- # Populates this object by extracting properties from a hash.
30
- # @param [Hash] The deserialized response sent by the server in the
31
- # response body.
32
- def unbox(hash)
33
- @code = hash.key?('code') ? hash['code'] : SKIP
34
- @message = hash.key?('message') ? hash['message'] : SKIP
49
+ @errors = SKIP unless hash.key?('errors')
35
50
  end
36
51
  end
37
52
  end