Class: ShellEv::LocationsController

Inherits:
BaseController show all
Defined in:
lib/shell_ev/controllers/locations_controller.rb

Overview

LocationsController

Constant Summary

Constants inherited from BaseController

BaseController::GLOBAL_ERRORS

Instance Attribute Summary

Attributes inherited from BaseController

#config, #http_call_back

Instance Method Summary collapse

Methods inherited from BaseController

#initialize, #new_api_call_builder, #new_parameter, #new_request_builder, #new_response_handler, user_agent

Constructor Details

This class inherits a constructor from ShellEv::BaseController

Instance Method Details

#get_location_by_id(request_id, id) ⇒ LocationResponeObject

This API provides the details on a single Shell Recharge location. The query for a single location is to be made using the Unique Internal identifier used to refer to this Location by Shell Recharge. (Uid from List of locations API) format. The value is written to the Shell API Platform audit log for end to end traceability of a request. List of locations API

Parameters:

  • request_id (String)

    Required parameter: A unique request id in GUID

  • id (String)

    Required parameter: Unique Uid of the location from

Returns:



111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/shell_ev/controllers/locations_controller.rb', line 111

def get_location_by_id(request_id,
                       id)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/locations/v1/ev/{id}',
                                 Server::DEFAULT)
               .header_param(new_parameter(request_id, key: 'RequestId'))
               .template_param(new_parameter(id, key: 'id')
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('BearerAuth')))
    .response(new_response_handler
               .deserializer(APIHelper.method(:custom_type_deserializer))
               .deserialize_into(LocationResponeObject.method(:from_hash))
               .local_error('400',
                            'The server cannot or will not process the request due to'\
                             ' something that is perceived to be a client error (e.g.,'\
                             ' malformed request syntax, invalid request message framing, or'\
                             ' deceptive request routing).',
                            BadRequestException)
               .local_error('401',
                            'The request has not been applied because it lacks valid'\
                             ' authentication credentials for the target resource.',
                            UnauthorizedException)
               .local_error('404',
                            'Location Not Found',
                            NotFoundException))
    .execute
end

#get_locations_list(request_id, evse_status: nil, connector_types: nil, connector_min_power: nil, authorization_methods: nil, with_operator_name: nil, evse_id: nil, location_external_id: nil, evse_external_id: nil, page_number: nil, per_page: nil, updated_since: nil) ⇒ Array[LocationResponeObject]

This API provides the list of all Shell Recharge locations. The list includes all Shell Recharge network and all locations available through our roaming partners.The end point provides flexible search criteria in order to get the list of Shell Recharge Network. The end point provides the details such as the exact location/address of the site along with the up-to-date status information of all the charging units in the site. Supported Search Options

  • Based on status of the Charging units. Eg : Available or Occupied

  • Based on available connector types.

  • Based on minimum Power output (in kW) available

  • Based on a specific charging unit ID (EVSE ID)

format. The value is written to the Shell API Platform audit log for end to end traceability of a request. Filter by Locations that have the given status parameter: Filter by Locations that have Connectors with the set of Connector Types that have a Connector with at least this power output (in kW) Optional parameter: Filter by Locations that support the given Authorization Methods Return operator name in marker response object (Electric Vehicle Supply Equipment) Id identifier (ISO-IEC-15118) Locations with the given externalId. (Unique Location externalID provided by Shell Recharge) that have an Evse with the given External Id. (Unique individual EVSE externalID provided by Shell Recharge) list by providing a specific set of page Number. Set perPage parameter also when pageNumber is used. in reposne per page. string

Parameters:

  • request_id (String)

    Required parameter: A unique request id in GUID

  • evse_status (GetLocationsListEvseStatusEnum) (defaults to: nil)

    Optional parameter:

  • connector_types (GetLocationsListConnectorTypesEnum) (defaults to: nil)

    Optional

  • connector_min_power (Float) (defaults to: nil)

    Optional parameter: Filter by Locations

  • authorization_methods (GetLocationsListAuthorizationMethodsEnum) (defaults to: nil)
  • with_operator_name (TrueClass | FalseClass) (defaults to: nil)

    Optional parameter:

  • evse_id (String) (defaults to: nil)

    Optional parameter: optional Standard EVSE

  • location_external_id (String) (defaults to: nil)

    Optional parameter: Filter by

  • evse_external_id (String) (defaults to: nil)

    Optional parameter: Filter by Locations

  • page_number (Integer) (defaults to: nil)

    Optional parameter: Restrict the response

  • per_page (Integer) (defaults to: nil)

    Optional parameter: Restrict the number of sites

  • updated_since (String) (defaults to: nil)

    Optional parameter: ZonedDateTime as

Returns:



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/shell_ev/controllers/locations_controller.rb', line 51

def get_locations_list(request_id,
                       evse_status: nil,
                       connector_types: nil,
                       connector_min_power: nil,
                       authorization_methods: nil,
                       with_operator_name: nil,
                       evse_id: nil,
                       location_external_id: nil,
                       evse_external_id: nil,
                       page_number: nil,
                       per_page: nil,
                       updated_since: nil)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/locations/v1/ev',
                                 Server::DEFAULT)
               .header_param(new_parameter(request_id, key: 'RequestId'))
               .query_param(new_parameter(evse_status, key: 'evseStatus'))
               .query_param(new_parameter(connector_types, key: 'connectorTypes'))
               .query_param(new_parameter(connector_min_power, key: 'connectorMinPower'))
               .query_param(new_parameter(authorization_methods, key: 'authorizationMethods'))
               .query_param(new_parameter(with_operator_name, key: 'withOperatorName'))
               .query_param(new_parameter(evse_id, key: 'evseId'))
               .query_param(new_parameter(location_external_id, key: 'locationExternalId'))
               .query_param(new_parameter(evse_external_id, key: 'evseExternalId'))
               .query_param(new_parameter(page_number, key: 'pageNumber'))
               .query_param(new_parameter(per_page, key: 'perPage'))
               .query_param(new_parameter(updated_since, key: 'updatedSince'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('BearerAuth')))
    .response(new_response_handler
               .deserializer(APIHelper.method(:custom_type_deserializer))
               .deserialize_into(LocationResponeObject.method(:from_hash))
               .is_response_array(true)
               .local_error('400',
                            'The server cannot or will not process the request due to'\
                             ' something that is perceived to be a client error (e.g.,'\
                             ' malformed request syntax, invalid request message framing, or'\
                             ' deceptive request routing).',
                            BadRequestException)
               .local_error('401',
                            'The request has not been applied because it lacks valid'\
                             ' authentication credentials for the target resource.',
                            UnauthorizedException)
               .local_error('404',
                            'Location Not Found',
                            NotFoundException))
    .execute
end

#get_markers_list(request_id, west, south, east, north, zoom, evse_status: nil, connector_types: nil, connector_min_power: nil, authorization_methods: nil, with_operator_name: nil, with_max_power: nil, location_external_id: nil, evse_id: nil, evse_external_id: nil, operator_name: nil) ⇒ Array[SingleLocationMarker | MultiLocationMarker]

This API, when given a set of bounds on the geographical front (East,West, North, South) will return a set of Markers that fall within the requested bounds. The API will automatically group locations at the same position on the map into one Marker. The API also provide further search options to filter the result set.

* Based on status of the Charging units. Eg : Available or Occupied
* Based on available connector types.
* Based on minimum Power output (in kW) available

format. The value is written to the Shell API Platform audit log for end to end traceability of a request. get the Shell Recharge Locations get the Shell Recharge Locations get the Shell Recharge Locations get the Shell Recharge Locations 5: Landmass/continent, 10: City, 15: Streets, 20: Buildings) Filter by Locations that have the given status parameter: Filter by Locations that have Connectors with the set of Connector Types that have a Connector with at least this power output (in kW) Optional parameter: Filter by Locations that support the given Authorization Methods Return operator name in marker object (only for marker type SingleChargePoint) maximum power in kW across all locations grouped in this marker (disregarding availability) Locations with the given externalId. (Unique Location externalID provided by Shell Recharge) an Evse with the given Evse Id that have an Evse with the given External Id Identifier of the Evse as given by the Operator, unique for that Operator have the given operator

Parameters:

  • request_id (String)

    Required parameter: A unique request id in GUID

  • west (Float)

    Required parameter: Longitude of the western bound to

  • south (Float)

    Required parameter: Latitude of the southern bound to

  • east (Float)

    Required parameter: Longitude of the eastern bound to

  • north (Float)

    Required parameter: Latitude of the northern bound to

  • zoom (String)

    Required parameter: Zoom level to show ex: (1: World,

  • evse_status (GetMarkersListEvseStatusEnum) (defaults to: nil)

    Optional parameter:

  • connector_types (GetMarkersListConnectorTypesEnum) (defaults to: nil)

    Optional

  • connector_min_power (Float) (defaults to: nil)

    Optional parameter: Filter by Locations

  • authorization_methods (GetMarkersListAuthorizationMethodsEnum) (defaults to: nil)
  • with_operator_name (TrueClass | FalseClass) (defaults to: nil)

    Optional parameter:

  • with_max_power (TrueClass | FalseClass) (defaults to: nil)

    Optional parameter: Return

  • location_external_id (String) (defaults to: nil)

    Optional parameter: Filter by

  • evse_id (String) (defaults to: nil)

    Optional parameter: Filter by Locations that have

  • evse_external_id (String) (defaults to: nil)

    Optional parameter: Filter by Locations

  • operator_name (String) (defaults to: nil)

    Optional parameter: Filter by Locations that

Returns:



290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
# File 'lib/shell_ev/controllers/locations_controller.rb', line 290

def get_markers_list(request_id,
                     west,
                     south,
                     east,
                     north,
                     zoom,
                     evse_status: nil,
                     connector_types: nil,
                     connector_min_power: nil,
                     authorization_methods: nil,
                     with_operator_name: nil,
                     with_max_power: nil,
                     location_external_id: nil,
                     evse_id: nil,
                     evse_external_id: nil,
                     operator_name: nil)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/locations/v1/ev/markers',
                                 Server::DEFAULT)
               .header_param(new_parameter(request_id, key: 'RequestId'))
               .query_param(new_parameter(west, key: 'west'))
               .query_param(new_parameter(south, key: 'south'))
               .query_param(new_parameter(east, key: 'east'))
               .query_param(new_parameter(north, key: 'north'))
               .query_param(new_parameter(zoom, key: 'zoom'))
               .query_param(new_parameter(evse_status, key: 'evseStatus'))
               .query_param(new_parameter(connector_types, key: 'connectorTypes'))
               .query_param(new_parameter(connector_min_power, key: 'connectorMinPower'))
               .query_param(new_parameter(authorization_methods, key: 'authorizationMethods'))
               .query_param(new_parameter(with_operator_name, key: 'withOperatorName'))
               .query_param(new_parameter(with_max_power, key: 'withMaxPower'))
               .query_param(new_parameter(location_external_id, key: 'locationExternalId'))
               .query_param(new_parameter(evse_id, key: 'evseId'))
               .query_param(new_parameter(evse_external_id, key: 'evseExternalId'))
               .query_param(new_parameter(operator_name, key: 'operatorName'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('BearerAuth')))
    .response(new_response_handler
               .deserializer(proc do |response, should_symbolize|
                 APIHelper.deserialize_union_type(
                   UnionTypeLookUp.get(:MarkersResponse),
                   response, should_symbolize, true
                 )
               end)
               .is_response_array(true)
               .local_error('400',
                            'The server cannot or will not process the request due to'\
                             ' something that is perceived to be a client error (e.g.,'\
                             ' malformed request syntax, invalid request message framing, or'\
                             ' deceptive request routing).',
                            BadRequestException)
               .local_error('401',
                            'The request has not been applied because it lacks valid'\
                             ' authentication credentials for the target resource.',
                            UnauthorizedException)
               .local_error('404',
                            'Location Not Found',
                            NotFoundException))
    .execute
end

#get_nearby_locations(request_id, latitude, longitude, limit: 25, location_external_id: nil, evse_id: nil, evse_external_id: nil, operator_name: nil, evse_status: nil, connector_types: nil, connector_min_power: nil, authorization_methods: nil, with_operator_name: nil, with_max_power: nil) ⇒ LocationResponeObject

This API provides the list of all near by Shell Recharge locations based on the latitude and longitude provided in the request. The list includes all Shell Recharge network and all sites available through our roaming partners. The end point provides the details such as the exact location/address of the site along with the up-to-date status information of all the charging units in the site. Supported Search Options

  • Based on latitude and longitude of the location. (Mandatory)

  • Based on status of the Charging units. Eg : Available or Occupied

  • Based on available connector types.

  • Based on minimum Power output (in kW) available

format. The value is written to the Shell API Platform audit log for end to end traceability of a request. Locations nearby Recharge Locations nearby retrieve Locations with the given externalId Identifier as given by the Shell Recharge Operator, unique for that Operator an Evse with the given Evse Id that have an Evse with the given External Id Identifier of the Evse as given by the Operator, unique for that Operator have the given operator Filter by Locations that have the given status parameter: Filter by Locations that have Connectors with these Connector Types that have a Connector with at least this power output (in kW) Optional parameter: Filter by Locations that support the given Authorization Methods Return operator name in marker object (only for marker type SingleChargePoint) maximum power in kW across all locations grouped in this marker (disregarding availability)

Parameters:

  • request_id (String)

    Required parameter: A unique request id in GUID

  • latitude (Float)

    Required parameter: Latitude to get Shell Recharge

  • longitude (Float)

    Required parameter: Longitude to get Shell

  • limit (Float) (defaults to: 25)

    Optional parameter: Maximum number of Locations to

  • location_external_id (String) (defaults to: nil)

    Optional parameter: Filter by

  • evse_id (String) (defaults to: nil)

    Optional parameter: Filter by Locations that have

  • evse_external_id (String) (defaults to: nil)

    Optional parameter: Filter by Locations

  • operator_name (String) (defaults to: nil)

    Optional parameter: Filter by Locations that

  • evse_status (GetNearbyLocationsEvseStatusEnum) (defaults to: nil)

    Optional parameter:

  • connector_types (GetNearbyLocationsConnectorTypesEnum) (defaults to: nil)

    Optional

  • connector_min_power (Float) (defaults to: nil)

    Optional parameter: Filter by Locations

  • authorization_methods (GetNearbyLocationsAuthorizationMethodsEnum) (defaults to: nil)
  • with_operator_name (TrueClass | FalseClass) (defaults to: nil)

    Optional parameter:

  • with_max_power (TrueClass | FalseClass) (defaults to: nil)

    Optional parameter: Return

Returns:



189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
# File 'lib/shell_ev/controllers/locations_controller.rb', line 189

def get_nearby_locations(request_id,
                         latitude,
                         longitude,
                         limit: 25,
                         location_external_id: nil,
                         evse_id: nil,
                         evse_external_id: nil,
                         operator_name: nil,
                         evse_status: nil,
                         connector_types: nil,
                         connector_min_power: nil,
                         authorization_methods: nil,
                         with_operator_name: nil,
                         with_max_power: nil)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/locations/v1/ev/nearby',
                                 Server::DEFAULT)
               .header_param(new_parameter(request_id, key: 'RequestId'))
               .query_param(new_parameter(latitude, key: 'latitude'))
               .query_param(new_parameter(longitude, key: 'longitude'))
               .query_param(new_parameter(limit, key: 'limit'))
               .query_param(new_parameter(location_external_id, key: 'locationExternalId'))
               .query_param(new_parameter(evse_id, key: 'evseId'))
               .query_param(new_parameter(evse_external_id, key: 'evseExternalId'))
               .query_param(new_parameter(operator_name, key: 'operatorName'))
               .query_param(new_parameter(evse_status, key: 'evseStatus'))
               .query_param(new_parameter(connector_types, key: 'connectorTypes'))
               .query_param(new_parameter(connector_min_power, key: 'connectorMinPower'))
               .query_param(new_parameter(authorization_methods, key: 'authorizationMethods'))
               .query_param(new_parameter(with_operator_name, key: 'withOperatorName'))
               .query_param(new_parameter(with_max_power, key: 'withMaxPower'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('BearerAuth')))
    .response(new_response_handler
               .deserializer(APIHelper.method(:custom_type_deserializer))
               .deserialize_into(LocationResponeObject.method(:from_hash))
               .local_error('400',
                            'The server cannot or will not process the request due to'\
                             ' something that is perceived to be a client error (e.g.,'\
                             ' malformed request syntax, invalid request message framing, or'\
                             ' deceptive request routing).',
                            BadRequestException)
               .local_error('401',
                            'The request has not been applied because it lacks valid'\
                             ' authentication credentials for the target resource.',
                            UnauthorizedException)
               .local_error('404',
                            'Location Not Found',
                            NotFoundException))
    .execute
end