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.
- checksums.yaml +4 -4
- data/README.md +38 -21
- data/lib/shell_ev/client.rb +8 -8
- data/lib/shell_ev/configuration.rb +13 -17
- data/lib/shell_ev/controllers/base_controller.rb +9 -9
- data/lib/shell_ev/controllers/charging_controller.rb +121 -154
- data/lib/shell_ev/controllers/locations_controller.rb +226 -142
- data/lib/shell_ev/controllers/o_auth_authorization_controller.rb +8 -8
- data/lib/shell_ev/exceptions/bad_request_exception.rb +33 -18
- data/lib/shell_ev/exceptions/{m405_error_response_error1_exception.rb → internal_server_error_exception.rb} +31 -26
- data/lib/shell_ev/exceptions/not_found_exception.rb +36 -19
- data/lib/shell_ev/exceptions/o_auth_provider_exception.rb +15 -15
- data/lib/shell_ev/exceptions/{m400_error_response_error1_exception.rb → serviceunavailable_exception.rb} +28 -28
- data/lib/shell_ev/exceptions/{m401_error_response_error1_exception.rb → too_many_requests_exception.rb} +28 -28
- data/lib/shell_ev/exceptions/unauthorized_exception.rb +32 -18
- data/lib/shell_ev/http/auth/o_auth2.rb +54 -10
- data/lib/shell_ev/models/accessibility.rb +1 -2
- data/lib/shell_ev/models/active_response200_json.rb +11 -13
- data/lib/shell_ev/models/address.rb +1 -3
- data/lib/shell_ev/models/bad_request_err_msg.rb +82 -0
- data/lib/shell_ev/models/{stop_charge_session_request_body_json.rb → charge_error.rb} +21 -10
- data/lib/shell_ev/models/charge_retrieve_state.rb +63 -0
- data/lib/shell_ev/models/chargesession_start_body.rb +7 -9
- data/lib/shell_ev/models/connector_vo.rb +4 -9
- data/lib/shell_ev/models/coordinates.rb +1 -2
- data/lib/shell_ev/models/data_active.rb +27 -45
- data/lib/shell_ev/models/data_retrieve.rb +31 -49
- data/lib/shell_ev/models/electrical_properties.rb +1 -3
- data/lib/shell_ev/models/evse_vo.rb +3 -8
- data/lib/shell_ev/models/get_charge_session_retrieve_response200_json.rb +11 -13
- data/lib/shell_ev/models/{get_markers_list_authorization_methods_enum.rb → get_ev_locations_authorization_methods_enum.rb} +4 -4
- data/lib/shell_ev/models/{get_markers_list_connector_types_enum.rb → get_ev_locations_connector_types_enum.rb} +4 -4
- data/lib/shell_ev/models/{get_markers_list_evse_status_enum.rb → get_ev_locations_evse_status_enum.rb} +4 -4
- data/lib/shell_ev/models/inline_response202.rb +9 -11
- data/lib/shell_ev/models/inline_response2021.rb +5 -6
- data/lib/shell_ev/models/inline_response202_data.rb +7 -5
- data/lib/shell_ev/models/internal_error_object.rb +70 -0
- data/lib/shell_ev/models/location_respone_object.rb +4 -11
- data/lib/shell_ev/models/{get_locations_list_authorization_methods_enum.rb → locations_markers_authorization_methods_enum.rb} +4 -4
- data/lib/shell_ev/models/{get_locations_list_connector_types_enum.rb → locations_markers_connector_types_enum.rb} +4 -4
- data/lib/shell_ev/models/{get_locations_list_evse_status_enum.rb → locations_markers_evse_status_enum.rb} +4 -4
- data/lib/shell_ev/models/multi_location_marker.rb +2 -6
- data/lib/shell_ev/models/{get_nearby_locations_authorization_methods_enum.rb → nearby_locations_authorization_methods_enum.rb} +4 -4
- data/lib/shell_ev/models/{get_nearby_locations_connector_types_enum.rb → nearby_locations_connector_types_enum.rb} +4 -4
- data/lib/shell_ev/models/{get_nearby_locations_evse_status_enum.rb → nearby_locations_evse_status_enum.rb} +4 -4
- data/lib/shell_ev/models/not_found_err_msg.rb +82 -0
- data/lib/shell_ev/models/o_auth_token.rb +2 -6
- data/lib/shell_ev/models/opening_hours_object.rb +1 -3
- data/lib/shell_ev/models/ratelimit_err_msg.rb +82 -0
- data/lib/shell_ev/models/response.rb +78 -0
- data/lib/shell_ev/models/serviceunavailable_err_msg.rb +82 -0
- data/lib/shell_ev/models/single_location_marker.rb +5 -11
- data/lib/shell_ev/models/single_location_marker_authorization_methods_items_enum.rb +1 -1
- data/lib/shell_ev/models/single_location_marker_response.rb +81 -0
- data/lib/shell_ev/models/tariff_vo.rb +3 -7
- data/lib/shell_ev/models/unauthorized_err_msg.rb +82 -0
- data/lib/shell_ev/utilities/file_wrapper.rb +9 -9
- data/lib/shell_ev/utilities/union_type_lookup.rb +3 -2
- data/lib/shell_ev.rb +40 -60
- data/test/controllers/controller_test_base.rb +0 -5
- data/test/controllers/test_charging_controller.rb +74 -17
- data/test/controllers/test_locations_controller.rb +65 -0
- metadata +31 -49
- data/lib/shell_ev/exceptions/http401_error_response_exception.rb +0 -52
- data/lib/shell_ev/exceptions/m404_error_response_error1_exception.rb +0 -53
- data/lib/shell_ev/exceptions/m429_error_response_error1_exception.rb +0 -52
- data/lib/shell_ev/exceptions/m500_error_response_error1_exception.rb +0 -52
- data/lib/shell_ev/exceptions/m503_error_response_error1_exception.rb +0 -52
- data/lib/shell_ev/models/data_active_session_code_enum.rb +0 -44
- data/lib/shell_ev/models/data_active_session_state_enum.rb +0 -35
- data/lib/shell_ev/models/data_retrieve_session_code_enum.rb +0 -44
- data/lib/shell_ev/models/data_retrieve_session_state_enum.rb +0 -35
- data/lib/shell_ev/models/env_enum.rb +0 -23
- data/lib/shell_ev/models/m400_error_response.rb +0 -78
- data/lib/shell_ev/models/m400_error_response_error.rb +0 -80
- data/lib/shell_ev/models/m401_error_response.rb +0 -78
- data/lib/shell_ev/models/m401_error_response_error.rb +0 -80
- data/lib/shell_ev/models/m404_error_response.rb +0 -79
- data/lib/shell_ev/models/m404_error_response_error.rb +0 -80
- data/lib/shell_ev/models/m405_error_response.rb +0 -78
- data/lib/shell_ev/models/m405_error_response_error.rb +0 -80
- data/lib/shell_ev/models/m429_error_response.rb +0 -78
- data/lib/shell_ev/models/m429_error_response_error.rb +0 -80
- data/lib/shell_ev/models/m500_error_response.rb +0 -78
- data/lib/shell_ev/models/m500_error_response_error.rb +0 -80
- data/lib/shell_ev/models/m503_error_response.rb +0 -78
- data/lib/shell_ev/models/m503_error_response_error.rb +0 -80
- data/lib/shell_ev/models/response_base_status_enum.rb +0 -26
- data/lib/shell_ev/models/response_error401_all_of1.rb +0 -57
- data/lib/shell_ev/models/response_error401_all_of1_errors_items.rb +0 -80
- data/lib/shell_ev/models/success_response.rb +0 -58
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ca475d6391b018b580ab5ab4e9b0d8edc441fcdbedc4efb0b384fc18b2622c9
|
4
|
+
data.tar.gz: c103f47f6e71284c4d80d992c28270165bb484ad3118e615b08336f5bd1bbd2b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df1225d35d298dd416d8eac0dcba8056aa98aa9452f355fe7cc5a74526275fa0e1d0dca4d923bccdaf6f7360e95ea7b4db11225ad2da6f79e04843bc5eb3c532
|
7
|
+
data.tar.gz: 1c17bd98dd14ff6e57676462e4deb24d7f59e25fdb937768b81f07332f5ce1b2b715957b18747f73680e17c99186ec71f64eb0d978d36591c702c0a8c00c735c
|
data/README.md
CHANGED
@@ -3,14 +3,23 @@
|
|
3
3
|
|
4
4
|
## Introduction
|
5
5
|
|
6
|
-
This API Product provides the
|
6
|
+
This API Product provides the list of all Shell Recharge locations. The list includes all Shell Recharge network and all locations available through our roaming partners.
|
7
7
|
|
8
|
-
Supported
|
8
|
+
Supported Functions
|
9
9
|
|
10
|
-
*
|
11
|
-
*
|
12
|
-
*
|
13
|
-
*
|
10
|
+
* Get the list of all the locations and its details.
|
11
|
+
* Get the details of a particular location.
|
12
|
+
* Get the list of locations nearby using the latitude and longitude.
|
13
|
+
* Get the list of locations for a given set of bounds with different zoom levels.
|
14
|
+
|
15
|
+
The Charging endpoints provides control to start, stop and get status of the charging session.
|
16
|
+
|
17
|
+
Supported Functions
|
18
|
+
|
19
|
+
* Start a charging session\n
|
20
|
+
* Stop a charging session \n
|
21
|
+
* Retrieve the status of a charging session \n
|
22
|
+
* Retrieve the list of all active sessions for a card
|
14
23
|
|
15
24
|
Go to the Shell Developer Portal: [https://developer.shell.com](https://developer.shell.com)
|
16
25
|
|
@@ -19,16 +28,16 @@ Go to the Shell Developer Portal: [https://developer.shell.com](https://develope
|
|
19
28
|
Install the gem from the command line:
|
20
29
|
|
21
30
|
```ruby
|
22
|
-
gem install ev-recharge-sdk -v 1.
|
31
|
+
gem install ev-recharge-sdk -v 1.1.0
|
23
32
|
```
|
24
33
|
|
25
34
|
Or add the gem to your Gemfile and run `bundle`:
|
26
35
|
|
27
36
|
```ruby
|
28
|
-
gem 'ev-recharge-sdk', '1.
|
37
|
+
gem 'ev-recharge-sdk', '1.1.0'
|
29
38
|
```
|
30
39
|
|
31
|
-
For additional gem details, see the [RubyGems page for the ev-recharge-sdk gem](https://rubygems.org/gems/ev-recharge-sdk/versions/1.
|
40
|
+
For additional gem details, see the [RubyGems page for the ev-recharge-sdk gem](https://rubygems.org/gems/ev-recharge-sdk/versions/1.1.0).
|
32
41
|
|
33
42
|
## Test the SDK
|
34
43
|
|
@@ -40,13 +49,12 @@ rake
|
|
40
49
|
|
41
50
|
## Initialize the API Client
|
42
51
|
|
43
|
-
**_Note:_** Documentation for the client can be found [here.](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/1.
|
52
|
+
**_Note:_** Documentation for the client can be found [here.](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/1.1.0/doc/client.md)
|
44
53
|
|
45
54
|
The following parameters are configurable for the API Client:
|
46
55
|
|
47
56
|
| Parameter | Type | Description |
|
48
57
|
| --- | --- | --- |
|
49
|
-
| `env` | `EnvEnum` | This variable specifies the type of environment. Environments:<br><br>* `api` - Production<br>* `api-test` - UAT<br>*Default*: `EnvEnum::ENUM_APITESTSHELLCOM` |
|
50
58
|
| `environment` | `Environment` | The API environment. <br> **Default: `Environment.PRODUCTION`** |
|
51
59
|
| `connection` | `Faraday::Connection` | The Faraday connection object passed by the SDK user for making requests |
|
52
60
|
| `adapter` | `Faraday::Adapter` | The Faraday adapter object passed by the SDK user for performing http requests |
|
@@ -57,7 +65,7 @@ The following parameters are configurable for the API Client:
|
|
57
65
|
| `retry_statuses` | `Array` | A list of HTTP statuses to retry. <br> **Default: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524]** |
|
58
66
|
| `retry_methods` | `Array` | A list of HTTP methods to retry. <br> **Default: %i[get put]** |
|
59
67
|
| `http_callback` | `HttpCallBack` | The Http CallBack allows defining callables for pre and post API calls. |
|
60
|
-
| `client_credentials_auth_credentials` | [`ClientCredentialsAuthCredentials`](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/1.
|
68
|
+
| `client_credentials_auth_credentials` | [`ClientCredentialsAuthCredentials`](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/1.1.0/doc/$a/https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/1.1.0/oauth-2-client-credentials-grant.md) | The credential object for OAuth 2 Client Credentials Grant |
|
61
69
|
|
62
70
|
The API client can be initialized as follows:
|
63
71
|
|
@@ -67,26 +75,35 @@ client = ShellEv::Client.new(
|
|
67
75
|
o_auth_client_id: 'OAuthClientId',
|
68
76
|
o_auth_client_secret: 'OAuthClientSecret'
|
69
77
|
),
|
70
|
-
environment: Environment::PRODUCTION
|
71
|
-
env: EnvEnum::ENUM_APITESTSHELLCOM
|
78
|
+
environment: Environment::PRODUCTION
|
72
79
|
)
|
73
80
|
```
|
74
81
|
|
82
|
+
## Environments
|
83
|
+
|
84
|
+
The SDK can be configured to use a different environment for making API calls. Available environments are:
|
85
|
+
|
86
|
+
### Fields
|
87
|
+
|
88
|
+
| Name | Description |
|
89
|
+
| --- | --- |
|
90
|
+
| production | **Default** Production |
|
91
|
+
| environment2 | Test |
|
92
|
+
|
75
93
|
## Authorization
|
76
94
|
|
77
95
|
This API uses the following authentication schemes.
|
78
96
|
|
79
|
-
* [`BearerAuth (OAuth 2 Client Credentials Grant)`](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/1.
|
97
|
+
* [`BearerAuth (OAuth 2 Client Credentials Grant)`](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/1.1.0/doc/$a/https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/1.1.0/oauth-2-client-credentials-grant.md)
|
80
98
|
|
81
99
|
## List of APIs
|
82
100
|
|
83
|
-
* [
|
84
|
-
* [Charging](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/1.
|
85
|
-
* [Locations](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/1.0.0/doc/controllers/locations.md)
|
101
|
+
* [Locations](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/1.1.0/doc/controllers/locations.md)
|
102
|
+
* [Charging](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/1.1.0/doc/controllers/charging.md)
|
86
103
|
|
87
104
|
## Classes Documentation
|
88
105
|
|
89
|
-
* [Utility Classes](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/1.
|
90
|
-
* [HttpResponse](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/1.
|
91
|
-
* [HttpRequest](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/1.
|
106
|
+
* [Utility Classes](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/1.1.0/doc/utility-classes.md)
|
107
|
+
* [HttpResponse](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/1.1.0/doc/http-response.md)
|
108
|
+
* [HttpRequest](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/1.1.0/doc/http-request.md)
|
92
109
|
|
data/lib/shell_ev/client.rb
CHANGED
@@ -14,18 +14,18 @@ module ShellEv
|
|
14
14
|
@auth_managers['BearerAuth']
|
15
15
|
end
|
16
16
|
|
17
|
-
# Access to charging controller.
|
18
|
-
# @return [ChargingController] Returns the controller instance.
|
19
|
-
def charging
|
20
|
-
@charging ||= ChargingController.new @global_configuration
|
21
|
-
end
|
22
|
-
|
23
17
|
# Access to locations controller.
|
24
18
|
# @return [LocationsController] Returns the controller instance.
|
25
19
|
def locations
|
26
20
|
@locations ||= LocationsController.new @global_configuration
|
27
21
|
end
|
28
22
|
|
23
|
+
# Access to charging controller.
|
24
|
+
# @return [ChargingController] Returns the controller instance.
|
25
|
+
def charging
|
26
|
+
@charging ||= ChargingController.new @global_configuration
|
27
|
+
end
|
28
|
+
|
29
29
|
# Access to o_auth_authorization controller.
|
30
30
|
# @return [OAuthAuthorizationController] Returns the controller instance.
|
31
31
|
def o_auth_authorization
|
@@ -37,7 +37,7 @@ module ShellEv
|
|
37
37
|
max_retries: 0, retry_interval: 1, backoff_factor: 2,
|
38
38
|
retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
|
39
39
|
retry_methods: %i[get put], http_callback: nil,
|
40
|
-
environment: Environment::PRODUCTION,
|
40
|
+
environment: Environment::PRODUCTION,
|
41
41
|
client_credentials_auth_credentials: nil, config: nil
|
42
42
|
)
|
43
43
|
@config = if config.nil?
|
@@ -47,7 +47,7 @@ module ShellEv
|
|
47
47
|
backoff_factor: backoff_factor,
|
48
48
|
retry_statuses: retry_statuses,
|
49
49
|
retry_methods: retry_methods, http_callback: http_callback,
|
50
|
-
environment: environment,
|
50
|
+
environment: environment,
|
51
51
|
client_credentials_auth_credentials: client_credentials_auth_credentials
|
52
52
|
)
|
53
53
|
else
|
@@ -6,8 +6,11 @@
|
|
6
6
|
module ShellEv
|
7
7
|
# An enum for SDK environments.
|
8
8
|
class Environment
|
9
|
+
# PRODUCTION: Production
|
10
|
+
# ENVIRONMENT2: Test
|
9
11
|
ENVIRONMENT = [
|
10
|
-
PRODUCTION = 'production'.freeze
|
12
|
+
PRODUCTION = 'production'.freeze,
|
13
|
+
ENVIRONMENT2 = 'environment2'.freeze
|
11
14
|
].freeze
|
12
15
|
end
|
13
16
|
|
@@ -22,7 +25,7 @@ module ShellEv
|
|
22
25
|
# are configured in this class.
|
23
26
|
class Configuration < CoreLibrary::HttpClientConfiguration
|
24
27
|
# The attribute readers for properties.
|
25
|
-
attr_reader :environment, :
|
28
|
+
attr_reader :environment, :client_credentials_auth_credentials
|
26
29
|
|
27
30
|
class << self
|
28
31
|
attr_reader :environments
|
@@ -33,7 +36,7 @@ module ShellEv
|
|
33
36
|
max_retries: 0, retry_interval: 1, backoff_factor: 2,
|
34
37
|
retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
|
35
38
|
retry_methods: %i[get put], http_callback: nil,
|
36
|
-
environment: Environment::PRODUCTION,
|
39
|
+
environment: Environment::PRODUCTION,
|
37
40
|
client_credentials_auth_credentials: nil
|
38
41
|
)
|
39
42
|
|
@@ -45,9 +48,6 @@ module ShellEv
|
|
45
48
|
# Current API environment
|
46
49
|
@environment = String(environment)
|
47
50
|
|
48
|
-
# This variable specifies the type of environment. Environments: * `api` - Production * `api-test` - UAT
|
49
|
-
@env = env
|
50
|
-
|
51
51
|
# The object holding OAuth 2 Client Credentials Grant credentials
|
52
52
|
@client_credentials_auth_credentials = client_credentials_auth_credentials
|
53
53
|
|
@@ -61,8 +61,7 @@ module ShellEv
|
|
61
61
|
def clone_with(connection: nil, adapter: nil, timeout: nil,
|
62
62
|
max_retries: nil, retry_interval: nil, backoff_factor: nil,
|
63
63
|
retry_statuses: nil, retry_methods: nil, http_callback: nil,
|
64
|
-
environment: nil,
|
65
|
-
client_credentials_auth_credentials: nil)
|
64
|
+
environment: nil, client_credentials_auth_credentials: nil)
|
66
65
|
connection ||= self.connection
|
67
66
|
adapter ||= self.adapter
|
68
67
|
timeout ||= self.timeout
|
@@ -73,7 +72,6 @@ module ShellEv
|
|
73
72
|
retry_methods ||= self.retry_methods
|
74
73
|
http_callback ||= self.http_callback
|
75
74
|
environment ||= self.environment
|
76
|
-
env ||= self.env
|
77
75
|
client_credentials_auth_credentials ||= client_credentials_auth_credentials
|
78
76
|
|
79
77
|
Configuration.new(
|
@@ -81,7 +79,7 @@ module ShellEv
|
|
81
79
|
max_retries: max_retries, retry_interval: retry_interval,
|
82
80
|
backoff_factor: backoff_factor, retry_statuses: retry_statuses,
|
83
81
|
retry_methods: retry_methods, http_callback: http_callback,
|
84
|
-
environment: environment,
|
82
|
+
environment: environment,
|
85
83
|
client_credentials_auth_credentials: client_credentials_auth_credentials
|
86
84
|
)
|
87
85
|
end
|
@@ -90,7 +88,10 @@ module ShellEv
|
|
90
88
|
# All the environments the SDK can run in.
|
91
89
|
ENVIRONMENTS = {
|
92
90
|
Environment::PRODUCTION => {
|
93
|
-
Server::DEFAULT => 'https://
|
91
|
+
Server::DEFAULT => 'https://api.shell.com'
|
92
|
+
},
|
93
|
+
Environment::ENVIRONMENT2 => {
|
94
|
+
Server::DEFAULT => 'https://api-test.shell.com'
|
94
95
|
}
|
95
96
|
}.freeze
|
96
97
|
|
@@ -99,12 +100,7 @@ module ShellEv
|
|
99
100
|
# required.
|
100
101
|
# @return [String] The base URI.
|
101
102
|
def get_base_uri(server = Server::DEFAULT)
|
102
|
-
|
103
|
-
'env' => { 'value' => env, 'encode' => false }
|
104
|
-
}
|
105
|
-
APIHelper.append_url_with_template_parameters(
|
106
|
-
ENVIRONMENTS[environment][server], parameters
|
107
|
-
)
|
103
|
+
ENVIRONMENTS[environment][server].clone
|
108
104
|
end
|
109
105
|
end
|
110
106
|
end
|
@@ -30,15 +30,15 @@ module ShellEv
|
|
30
30
|
end
|
31
31
|
|
32
32
|
# Creates a new builder for the Api Call instance.
|
33
|
-
# @return [ApiCall] The instance of ApiCall.
|
34
|
-
def new_api_call_builder
|
35
|
-
@api_call.new_builder
|
36
|
-
end
|
37
|
-
|
38
|
-
# Creates a new instance of the request builder.
|
39
|
-
# @param [String] http_method The HTTP method to use in the request.
|
40
|
-
# @param [String] path The endpoint path to use in the request.
|
41
|
-
# @param [String] server The server to extract the base uri for the request.
|
33
|
+
# @return [ApiCall] The instance of ApiCall.
|
34
|
+
def new_api_call_builder
|
35
|
+
@api_call.new_builder
|
36
|
+
end
|
37
|
+
|
38
|
+
# Creates a new instance of the request builder.
|
39
|
+
# @param [String] http_method The HTTP method to use in the request.
|
40
|
+
# @param [String] path The endpoint path to use in the request.
|
41
|
+
# @param [String] server The server to extract the base uri for the request.
|
42
42
|
# @return [RequestBuilder] The instance of RequestBuilder.
|
43
43
|
def new_request_builder(http_method, path, server)
|
44
44
|
RequestBuilder.new
|
@@ -6,18 +6,18 @@
|
|
6
6
|
module ShellEv
|
7
7
|
# ChargingController
|
8
8
|
class ChargingController < BaseController
|
9
|
-
# This
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
13
|
-
#
|
14
|
-
#
|
15
|
-
#
|
16
|
-
#
|
9
|
+
# This endpoint start the charging session for the user.
|
10
|
+
# @param [UUID | String] request_id Required parameter: RequestId must be
|
11
|
+
# unique identifier value that can be used by the consumer to correlate each
|
12
|
+
# request /response .<br>Format.<br> Its canonical textual representation,
|
13
|
+
# the 16 octets of a UUID are represented as 32 hexadecimal (base-16)
|
14
|
+
# digits, displayed in five groups separated by hyphens, in the form
|
15
|
+
# 8-4-4-4-12 for a total of 36 characters (32 hexadecimal characters and 4
|
16
|
+
# hyphens) <br>
|
17
17
|
# @param [ChargesessionStartBody] body Optional parameter: Example:
|
18
18
|
# @return [InlineResponse202] response from the API call
|
19
|
-
def
|
20
|
-
|
19
|
+
def start(request_id,
|
20
|
+
body: nil)
|
21
21
|
new_api_call_builder
|
22
22
|
.request(new_request_builder(HttpMethodEnum::POST,
|
23
23
|
'/ev/v1/charge-session/start',
|
@@ -29,187 +29,154 @@ module ShellEv
|
|
29
29
|
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
30
30
|
.auth(Single.new('BearerAuth')))
|
31
31
|
.response(new_response_handler
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
' retries are completed',
|
57
|
-
M503ErrorResponseError1Exception))
|
32
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
33
|
+
.deserialize_into(InlineResponse202.method(:from_hash))
|
34
|
+
.local_error('400',
|
35
|
+
'The server cannot or will not process the request due to'\
|
36
|
+
' something that is perceived to be a client error (e.g.,'\
|
37
|
+
' malformed request syntax, invalid request message framing, or'\
|
38
|
+
' deceptive request routing).',
|
39
|
+
BadRequestException)
|
40
|
+
.local_error('401',
|
41
|
+
'The request has not been applied because it lacks valid'\
|
42
|
+
' authentication credentials for the target resource.',
|
43
|
+
UnauthorizedException)
|
44
|
+
.local_error('404',
|
45
|
+
'Location Not Found',
|
46
|
+
NotFoundException)
|
47
|
+
.local_error('429',
|
48
|
+
'The Request reached maximum allocated rate limit',
|
49
|
+
TooManyRequestsException)
|
50
|
+
.local_error('500',
|
51
|
+
'Internal Server error',
|
52
|
+
InternalServerErrorException)
|
53
|
+
.local_error('503',
|
54
|
+
'Service unavailable',
|
55
|
+
ServiceunavailableException))
|
58
56
|
.execute
|
59
57
|
end
|
60
58
|
|
61
|
-
#
|
62
|
-
#
|
63
|
-
#
|
64
|
-
#
|
65
|
-
#
|
66
|
-
#
|
67
|
-
#
|
68
|
-
#
|
69
|
-
#
|
70
|
-
# @param [
|
71
|
-
# Example:
|
59
|
+
# Accepts a request to stop an active session when a valid session id is
|
60
|
+
# provided.
|
61
|
+
# @param [UUID | String] request_id Required parameter: RequestId must be
|
62
|
+
# unique identifier value that can be used by the consumer to correlate each
|
63
|
+
# request /response .<br>Format.<br> Its canonical textual representation,
|
64
|
+
# the 16 octets of a UUID are represented as 32 hexadecimal (base-16)
|
65
|
+
# digits, displayed in five groups separated by hyphens, in the form
|
66
|
+
# 8-4-4-4-12 for a total of 36 characters (32 hexadecimal characters and 4
|
67
|
+
# hyphens) <br>
|
68
|
+
# @param [String] session_id Required parameter: Session Id
|
72
69
|
# @return [InlineResponse2021] response from the API call
|
73
|
-
def
|
74
|
-
|
75
|
-
body: nil)
|
70
|
+
def stop(request_id,
|
71
|
+
session_id)
|
76
72
|
new_api_call_builder
|
77
73
|
.request(new_request_builder(HttpMethodEnum::POST,
|
78
|
-
'/ev/v1/charge-session/stop
|
74
|
+
'/ev/v1/charge-session/stop',
|
79
75
|
Server::DEFAULT)
|
80
76
|
.header_param(new_parameter(request_id, key: 'RequestId'))
|
81
|
-
.
|
82
|
-
.should_encode(true))
|
83
|
-
.header_param(new_parameter('application/json', key: 'Content-Type'))
|
84
|
-
.body_param(new_parameter(body))
|
77
|
+
.query_param(new_parameter(session_id, key: 'sessionId'))
|
85
78
|
.header_param(new_parameter('application/json', key: 'accept'))
|
86
|
-
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
87
79
|
.auth(Single.new('BearerAuth')))
|
88
80
|
.response(new_response_handler
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
' retries are completed\n",
|
114
|
-
M503ErrorResponseError1Exception))
|
81
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
82
|
+
.deserialize_into(InlineResponse2021.method(:from_hash))
|
83
|
+
.local_error('400',
|
84
|
+
'The server cannot or will not process the request due to'\
|
85
|
+
' something that is perceived to be a client error (e.g.,'\
|
86
|
+
' malformed request syntax, invalid request message framing, or'\
|
87
|
+
' deceptive request routing).',
|
88
|
+
BadRequestException)
|
89
|
+
.local_error('401',
|
90
|
+
'The request has not been applied because it lacks valid'\
|
91
|
+
' authentication credentials for the target resource.',
|
92
|
+
UnauthorizedException)
|
93
|
+
.local_error('404',
|
94
|
+
'Location Not Found',
|
95
|
+
NotFoundException)
|
96
|
+
.local_error('429',
|
97
|
+
'The Request reached maximum allocated rate limit',
|
98
|
+
TooManyRequestsException)
|
99
|
+
.local_error('500',
|
100
|
+
'Internal Server error',
|
101
|
+
InternalServerErrorException)
|
102
|
+
.local_error('503',
|
103
|
+
'Service unavailable',
|
104
|
+
ServiceunavailableException))
|
115
105
|
.execute
|
116
106
|
end
|
117
107
|
|
118
|
-
# This
|
119
|
-
#
|
120
|
-
#
|
121
|
-
#
|
122
|
-
#
|
123
|
-
#
|
124
|
-
#
|
125
|
-
#
|
126
|
-
# @param [
|
127
|
-
# was generated to activate a charging session.
|
108
|
+
# This endpoint returns the details of the session if the session is found.
|
109
|
+
# @param [UUID | String] request_id Required parameter: RequestId must be
|
110
|
+
# unique identifier value that can be used by the consumer to correlate each
|
111
|
+
# request /response .<br>Format.<br> Its canonical textual representation,
|
112
|
+
# the 16 octets of a UUID are represented as 32 hexadecimal (base-16)
|
113
|
+
# digits, displayed in five groups separated by hyphens, in the form
|
114
|
+
# 8-4-4-4-12 for a total of 36 characters (32 hexadecimal characters and 4
|
115
|
+
# hyphens) <br>
|
116
|
+
# @param [String] session_id Required parameter: Session Id
|
128
117
|
# @return [GetChargeSessionRetrieveResponse200Json] response from the API call
|
129
118
|
def get_charge_session_retrieve(request_id,
|
130
|
-
session_id
|
131
|
-
uuid)
|
119
|
+
session_id)
|
132
120
|
new_api_call_builder
|
133
121
|
.request(new_request_builder(HttpMethodEnum::GET,
|
134
|
-
'/ev/v1/charge-session/retrieve
|
122
|
+
'/ev/v1/charge-session/retrieve',
|
135
123
|
Server::DEFAULT)
|
136
124
|
.header_param(new_parameter(request_id, key: 'RequestId'))
|
137
|
-
.query_param(new_parameter(session_id, key: '
|
138
|
-
.template_param(new_parameter(uuid, key: 'uuid')
|
139
|
-
.should_encode(true))
|
125
|
+
.query_param(new_parameter(session_id, key: 'sessionId'))
|
140
126
|
.header_param(new_parameter('application/json', key: 'accept'))
|
141
127
|
.auth(Single.new('BearerAuth')))
|
142
128
|
.response(new_response_handler
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
129
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
130
|
+
.deserialize_into(GetChargeSessionRetrieveResponse200Json.method(:from_hash))
|
131
|
+
.local_error('400',
|
132
|
+
'The server cannot or will not process the request due to'\
|
133
|
+
' something that is perceived to be a client error (e.g.,'\
|
134
|
+
' malformed request syntax, invalid request message framing, or'\
|
135
|
+
' deceptive request routing).',
|
136
|
+
BadRequestException)
|
137
|
+
.local_error('401',
|
138
|
+
'The request has not been applied because it lacks valid'\
|
139
|
+
' authentication credentials for the target resource.',
|
140
|
+
UnauthorizedException)
|
141
|
+
.local_error('404',
|
142
|
+
'Location Not Found',
|
143
|
+
NotFoundException)
|
144
|
+
.local_error('429',
|
145
|
+
'The Request reached maximum allocated rate limit',
|
146
|
+
TooManyRequestsException)
|
147
|
+
.local_error('500',
|
148
|
+
'Internal Server error',
|
149
|
+
InternalServerErrorException)
|
150
|
+
.local_error('503',
|
151
|
+
'Service unavailable',
|
152
|
+
ServiceunavailableException))
|
166
153
|
.execute
|
167
154
|
end
|
168
155
|
|
169
|
-
#
|
156
|
+
# Fetrches the active sessions for user.
|
157
|
+
# @param [UUID | String] request_id Required parameter: RequestId must be
|
158
|
+
# unique identifier value that can be used by the consumer to correlate each
|
159
|
+
# request /response .<br>Format.<br> Its canonical textual representation,
|
160
|
+
# the 16 octets of a UUID are represented as 32 hexadecimal (base-16)
|
161
|
+
# digits, displayed in five groups separated by hyphens, in the form
|
162
|
+
# 8-4-4-4-12 for a total of 36 characters (32 hexadecimal characters and 4
|
163
|
+
# hyphens) <br>
|
170
164
|
# @param [String] ema_id Required parameter: Emobility Account
|
171
165
|
# Identifier(Ema-ID)
|
172
|
-
# @param [UUID | String] request_id Required parameter: A unique request id
|
173
|
-
# in GUID format. The value is written to the Shell API Platform audit log
|
174
|
-
# for end to end traceability of a request.
|
175
166
|
# @return [ActiveResponse200Json] response from the API call
|
176
|
-
def active(
|
177
|
-
|
167
|
+
def active(request_id,
|
168
|
+
ema_id)
|
178
169
|
new_api_call_builder
|
179
170
|
.request(new_request_builder(HttpMethodEnum::GET,
|
180
171
|
'/ev/v1/charge-session/active',
|
181
172
|
Server::DEFAULT)
|
182
|
-
.query_param(new_parameter(ema_id, key: 'EmaId'))
|
183
173
|
.header_param(new_parameter(request_id, key: 'RequestId'))
|
174
|
+
.query_param(new_parameter(ema_id, key: 'emaId'))
|
184
175
|
.header_param(new_parameter('application/json', key: 'accept'))
|
185
176
|
.auth(Single.new('BearerAuth')))
|
186
177
|
.response(new_response_handler
|
187
|
-
|
188
|
-
|
189
|
-
.local_error('400',
|
190
|
-
"Bad Request\n",
|
191
|
-
M400ErrorResponseError1Exception)
|
192
|
-
.local_error('401',
|
193
|
-
'Unauthorized',
|
194
|
-
M401ErrorResponseError1Exception)
|
195
|
-
.local_error('404',
|
196
|
-
'Session not found or Session has already been stopped. Map 410'\
|
197
|
-
' Error message into 404.',
|
198
|
-
M404ErrorResponseError1Exception)
|
199
|
-
.local_error('405',
|
200
|
-
'Method Not Allowed',
|
201
|
-
M405ErrorResponseError1Exception)
|
202
|
-
.local_error('429',
|
203
|
-
'Too Many Requests',
|
204
|
-
M429ErrorResponseError1Exception)
|
205
|
-
.local_error('500',
|
206
|
-
'Internal Server Error',
|
207
|
-
M500ErrorResponseError1Exception)
|
208
|
-
.local_error('503',
|
209
|
-
"Returned when a connectivity failure is encountered like DB'\
|
210
|
-
' connection failed, endpoint failed etc or when max number of'\
|
211
|
-
' retries are completed\n",
|
212
|
-
M503ErrorResponseError1Exception))
|
178
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
179
|
+
.deserialize_into(ActiveResponse200Json.method(:from_hash)))
|
213
180
|
.execute
|
214
181
|
end
|
215
182
|
end
|