ev-recharge-sdk 2.1.0 → 2.2.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.
- checksums.yaml +4 -4
- data/README.md +20 -20
- data/lib/shell_ev/client.rb +1 -1
- data/lib/shell_ev/configuration.rb +18 -20
- data/lib/shell_ev/controllers/charging_controller.rb +4 -4
- data/lib/shell_ev/controllers/locations_controller.rb +4 -4
- data/lib/shell_ev/controllers/o_auth_authorization_controller.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 87e485796359f70dfe17eeed4559a96553783ff4f5602563626ac6a2d8bf2d22
|
|
4
|
+
data.tar.gz: c3a6e9a96e88729148bb651aa932254d0d9fc12385d241ec88088e5854fa3b42
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 74f2471681ecd05c722327f661fc7531808d41032bd818e88a12cd0368c955780be77bf013516116dff654f361a50e5037b745504897948666093f188a37ee09
|
|
7
|
+
data.tar.gz: 75c67c0d320d0527960f4c102ff47d1e14478a38a994d24fc95625d0d416abd67a76ec6513e1f55bf489ce304ecad97f81b0ba24ad1419c08656ec9ef9d89146
|
data/README.md
CHANGED
|
@@ -28,16 +28,16 @@ Go to the Shell Developer Portal: [https://developer.shell.com](https://develope
|
|
|
28
28
|
Install the gem from the command line:
|
|
29
29
|
|
|
30
30
|
```bash
|
|
31
|
-
gem install ev-recharge-sdk -v 2.
|
|
31
|
+
gem install ev-recharge-sdk -v 2.2.0
|
|
32
32
|
```
|
|
33
33
|
|
|
34
34
|
Or add the gem to your Gemfile and run `bundle`:
|
|
35
35
|
|
|
36
36
|
```ruby
|
|
37
|
-
gem 'ev-recharge-sdk', '2.
|
|
37
|
+
gem 'ev-recharge-sdk', '2.2.0'
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
-
For additional gem details, see the [RubyGems page for the ev-recharge-sdk gem](https://rubygems.org/gems/ev-recharge-sdk/versions/2.
|
|
40
|
+
For additional gem details, see the [RubyGems page for the ev-recharge-sdk gem](https://rubygems.org/gems/ev-recharge-sdk/versions/2.2.0).
|
|
41
41
|
|
|
42
42
|
## IRB Console Usage
|
|
43
43
|
|
|
@@ -84,13 +84,13 @@ rake
|
|
|
84
84
|
|
|
85
85
|
## Initialize the API Client
|
|
86
86
|
|
|
87
|
-
**_Note:_** Documentation for the client can be found [here.](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/2.
|
|
87
|
+
**_Note:_** Documentation for the client can be found [here.](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/2.2.0/doc/client.md)
|
|
88
88
|
|
|
89
89
|
The following parameters are configurable for the API Client:
|
|
90
90
|
|
|
91
91
|
| Parameter | Type | Description |
|
|
92
92
|
| --- | --- | --- |
|
|
93
|
-
| environment | [`Environment`](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/2.
|
|
93
|
+
| environment | [`Environment`](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/2.2.0/README.md#environments) | The API environment. <br> **Default: `Environment.SIT`** |
|
|
94
94
|
| connection | `Faraday::Connection` | The Faraday connection object passed by the SDK user for making requests |
|
|
95
95
|
| adapter | `Faraday::Adapter` | The Faraday adapter object passed by the SDK user for performing http requests |
|
|
96
96
|
| timeout | `Float` | The value to use for connection timeout. <br> **Default: 60** |
|
|
@@ -100,8 +100,8 @@ The following parameters are configurable for the API Client:
|
|
|
100
100
|
| retry_statuses | `Array` | A list of HTTP statuses to retry. <br> **Default: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524]** |
|
|
101
101
|
| retry_methods | `Array` | A list of HTTP methods to retry. <br> **Default: %i[get put]** |
|
|
102
102
|
| http_callback | `HttpCallBack` | The Http CallBack allows defining callables for pre and post API calls. |
|
|
103
|
-
| proxy_settings | [`ProxySettings`](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/2.
|
|
104
|
-
| client_credentials_auth_credentials | [`ClientCredentialsAuthCredentials`](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/2.
|
|
103
|
+
| proxy_settings | [`ProxySettings`](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/2.2.0/doc/proxy-settings.md) | Optional proxy configuration to route HTTP requests through a proxy server. |
|
|
104
|
+
| client_credentials_auth_credentials | [`ClientCredentialsAuthCredentials`](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/2.2.0/doc/auth/oauth-2-client-credentials-grant.md) | The credential object for OAuth 2 Client Credentials Grant |
|
|
105
105
|
|
|
106
106
|
The API client can be initialized as follows:
|
|
107
107
|
|
|
@@ -116,7 +116,7 @@ client = Client.new(
|
|
|
116
116
|
o_auth_client_id: 'OAuthClientId',
|
|
117
117
|
o_auth_client_secret: 'OAuthClientSecret'
|
|
118
118
|
),
|
|
119
|
-
environment: Environment::
|
|
119
|
+
environment: Environment::SIT
|
|
120
120
|
)
|
|
121
121
|
```
|
|
122
122
|
|
|
@@ -130,7 +130,7 @@ include ShellEv
|
|
|
130
130
|
client = Client.from_env
|
|
131
131
|
```
|
|
132
132
|
|
|
133
|
-
See the [`Environment-Based Client Initialization`](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/2.
|
|
133
|
+
See the [`Environment-Based Client Initialization`](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/2.2.0/doc/environment-based-client-initialization.md) section for details.
|
|
134
134
|
|
|
135
135
|
## Environments
|
|
136
136
|
|
|
@@ -140,34 +140,34 @@ The SDK can be configured to use a different environment for making API calls. A
|
|
|
140
140
|
|
|
141
141
|
| Name | Description |
|
|
142
142
|
| --- | --- |
|
|
143
|
-
|
|
|
144
|
-
|
|
|
143
|
+
| SIT | **Default** |
|
|
144
|
+
| PRODUCTION | - |
|
|
145
145
|
|
|
146
146
|
## Authorization
|
|
147
147
|
|
|
148
148
|
This API uses the following authentication schemes.
|
|
149
149
|
|
|
150
|
-
* [`BearerAuth (OAuth 2 Client Credentials Grant)`](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/2.
|
|
150
|
+
* [`BearerAuth (OAuth 2 Client Credentials Grant)`](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/2.2.0/doc/auth/oauth-2-client-credentials-grant.md)
|
|
151
151
|
|
|
152
152
|
## List of APIs
|
|
153
153
|
|
|
154
|
-
* [Locations](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/2.
|
|
155
|
-
* [Charging](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/2.
|
|
154
|
+
* [Locations](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/2.2.0/doc/controllers/locations.md)
|
|
155
|
+
* [Charging](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/2.2.0/doc/controllers/charging.md)
|
|
156
156
|
|
|
157
157
|
## SDK Infrastructure
|
|
158
158
|
|
|
159
159
|
### Configuration
|
|
160
160
|
|
|
161
|
-
* [ProxySettings](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/2.
|
|
162
|
-
* [Environment-Based Client Initialization](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/2.
|
|
161
|
+
* [ProxySettings](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/2.2.0/doc/proxy-settings.md)
|
|
162
|
+
* [Environment-Based Client Initialization](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/2.2.0/doc/environment-based-client-initialization.md)
|
|
163
163
|
|
|
164
164
|
### HTTP
|
|
165
165
|
|
|
166
|
-
* [HttpResponse](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/2.
|
|
167
|
-
* [HttpRequest](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/2.
|
|
166
|
+
* [HttpResponse](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/2.2.0/doc/http-response.md)
|
|
167
|
+
* [HttpRequest](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/2.2.0/doc/http-request.md)
|
|
168
168
|
|
|
169
169
|
### Utilities
|
|
170
170
|
|
|
171
|
-
* [ApiHelper](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/2.
|
|
172
|
-
* [DateTimeHelper](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/2.
|
|
171
|
+
* [ApiHelper](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/2.2.0/doc/api-helper.md)
|
|
172
|
+
* [DateTimeHelper](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/2.2.0/doc/date-time-helper.md)
|
|
173
173
|
|
data/lib/shell_ev/client.rb
CHANGED
|
@@ -41,7 +41,7 @@ module ShellEv
|
|
|
41
41
|
max_retries: 0, retry_interval: 1, backoff_factor: 2,
|
|
42
42
|
retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
|
|
43
43
|
retry_methods: %i[get put], http_callback: nil, proxy_settings: nil,
|
|
44
|
-
environment: Environment::
|
|
44
|
+
environment: Environment::SIT, o_auth_client_id: nil,
|
|
45
45
|
o_auth_client_secret: nil, o_auth_token: nil,
|
|
46
46
|
client_credentials_auth_credentials: nil, config: nil
|
|
47
47
|
)
|
|
@@ -6,21 +6,19 @@
|
|
|
6
6
|
module ShellEv
|
|
7
7
|
# An enum for SDK environments.
|
|
8
8
|
class Environment
|
|
9
|
-
# PRODUCTION: Production Server
|
|
10
|
-
# ENVIRONMENT2: Test Server
|
|
11
9
|
ENVIRONMENT = [
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
SIT = 'SIT'.freeze,
|
|
11
|
+
PRODUCTION = 'Production'.freeze
|
|
14
12
|
].freeze
|
|
15
13
|
|
|
16
14
|
# Converts a string or symbol into a valid Environment constant.
|
|
17
|
-
def self.from_value(value, default_value =
|
|
15
|
+
def self.from_value(value, default_value = SIT)
|
|
18
16
|
return default_value if value.nil?
|
|
19
17
|
|
|
20
18
|
str = value.to_s.strip.downcase
|
|
21
19
|
case str
|
|
20
|
+
when 'sit' then SIT
|
|
22
21
|
when 'production' then PRODUCTION
|
|
23
|
-
when 'environment2' then ENVIRONMENT2
|
|
24
22
|
|
|
25
23
|
else
|
|
26
24
|
warn "[Environment] Unknown environment '#{value}', falling back to #{default_value} "
|
|
@@ -32,18 +30,18 @@ module ShellEv
|
|
|
32
30
|
# An enum for API servers.
|
|
33
31
|
class Server
|
|
34
32
|
SERVER = [
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
OAUTH_SERVER = 'OAuth Server'.freeze,
|
|
34
|
+
SHELL = 'Shell'.freeze
|
|
37
35
|
].freeze
|
|
38
36
|
|
|
39
37
|
# Converts a string or symbol into a valid Server constant.
|
|
40
|
-
def self.from_value(value, default_value =
|
|
38
|
+
def self.from_value(value, default_value = OAUTH_SERVER)
|
|
41
39
|
return default_value if value.nil?
|
|
42
40
|
|
|
43
41
|
str = value.to_s.strip.downcase
|
|
44
42
|
case str
|
|
45
|
-
when '
|
|
46
|
-
when '
|
|
43
|
+
when 'oauth_server' then OAUTH_SERVER
|
|
44
|
+
when 'shell' then SHELL
|
|
47
45
|
|
|
48
46
|
else
|
|
49
47
|
warn "[Server] Unknown server '#{value}', falling back to #{default_value} "
|
|
@@ -79,7 +77,7 @@ module ShellEv
|
|
|
79
77
|
max_retries: 0, retry_interval: 1, backoff_factor: 2,
|
|
80
78
|
retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
|
|
81
79
|
retry_methods: %i[get put], http_callback: nil, proxy_settings: nil,
|
|
82
|
-
environment: Environment::
|
|
80
|
+
environment: Environment::SIT, o_auth_client_id: nil,
|
|
83
81
|
o_auth_client_secret: nil, o_auth_token: nil,
|
|
84
82
|
client_credentials_auth_credentials: nil
|
|
85
83
|
)
|
|
@@ -174,13 +172,13 @@ module ShellEv
|
|
|
174
172
|
|
|
175
173
|
# All the environments the SDK can run in.
|
|
176
174
|
ENVIRONMENTS = {
|
|
177
|
-
Environment::
|
|
178
|
-
Server::
|
|
179
|
-
Server::
|
|
175
|
+
Environment::SIT => {
|
|
176
|
+
Server::OAUTH_SERVER => 'https://api-test.shell.com',
|
|
177
|
+
Server::SHELL => 'https://api-test.shell.com/ev'
|
|
180
178
|
},
|
|
181
|
-
Environment::
|
|
182
|
-
Server::
|
|
183
|
-
Server::
|
|
179
|
+
Environment::PRODUCTION => {
|
|
180
|
+
Server::OAUTH_SERVER => 'https://api.shell.com',
|
|
181
|
+
Server::SHELL => 'https://api.shell.com/ev'
|
|
184
182
|
}
|
|
185
183
|
}.freeze
|
|
186
184
|
|
|
@@ -188,14 +186,14 @@ module ShellEv
|
|
|
188
186
|
# @param [Configuration::Server] server The server enum for which the base URI is
|
|
189
187
|
# required.
|
|
190
188
|
# @return [String] The base URI.
|
|
191
|
-
def get_base_uri(server = Server::
|
|
189
|
+
def get_base_uri(server = Server::SHELL)
|
|
192
190
|
ENVIRONMENTS[environment][server].clone
|
|
193
191
|
end
|
|
194
192
|
|
|
195
193
|
# Builds a Configuration instance using environment variables.
|
|
196
194
|
def self.build_default_config_from_env
|
|
197
195
|
# === Core environment ===
|
|
198
|
-
environment = Environment.from_value(ENV.fetch('ENVIRONMENT', '
|
|
196
|
+
environment = Environment.from_value(ENV.fetch('ENVIRONMENT', 'sit'))
|
|
199
197
|
timeout = (ENV['TIMEOUT'] || 60).to_f
|
|
200
198
|
max_retries = (ENV['MAX_RETRIES'] || 0).to_i
|
|
201
199
|
retry_interval = (ENV['RETRY_INTERVAL'] || 1).to_f
|
|
@@ -22,7 +22,7 @@ module ShellEv
|
|
|
22
22
|
@api_call
|
|
23
23
|
.request(new_request_builder(HttpMethodEnum::POST,
|
|
24
24
|
'/v2/charge-session/start',
|
|
25
|
-
Server::
|
|
25
|
+
Server::SHELL)
|
|
26
26
|
.header_param(new_parameter(request_id, key: 'RequestId'))
|
|
27
27
|
.header_param(new_parameter('application/json', key: 'Content-Type'))
|
|
28
28
|
.body_param(new_parameter(body))
|
|
@@ -73,7 +73,7 @@ module ShellEv
|
|
|
73
73
|
@api_call
|
|
74
74
|
.request(new_request_builder(HttpMethodEnum::POST,
|
|
75
75
|
'/v2/charge-session/stop',
|
|
76
|
-
Server::
|
|
76
|
+
Server::SHELL)
|
|
77
77
|
.header_param(new_parameter(request_id, key: 'RequestId'))
|
|
78
78
|
.query_param(new_parameter(session_id, key: 'sessionId'))
|
|
79
79
|
.header_param(new_parameter('application/json', key: 'accept'))
|
|
@@ -121,7 +121,7 @@ module ShellEv
|
|
|
121
121
|
@api_call
|
|
122
122
|
.request(new_request_builder(HttpMethodEnum::GET,
|
|
123
123
|
'/v2/charge-session/retrieve',
|
|
124
|
-
Server::
|
|
124
|
+
Server::SHELL)
|
|
125
125
|
.header_param(new_parameter(request_id, key: 'RequestId'))
|
|
126
126
|
.query_param(new_parameter(session_id, key: 'sessionId'))
|
|
127
127
|
.header_param(new_parameter('application/json', key: 'accept'))
|
|
@@ -170,7 +170,7 @@ module ShellEv
|
|
|
170
170
|
@api_call
|
|
171
171
|
.request(new_request_builder(HttpMethodEnum::GET,
|
|
172
172
|
'/v2/charge-session/active',
|
|
173
|
-
Server::
|
|
173
|
+
Server::SHELL)
|
|
174
174
|
.header_param(new_parameter(request_id, key: 'RequestId'))
|
|
175
175
|
.query_param(new_parameter(ema_id, key: 'emaId'))
|
|
176
176
|
.header_param(new_parameter('application/json', key: 'accept'))
|
|
@@ -75,7 +75,7 @@ module ShellEv
|
|
|
75
75
|
@api_call
|
|
76
76
|
.request(new_request_builder(HttpMethodEnum::GET,
|
|
77
77
|
'/v2/locations',
|
|
78
|
-
Server::
|
|
78
|
+
Server::SHELL)
|
|
79
79
|
.header_param(new_parameter(request_id, key: 'RequestId'))
|
|
80
80
|
.query_param(new_parameter(evse_status, key: 'evseStatus'))
|
|
81
81
|
.query_param(new_parameter(connector_types, key: 'connectorTypes'))
|
|
@@ -145,7 +145,7 @@ module ShellEv
|
|
|
145
145
|
@api_call
|
|
146
146
|
.request(new_request_builder(HttpMethodEnum::GET,
|
|
147
147
|
'/v2/locations/{id}',
|
|
148
|
-
Server::
|
|
148
|
+
Server::SHELL)
|
|
149
149
|
.header_param(new_parameter(request_id, key: 'RequestId'))
|
|
150
150
|
.template_param(new_parameter(id, key: 'id')
|
|
151
151
|
.should_encode(true))
|
|
@@ -257,7 +257,7 @@ module ShellEv
|
|
|
257
257
|
@api_call
|
|
258
258
|
.request(new_request_builder(HttpMethodEnum::GET,
|
|
259
259
|
'/v2/locations/nearby',
|
|
260
|
-
Server::
|
|
260
|
+
Server::SHELL)
|
|
261
261
|
.header_param(new_parameter(request_id, key: 'RequestId'))
|
|
262
262
|
.query_param(new_parameter(latitude, key: 'latitude'))
|
|
263
263
|
.query_param(new_parameter(longitude, key: 'longitude'))
|
|
@@ -382,7 +382,7 @@ module ShellEv
|
|
|
382
382
|
@api_call
|
|
383
383
|
.request(new_request_builder(HttpMethodEnum::GET,
|
|
384
384
|
'/v2/locations/markers',
|
|
385
|
-
Server::
|
|
385
|
+
Server::SHELL)
|
|
386
386
|
.header_param(new_parameter(request_id, key: 'RequestId'))
|
|
387
387
|
.query_param(new_parameter(west, key: 'west'))
|
|
388
388
|
.query_param(new_parameter(south, key: 'south'))
|
|
@@ -19,8 +19,8 @@ module ShellEv
|
|
|
19
19
|
_field_parameters: nil)
|
|
20
20
|
@api_call
|
|
21
21
|
.request(new_request_builder(HttpMethodEnum::POST,
|
|
22
|
-
'/token',
|
|
23
|
-
Server::
|
|
22
|
+
'/v2/oauth/token',
|
|
23
|
+
Server::OAUTH_SERVER)
|
|
24
24
|
.form_param(new_parameter('client_credentials', key: 'grant_type'))
|
|
25
25
|
.header_param(new_parameter(authorization, key: 'Authorization'))
|
|
26
26
|
.form_param(new_parameter(scope, key: 'scope'))
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ev-recharge-sdk
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- developer sdksio
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-06-
|
|
11
|
+
date: 2026-06-18 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: apimatic_core_interfaces
|