ev-recharge-sdk 2.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cde9917d56d444cf7431e26bde8bcc889478694bbecf4dd76e96df0afa64b1a6
4
- data.tar.gz: b7e036557587fc47434681d52291df08d81e10cecf878b213097208217428236
3
+ metadata.gz: 87e485796359f70dfe17eeed4559a96553783ff4f5602563626ac6a2d8bf2d22
4
+ data.tar.gz: c3a6e9a96e88729148bb651aa932254d0d9fc12385d241ec88088e5854fa3b42
5
5
  SHA512:
6
- metadata.gz: 66f6c2129184aef4a408ed295f57fb5c240aadfbd83dff699a3cb0e73bfaa480170a1cf18cd7c336afdd4852193b8b1566628513a45ae0d2185221f3fae2800f
7
- data.tar.gz: 6e87e57762e2a3c3ec0cae304cee477db56707f7e8b77c06cd7227dd96aa92385c0c399b4d97e16df13a15bcd1ca535cbab4a75cc7b82447cf7e5ab624313f7d
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.0.0
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.0.0'
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.0.0).
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.0.0/doc/client.md)
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.0.0/README.md#environments) | The API environment. <br> **Default: `Environment.PRODUCTION`** |
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.0.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.0.0/doc/auth/oauth-2-client-credentials-grant.md) | The credential object for OAuth 2 Client Credentials Grant |
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::PRODUCTION
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.0.0/doc/environment-based-client-initialization.md) section for details.
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,36 +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
- | PRODUCTION | **Default** Production Server |
144
- | ENVIRONMENT2 | Production Server |
145
- | ENVIRONMENT3 | Test Server |
146
- | ENVIRONMENT4 | Test Server |
143
+ | SIT | **Default** |
144
+ | PRODUCTION | - |
147
145
 
148
146
  ## Authorization
149
147
 
150
148
  This API uses the following authentication schemes.
151
149
 
152
- * [`BearerAuth (OAuth 2 Client Credentials Grant)`](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/2.0.0/doc/auth/oauth-2-client-credentials-grant.md)
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)
153
151
 
154
152
  ## List of APIs
155
153
 
156
- * [Locations](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/2.0.0/doc/controllers/locations.md)
157
- * [Charging](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/2.0.0/doc/controllers/charging.md)
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)
158
156
 
159
157
  ## SDK Infrastructure
160
158
 
161
159
  ### Configuration
162
160
 
163
- * [ProxySettings](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/2.0.0/doc/proxy-settings.md)
164
- * [Environment-Based Client Initialization](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/2.0.0/doc/environment-based-client-initialization.md)
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)
165
163
 
166
164
  ### HTTP
167
165
 
168
- * [HttpResponse](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/2.0.0/doc/http-response.md)
169
- * [HttpRequest](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/2.0.0/doc/http-request.md)
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)
170
168
 
171
169
  ### Utilities
172
170
 
173
- * [ApiHelper](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/2.0.0/doc/api-helper.md)
174
- * [DateTimeHelper](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/2.0.0/doc/date-time-helper.md)
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)
175
173
 
@@ -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::PRODUCTION, o_auth_client_id: nil,
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,27 +6,19 @@
6
6
  module ShellEv
7
7
  # An enum for SDK environments.
8
8
  class Environment
9
- # PRODUCTION: Production Server
10
- # ENVIRONMENT2: Production Server
11
- # ENVIRONMENT3: Test Server
12
- # ENVIRONMENT4: Test Server
13
9
  ENVIRONMENT = [
14
- PRODUCTION = 'production'.freeze,
15
- ENVIRONMENT2 = 'environment2'.freeze,
16
- ENVIRONMENT3 = 'environment3'.freeze,
17
- ENVIRONMENT4 = 'environment4'.freeze
10
+ SIT = 'SIT'.freeze,
11
+ PRODUCTION = 'Production'.freeze
18
12
  ].freeze
19
13
 
20
14
  # Converts a string or symbol into a valid Environment constant.
21
- def self.from_value(value, default_value = PRODUCTION)
15
+ def self.from_value(value, default_value = SIT)
22
16
  return default_value if value.nil?
23
17
 
24
18
  str = value.to_s.strip.downcase
25
19
  case str
20
+ when 'sit' then SIT
26
21
  when 'production' then PRODUCTION
27
- when 'environment2' then ENVIRONMENT2
28
- when 'environment3' then ENVIRONMENT3
29
- when 'environment4' then ENVIRONMENT4
30
22
 
31
23
  else
32
24
  warn "[Environment] Unknown environment '#{value}', falling back to #{default_value} "
@@ -38,14 +30,23 @@ module ShellEv
38
30
  # An enum for API servers.
39
31
  class Server
40
32
  SERVER = [
41
- DEFAULT = 'default'.freeze
33
+ OAUTH_SERVER = 'OAuth Server'.freeze,
34
+ SHELL = 'Shell'.freeze
42
35
  ].freeze
43
36
 
44
37
  # Converts a string or symbol into a valid Server constant.
45
- def self.from_value(value, default_value = DEFAULT)
38
+ def self.from_value(value, default_value = OAUTH_SERVER)
46
39
  return default_value if value.nil?
47
40
 
48
- default_value
41
+ str = value.to_s.strip.downcase
42
+ case str
43
+ when 'oauth_server' then OAUTH_SERVER
44
+ when 'shell' then SHELL
45
+
46
+ else
47
+ warn "[Server] Unknown server '#{value}', falling back to #{default_value} "
48
+ default_value
49
+ end
49
50
  end
50
51
  end
51
52
 
@@ -76,7 +77,7 @@ module ShellEv
76
77
  max_retries: 0, retry_interval: 1, backoff_factor: 2,
77
78
  retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
78
79
  retry_methods: %i[get put], http_callback: nil, proxy_settings: nil,
79
- environment: Environment::PRODUCTION, o_auth_client_id: nil,
80
+ environment: Environment::SIT, o_auth_client_id: nil,
80
81
  o_auth_client_secret: nil, o_auth_token: nil,
81
82
  client_credentials_auth_credentials: nil
82
83
  )
@@ -171,17 +172,13 @@ module ShellEv
171
172
 
172
173
  # All the environments the SDK can run in.
173
174
  ENVIRONMENTS = {
174
- Environment::PRODUCTION => {
175
- Server::DEFAULT => 'https://api.shell.com/ev'
176
- },
177
- Environment::ENVIRONMENT2 => {
178
- Server::DEFAULT => 'https://api.shell.com/v2/oauth'
175
+ Environment::SIT => {
176
+ Server::OAUTH_SERVER => 'https://api-test.shell.com',
177
+ Server::SHELL => 'https://api-test.shell.com/ev'
179
178
  },
180
- Environment::ENVIRONMENT3 => {
181
- Server::DEFAULT => 'https://api-test.shell.com/ev'
182
- },
183
- Environment::ENVIRONMENT4 => {
184
- Server::DEFAULT => 'https://api-test.shell.com/v2/oauth'
179
+ Environment::PRODUCTION => {
180
+ Server::OAUTH_SERVER => 'https://api.shell.com',
181
+ Server::SHELL => 'https://api.shell.com/ev'
185
182
  }
186
183
  }.freeze
187
184
 
@@ -189,14 +186,14 @@ module ShellEv
189
186
  # @param [Configuration::Server] server The server enum for which the base URI is
190
187
  # required.
191
188
  # @return [String] The base URI.
192
- def get_base_uri(server = Server::DEFAULT)
189
+ def get_base_uri(server = Server::SHELL)
193
190
  ENVIRONMENTS[environment][server].clone
194
191
  end
195
192
 
196
193
  # Builds a Configuration instance using environment variables.
197
194
  def self.build_default_config_from_env
198
195
  # === Core environment ===
199
- environment = Environment.from_value(ENV.fetch('ENVIRONMENT', 'production'))
196
+ environment = Environment.from_value(ENV.fetch('ENVIRONMENT', 'sit'))
200
197
  timeout = (ENV['TIMEOUT'] || 60).to_f
201
198
  max_retries = (ENV['MAX_RETRIES'] || 0).to_i
202
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::DEFAULT)
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::DEFAULT)
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::DEFAULT)
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::DEFAULT)
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::DEFAULT)
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::DEFAULT)
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::DEFAULT)
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::DEFAULT)
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::DEFAULT)
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.0.0
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-15 00:00:00.000000000 Z
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