ev-recharge-sdk 2.0.0 → 2.1.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: bd72057f64494064e86dc04b92918f198d90409cf47f740184a7fbf2f90f4380
4
+ data.tar.gz: 2c37041369b8553fa82e16c5cfb6bb12d36d1b9a8a17ada128cf39eca49394a1
5
5
  SHA512:
6
- metadata.gz: 66f6c2129184aef4a408ed295f57fb5c240aadfbd83dff699a3cb0e73bfaa480170a1cf18cd7c336afdd4852193b8b1566628513a45ae0d2185221f3fae2800f
7
- data.tar.gz: 6e87e57762e2a3c3ec0cae304cee477db56707f7e8b77c06cd7227dd96aa92385c0c399b4d97e16df13a15bcd1ca535cbab4a75cc7b82447cf7e5ab624313f7d
6
+ metadata.gz: 37bca8e2855c5c0d13484275ef474386d7ade5d9977e5fdcdd26777c7f7b0e5cd4b5adc33ba043825e0c1e6a9771108c52979af718599917d3dc03de3a36e9f5
7
+ data.tar.gz: 109ed1f247ce691638198a82443290c76a0cecb4cea0c957dadaf9e339091ac58e5c3d91ce6510647a29a9b3c51d223d57ae68f854fd16ad4b6e479c4d330ebc
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.1.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.1.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.1.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.1.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.1.0/README.md#environments) | The API environment. <br> **Default: `Environment.PRODUCTION`** |
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.1.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.1.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
 
@@ -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.1.0/doc/environment-based-client-initialization.md) section for details.
134
134
 
135
135
  ## Environments
136
136
 
@@ -141,35 +141,33 @@ The SDK can be configured to use a different environment for making API calls. A
141
141
  | Name | Description |
142
142
  | --- | --- |
143
143
  | PRODUCTION | **Default** Production Server |
144
- | ENVIRONMENT2 | Production Server |
145
- | ENVIRONMENT3 | Test Server |
146
- | ENVIRONMENT4 | Test Server |
144
+ | ENVIRONMENT2 | Test Server |
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.1.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.1.0/doc/controllers/locations.md)
155
+ * [Charging](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/2.1.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.1.0/doc/proxy-settings.md)
162
+ * [Environment-Based Client Initialization](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/2.1.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.1.0/doc/http-response.md)
167
+ * [HttpRequest](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/2.1.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.1.0/doc/api-helper.md)
172
+ * [DateTimeHelper](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/2.1.0/doc/date-time-helper.md)
175
173
 
@@ -7,14 +7,10 @@ module ShellEv
7
7
  # An enum for SDK environments.
8
8
  class Environment
9
9
  # PRODUCTION: Production Server
10
- # ENVIRONMENT2: Production Server
11
- # ENVIRONMENT3: Test Server
12
- # ENVIRONMENT4: Test Server
10
+ # ENVIRONMENT2: Test Server
13
11
  ENVIRONMENT = [
14
12
  PRODUCTION = 'production'.freeze,
15
- ENVIRONMENT2 = 'environment2'.freeze,
16
- ENVIRONMENT3 = 'environment3'.freeze,
17
- ENVIRONMENT4 = 'environment4'.freeze
13
+ ENVIRONMENT2 = 'environment2'.freeze
18
14
  ].freeze
19
15
 
20
16
  # Converts a string or symbol into a valid Environment constant.
@@ -25,8 +21,6 @@ module ShellEv
25
21
  case str
26
22
  when 'production' then PRODUCTION
27
23
  when 'environment2' then ENVIRONMENT2
28
- when 'environment3' then ENVIRONMENT3
29
- when 'environment4' then ENVIRONMENT4
30
24
 
31
25
  else
32
26
  warn "[Environment] Unknown environment '#{value}', falling back to #{default_value} "
@@ -38,14 +32,23 @@ module ShellEv
38
32
  # An enum for API servers.
39
33
  class Server
40
34
  SERVER = [
41
- DEFAULT = 'default'.freeze
35
+ DEFAULT = 'default'.freeze,
36
+ ACCESS_TOKEN_SERVER = 'access token server'.freeze
42
37
  ].freeze
43
38
 
44
39
  # Converts a string or symbol into a valid Server constant.
45
40
  def self.from_value(value, default_value = DEFAULT)
46
41
  return default_value if value.nil?
47
42
 
48
- default_value
43
+ str = value.to_s.strip.downcase
44
+ case str
45
+ when 'default' then DEFAULT
46
+ when 'access_token_server' then ACCESS_TOKEN_SERVER
47
+
48
+ else
49
+ warn "[Server] Unknown server '#{value}', falling back to #{default_value} "
50
+ default_value
51
+ end
49
52
  end
50
53
  end
51
54
 
@@ -172,16 +175,12 @@ module ShellEv
172
175
  # All the environments the SDK can run in.
173
176
  ENVIRONMENTS = {
174
177
  Environment::PRODUCTION => {
175
- Server::DEFAULT => 'https://api.shell.com/ev'
178
+ Server::DEFAULT => 'https://api.shell.com/ev',
179
+ Server::ACCESS_TOKEN_SERVER => 'https://api.shell.com/v2/oauth'
176
180
  },
177
181
  Environment::ENVIRONMENT2 => {
178
- Server::DEFAULT => 'https://api.shell.com/v2/oauth'
179
- },
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'
182
+ Server::DEFAULT => 'https://api-test.shell.com/ev',
183
+ Server::ACCESS_TOKEN_SERVER => 'https://api.shell.com/v2/oauth'
185
184
  }
186
185
  }.freeze
187
186
 
@@ -20,7 +20,7 @@ module ShellEv
20
20
  @api_call
21
21
  .request(new_request_builder(HttpMethodEnum::POST,
22
22
  '/token',
23
- Server::DEFAULT)
23
+ Server::ACCESS_TOKEN_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,7 +1,7 @@
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.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - developer sdksio