ev-recharge-sdk 1.4.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.
Files changed (113) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -1
  3. data/README.md +89 -25
  4. data/bin/console +15 -0
  5. data/lib/shell_ev/api_helper.rb +2 -2
  6. data/lib/shell_ev/client.rb +15 -4
  7. data/lib/shell_ev/configuration.rb +81 -9
  8. data/lib/shell_ev/controllers/base_controller.rb +3 -9
  9. data/lib/shell_ev/controllers/charging_controller.rb +19 -18
  10. data/lib/shell_ev/controllers/locations_controller.rb +48 -50
  11. data/lib/shell_ev/controllers/o_auth_authorization_controller.rb +4 -4
  12. data/lib/shell_ev/exceptions/api_exception.rb +2 -2
  13. data/lib/shell_ev/exceptions/bad_request_exception.rb +7 -5
  14. data/lib/shell_ev/exceptions/internal_server_error_exception.rb +7 -5
  15. data/lib/shell_ev/exceptions/not_found_exception.rb +7 -5
  16. data/lib/shell_ev/exceptions/o_auth_provider_exception.rb +7 -5
  17. data/lib/shell_ev/exceptions/serviceunavailable_exception.rb +7 -5
  18. data/lib/shell_ev/exceptions/too_many_requests_exception.rb +7 -5
  19. data/lib/shell_ev/exceptions/unauthorized_exception.rb +7 -5
  20. data/lib/shell_ev/exceptions/v2_charge_session_retrieve404_error_exception.rb +67 -0
  21. data/lib/shell_ev/exceptions/v2_charge_session_start404_error_exception.rb +67 -0
  22. data/lib/shell_ev/exceptions/v2_charge_session_stop404_error_exception.rb +67 -0
  23. data/lib/shell_ev/http/auth/o_auth2.rb +18 -3
  24. data/lib/shell_ev/http/http_call_back.rb +2 -2
  25. data/lib/shell_ev/http/http_method_enum.rb +2 -2
  26. data/lib/shell_ev/http/http_request.rb +2 -2
  27. data/lib/shell_ev/http/http_response.rb +2 -2
  28. data/lib/shell_ev/http/proxy_settings.rb +22 -0
  29. data/lib/shell_ev/models/accessibility_status_enum.rb +17 -2
  30. data/lib/shell_ev/models/{accessibility.rb → accessibility_v2.rb} +7 -16
  31. data/lib/shell_ev/models/active_response200_json.rb +2 -2
  32. data/lib/shell_ev/models/active_response200_json_status_enum.rb +15 -2
  33. data/lib/shell_ev/models/address.rb +2 -2
  34. data/lib/shell_ev/models/bad_request_err_msg.rb +2 -2
  35. data/lib/shell_ev/models/base_model.rb +2 -2
  36. data/lib/shell_ev/models/charge_error.rb +2 -2
  37. data/lib/shell_ev/models/charge_retrieve_state.rb +2 -2
  38. data/lib/shell_ev/models/chargesession_start_body.rb +2 -2
  39. data/lib/shell_ev/models/connector_types_enum.rb +100 -0
  40. data/lib/shell_ev/models/connector_v2.rb +95 -0
  41. data/lib/shell_ev/models/connector_vo_connector_type_enum.rb +31 -2
  42. data/lib/shell_ev/models/connector_vo_updated_by_enum.rb +17 -2
  43. data/lib/shell_ev/models/coordinates.rb +2 -2
  44. data/lib/shell_ev/models/coordinates1.rb +81 -0
  45. data/lib/shell_ev/models/data_active.rb +2 -2
  46. data/lib/shell_ev/models/data_retrieve.rb +2 -2
  47. data/lib/shell_ev/models/day_of_week_enum.rb +56 -0
  48. data/lib/shell_ev/models/electrical_properties_power_type_enum.rb +16 -2
  49. data/lib/shell_ev/models/{electrical_properties.rb → electrical_properties_v2.rb} +8 -8
  50. data/lib/shell_ev/models/evse_status_enum.rb +44 -0
  51. data/lib/shell_ev/models/{evse_vo.rb → evse_v2.rb} +33 -43
  52. data/lib/shell_ev/models/evse_vo_authorization_methods_enum.rb +16 -2
  53. data/lib/shell_ev/models/evse_vo_status_enum.rb +17 -2
  54. data/lib/shell_ev/models/get_charge_session_retrieve_response200_json.rb +2 -2
  55. data/lib/shell_ev/models/get_charge_session_retrieve_response200_json_status_enum.rb +15 -2
  56. data/lib/shell_ev/models/get_ev_locations_authorization_methods_enum.rb +16 -2
  57. data/lib/shell_ev/models/get_ev_locations_connector_types_enum.rb +31 -2
  58. data/lib/shell_ev/models/get_ev_locations_evse_status_enum.rb +17 -2
  59. data/lib/shell_ev/models/inline_response202.rb +4 -6
  60. data/lib/shell_ev/models/inline_response2021.rb +2 -2
  61. data/lib/shell_ev/models/inline_response2021_status_enum.rb +15 -2
  62. data/lib/shell_ev/models/inline_response202_data.rb +2 -2
  63. data/lib/shell_ev/models/inline_response202_status_enum.rb +15 -2
  64. data/lib/shell_ev/models/internal_error_object.rb +2 -2
  65. data/lib/shell_ev/models/{location_respone_object.rb → location_respone_object_v2.rb} +46 -34
  66. data/lib/shell_ev/models/locations_markers_authorization_methods_enum.rb +16 -2
  67. data/lib/shell_ev/models/locations_markers_connector_types_enum.rb +31 -2
  68. data/lib/shell_ev/models/locations_markers_evse_status_enum.rb +17 -2
  69. data/lib/shell_ev/models/multi_location_marker.rb +5 -5
  70. data/lib/shell_ev/models/multi_location_marker_v2.rb +126 -0
  71. data/lib/shell_ev/models/nearby_locations_authorization_methods_enum.rb +16 -2
  72. data/lib/shell_ev/models/nearby_locations_connector_types_enum.rb +31 -2
  73. data/lib/shell_ev/models/nearby_locations_evse_status_enum.rb +17 -2
  74. data/lib/shell_ev/models/not_found_err_msg.rb +2 -2
  75. data/lib/shell_ev/models/o_auth_provider_error_enum.rb +19 -2
  76. data/lib/shell_ev/models/o_auth_token.rb +2 -2
  77. data/lib/shell_ev/models/opening_hours_object.rb +3 -3
  78. data/lib/shell_ev/models/opening_hours_object_week_day_enum.rb +20 -2
  79. data/lib/shell_ev/models/power_range.rb +68 -0
  80. data/lib/shell_ev/models/price_component.rb +86 -0
  81. data/lib/shell_ev/models/ratelimit_err_msg.rb +2 -2
  82. data/lib/shell_ev/models/{response.rb → response_v2.rb} +9 -9
  83. data/lib/shell_ev/models/restrictions.rb +183 -0
  84. data/lib/shell_ev/models/search_by_id_connector.rb +115 -0
  85. data/lib/shell_ev/models/search_by_id_evse.rb +145 -0
  86. data/lib/shell_ev/models/search_by_id_location_respone.rb +196 -0
  87. data/lib/shell_ev/models/search_by_id_response.rb +91 -0
  88. data/lib/shell_ev/models/serviceunavailable_err_msg.rb +2 -2
  89. data/lib/shell_ev/models/single_location_marker.rb +8 -6
  90. data/lib/shell_ev/models/single_location_marker_authorization_methods_items_enum.rb +16 -2
  91. data/lib/shell_ev/models/single_location_marker_response.rb +2 -2
  92. data/lib/shell_ev/models/single_location_marker_response_v2.rb +94 -0
  93. data/lib/shell_ev/models/single_location_marker_status_enum.rb +17 -2
  94. data/lib/shell_ev/models/single_location_marker_v2.rb +157 -0
  95. data/lib/shell_ev/models/tariff.rb +3 -3
  96. data/lib/shell_ev/models/tariff_alt_text.rb +68 -0
  97. data/lib/shell_ev/models/tariff_element.rb +80 -0
  98. data/lib/shell_ev/models/tariff_type_enum.rb +44 -0
  99. data/lib/shell_ev/models/tariff_v2.rb +226 -0
  100. data/lib/shell_ev/models/tariff_vo_updated_by_enum.rb +17 -2
  101. data/lib/shell_ev/models/type_enum.rb +44 -0
  102. data/lib/shell_ev/models/unauthorized_err_msg.rb +2 -2
  103. data/lib/shell_ev/utilities/date_time_helper.rb +2 -2
  104. data/lib/shell_ev/utilities/file_wrapper.rb +2 -2
  105. data/lib/shell_ev/utilities/union_type_lookup.rb +19 -2
  106. data/lib/shell_ev.rb +34 -10
  107. data/test/controllers/controller_test_base.rb +5 -10
  108. data/test/controllers/test_charging_controller.rb +7 -11
  109. data/test/controllers/test_locations_controller.rb +8 -11
  110. data/test/http_response_catcher.rb +3 -3
  111. metadata +38 -15
  112. data/lib/shell_ev/models/connector_vo.rb +0 -149
  113. data/lib/shell_ev/models/tariff_vo.rb +0 -124
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5f958a760fdf4430c7366b744e7c56aace6ed34cf48f6ee7a06d938cf947c7dd
4
- data.tar.gz: b8f570f5c8bbe7f0f2dc577867d8f43c59362717015a9ca56f779129efd0254b
3
+ metadata.gz: bd72057f64494064e86dc04b92918f198d90409cf47f740184a7fbf2f90f4380
4
+ data.tar.gz: 2c37041369b8553fa82e16c5cfb6bb12d36d1b9a8a17ada128cf39eca49394a1
5
5
  SHA512:
6
- metadata.gz: ec2964929d7df347bb30519395f465e3b1336acfb5967b5d57e97f237e7544613ffa579bcdc0204a4c43158049652f533de9b7db62ffbcb1ed39ce5118399835
7
- data.tar.gz: 429bffca3aacd25c25ab4a8ed87bc1c6b56007c36e78c25290ce62b01277e021b5200a66b25934e37263944aed23c294a98e6eff8b7859cffa26ea257c05c448
6
+ metadata.gz: 37bca8e2855c5c0d13484275ef474386d7ade5d9977e5fdcdd26777c7f7b0e5cd4b5adc33ba043825e0c1e6a9771108c52979af718599917d3dc03de3a36e9f5
7
+ data.tar.gz: 109ed1f247ce691638198a82443290c76a0cecb4cea0c957dadaf9e339091ac58e5c3d91ce6510647a29a9b3c51d223d57ae68f854fd16ad4b6e479c4d330ebc
data/LICENSE CHANGED
@@ -3,7 +3,7 @@ License:
3
3
  The MIT License (MIT)
4
4
  http://opensource.org/licenses/MIT
5
5
 
6
- Copyright (c) 2014 - 2025 APIMATIC Limited
6
+ Copyright (c) 2014 - 2026 APIMATIC Limited
7
7
 
8
8
  Permission is hereby granted, free of charge, to any person obtaining a copy
9
9
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -28,16 +28,51 @@ 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 1.4.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', '1.4.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/1.4.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
+
42
+ ## IRB Console Usage
43
+
44
+ You can explore the SDK interactively using IRB in two ways
45
+
46
+ ### 1. Use IRB with Installed Gem
47
+
48
+ Open your system terminal (Command Prompt, Git Bash or macOS Terminal) and type the following command to start the irb console.
49
+
50
+ ```bash
51
+ irb
52
+ ```
53
+
54
+ Now you can load the SDK in the IRB
55
+
56
+ ```ruby
57
+ require 'shell_ev'
58
+ include ShellEv
59
+ ```
60
+
61
+ ### 2. Use IRB within SDK
62
+
63
+ Open your system terminal (Command Prompt, Git Bash or macOS Terminal) and navigate to the root folder of SDK.
64
+
65
+ ```
66
+ cd path/to/shell_ev
67
+ ```
68
+
69
+ Now you can start the preconfigured irb console by running the following command
70
+
71
+ ```bash
72
+ ruby bin/console
73
+ ```
74
+
75
+ **_Note:_** This automatically loads the SDK from lib/
41
76
 
42
77
  ## Test the SDK
43
78
 
@@ -49,28 +84,34 @@ rake
49
84
 
50
85
  ## Initialize the API Client
51
86
 
52
- **_Note:_** Documentation for the client can be found [here.](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/1.4.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)
53
88
 
54
89
  The following parameters are configurable for the API Client:
55
90
 
56
91
  | Parameter | Type | Description |
57
92
  | --- | --- | --- |
58
- | `environment` | `Environment` | The API environment. <br> **Default: `Environment.PRODUCTION`** |
59
- | `connection` | `Faraday::Connection` | The Faraday connection object passed by the SDK user for making requests |
60
- | `adapter` | `Faraday::Adapter` | The Faraday adapter object passed by the SDK user for performing http requests |
61
- | `timeout` | `Float` | The value to use for connection timeout. <br> **Default: 60** |
62
- | `max_retries` | `Integer` | The number of times to retry an endpoint call if it fails. <br> **Default: 0** |
63
- | `retry_interval` | `Float` | Pause in seconds between retries. <br> **Default: 1** |
64
- | `backoff_factor` | `Float` | The amount to multiply each successive retry's interval amount by in order to provide backoff. <br> **Default: 2** |
65
- | `retry_statuses` | `Array` | A list of HTTP statuses to retry. <br> **Default: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524]** |
66
- | `retry_methods` | `Array` | A list of HTTP methods to retry. <br> **Default: %i[get put]** |
67
- | `http_callback` | `HttpCallBack` | The Http CallBack allows defining callables for pre and post API calls. |
68
- | `client_credentials_auth_credentials` | [`ClientCredentialsAuthCredentials`](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/1.4.0/doc/auth/oauth-2-client-credentials-grant.md) | The credential object for OAuth 2 Client Credentials Grant |
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
+ | connection | `Faraday::Connection` | The Faraday connection object passed by the SDK user for making requests |
95
+ | adapter | `Faraday::Adapter` | The Faraday adapter object passed by the SDK user for performing http requests |
96
+ | timeout | `Float` | The value to use for connection timeout. <br> **Default: 60** |
97
+ | max_retries | `Integer` | The number of times to retry an endpoint call if it fails. <br> **Default: 0** |
98
+ | retry_interval | `Float` | Pause in seconds between retries. <br> **Default: 1** |
99
+ | backoff_factor | `Float` | The amount to multiply each successive retry's interval amount by in order to provide backoff. <br> **Default: 2** |
100
+ | retry_statuses | `Array` | A list of HTTP statuses to retry. <br> **Default: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524]** |
101
+ | retry_methods | `Array` | A list of HTTP methods to retry. <br> **Default: %i[get put]** |
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.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 |
69
105
 
70
106
  The API client can be initialized as follows:
71
107
 
108
+ ### Code-Based Client Initialization
109
+
72
110
  ```ruby
73
- client = ShellEv::Client.new(
111
+ require 'shell_ev'
112
+ include ShellEv
113
+
114
+ client = Client.new(
74
115
  client_credentials_auth_credentials: ClientCredentialsAuthCredentials.new(
75
116
  o_auth_client_id: 'OAuthClientId',
76
117
  o_auth_client_secret: 'OAuthClientSecret'
@@ -79,6 +120,18 @@ client = ShellEv::Client.new(
79
120
  )
80
121
  ```
81
122
 
123
+ ### Environment-Based Client Initialization
124
+
125
+ ```ruby
126
+ require 'shell_ev'
127
+ include ShellEv
128
+
129
+ # Create client from environment
130
+ client = Client.from_env
131
+ ```
132
+
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
+
82
135
  ## Environments
83
136
 
84
137
  The SDK can be configured to use a different environment for making API calls. Available environments are:
@@ -87,23 +140,34 @@ The SDK can be configured to use a different environment for making API calls. A
87
140
 
88
141
  | Name | Description |
89
142
  | --- | --- |
90
- | production | **Default** Production Server |
91
- | environment2 | Test Server |
143
+ | PRODUCTION | **Default** Production Server |
144
+ | ENVIRONMENT2 | Test Server |
92
145
 
93
146
  ## Authorization
94
147
 
95
148
  This API uses the following authentication schemes.
96
149
 
97
- * [`BearerAuth (OAuth 2 Client Credentials Grant)`](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/1.4.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)
98
151
 
99
152
  ## List of APIs
100
153
 
101
- * [Locations](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/1.4.0/doc/controllers/locations.md)
102
- * [Charging](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/1.4.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)
103
156
 
104
- ## Classes Documentation
157
+ ## SDK Infrastructure
105
158
 
106
- * [Utility Classes](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/1.4.0/doc/utility-classes.md)
107
- * [HttpResponse](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/1.4.0/doc/http-response.md)
108
- * [HttpRequest](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/1.4.0/doc/http-request.md)
159
+ ### Configuration
160
+
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)
163
+
164
+ ### HTTP
165
+
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)
168
+
169
+ ### Utilities
170
+
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)
109
173
 
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # Load the lib folder into Ruby's load path
4
+ $LOAD_PATH.unshift(File.expand_path('../lib', __dir__))
5
+
6
+ # Require the gem
7
+ require 'shell_ev'
8
+
9
+ puts 'ShellEv SDK loaded!'
10
+ puts 'You can now create a client with: client = ShellEv::Client.new'
11
+ puts 'Or use from_env: client = ShellEv::Client.from_env'
12
+
13
+ # Start an interactive IRB session
14
+ require 'irb'
15
+ IRB.start
@@ -1,7 +1,7 @@
1
1
  # shell_ev
2
2
  #
3
- # This file was automatically generated by APIMATIC v2.0
4
- # ( https://apimatic.io ).
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
5
 
6
6
  module ShellEv
7
7
  # API utility class
@@ -1,13 +1,17 @@
1
1
  # shell_ev
2
2
  #
3
- # This file was automatically generated by APIMATIC v2.0
4
- # ( https://apimatic.io ).
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
5
 
6
6
  module ShellEv
7
7
  # shell_ev client class.
8
8
  class Client
9
9
  include CoreLibrary
10
10
  attr_reader :config, :auth_managers
11
+
12
+ def user_agent_detail
13
+ config.user_agent_detail
14
+ end
11
15
 
12
16
  # Returns the configured authentication BearerAuth instance.
13
17
  def bearer_auth
@@ -36,7 +40,7 @@ module ShellEv
36
40
  connection: nil, adapter: :net_http_persistent, timeout: 60,
37
41
  max_retries: 0, retry_interval: 1, backoff_factor: 2,
38
42
  retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
39
- retry_methods: %i[get put], http_callback: nil,
43
+ retry_methods: %i[get put], http_callback: nil, proxy_settings: nil,
40
44
  environment: Environment::PRODUCTION, o_auth_client_id: nil,
41
45
  o_auth_client_secret: nil, o_auth_token: nil,
42
46
  client_credentials_auth_credentials: nil, config: nil
@@ -48,7 +52,7 @@ module ShellEv
48
52
  backoff_factor: backoff_factor,
49
53
  retry_statuses: retry_statuses,
50
54
  retry_methods: retry_methods, http_callback: http_callback,
51
- environment: environment,
55
+ proxy_settings: proxy_settings, environment: environment,
52
56
  o_auth_client_id: o_auth_client_id,
53
57
  o_auth_client_secret: o_auth_client_secret,
54
58
  o_auth_token: o_auth_token,
@@ -77,5 +81,12 @@ module ShellEv
77
81
  http_client_config.client_credentials_auth_credentials, global_config
78
82
  )
79
83
  end
84
+
85
+ # Creates a client directly from environment variables.
86
+ def self.from_env(**overrides)
87
+ default_config = Configuration.build_default_config_from_env
88
+ new_config = default_config.clone_with(**overrides)
89
+ new(config: new_config)
90
+ end
80
91
  end
81
92
  end
@@ -1,7 +1,7 @@
1
1
  # shell_ev
2
2
  #
3
- # This file was automatically generated by APIMATIC v2.0
4
- # ( https://apimatic.io ).
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
5
 
6
6
  module ShellEv
7
7
  # An enum for SDK environments.
@@ -12,6 +12,21 @@ module ShellEv
12
12
  PRODUCTION = 'production'.freeze,
13
13
  ENVIRONMENT2 = 'environment2'.freeze
14
14
  ].freeze
15
+
16
+ # Converts a string or symbol into a valid Environment constant.
17
+ def self.from_value(value, default_value = PRODUCTION)
18
+ return default_value if value.nil?
19
+
20
+ str = value.to_s.strip.downcase
21
+ case str
22
+ when 'production' then PRODUCTION
23
+ when 'environment2' then ENVIRONMENT2
24
+
25
+ else
26
+ warn "[Environment] Unknown environment '#{value}', falling back to #{default_value} "
27
+ default_value
28
+ end
29
+ end
15
30
  end
16
31
 
17
32
  # An enum for API servers.
@@ -20,6 +35,21 @@ module ShellEv
20
35
  DEFAULT = 'default'.freeze,
21
36
  ACCESS_TOKEN_SERVER = 'access token server'.freeze
22
37
  ].freeze
38
+
39
+ # Converts a string or symbol into a valid Server constant.
40
+ def self.from_value(value, default_value = DEFAULT)
41
+ return default_value if value.nil?
42
+
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
52
+ end
23
53
  end
24
54
 
25
55
  # All configuration including auth info and base URI for the API access
@@ -48,16 +78,16 @@ module ShellEv
48
78
  connection: nil, adapter: :net_http_persistent, timeout: 60,
49
79
  max_retries: 0, retry_interval: 1, backoff_factor: 2,
50
80
  retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
51
- retry_methods: %i[get put], http_callback: nil,
81
+ retry_methods: %i[get put], http_callback: nil, proxy_settings: nil,
52
82
  environment: Environment::PRODUCTION, o_auth_client_id: nil,
53
83
  o_auth_client_secret: nil, o_auth_token: nil,
54
84
  client_credentials_auth_credentials: nil
55
85
  )
56
-
57
86
  super connection: connection, adapter: adapter, timeout: timeout,
58
87
  max_retries: max_retries, retry_interval: retry_interval,
59
88
  backoff_factor: backoff_factor, retry_statuses: retry_statuses,
60
- retry_methods: retry_methods, http_callback: http_callback
89
+ retry_methods: retry_methods, http_callback: http_callback,
90
+ proxy_settings: proxy_settings
61
91
 
62
92
  # Current API environment
63
93
  @environment = String(environment)
@@ -88,7 +118,7 @@ module ShellEv
88
118
  def clone_with(connection: nil, adapter: nil, timeout: nil,
89
119
  max_retries: nil, retry_interval: nil, backoff_factor: nil,
90
120
  retry_statuses: nil, retry_methods: nil, http_callback: nil,
91
- environment: nil, o_auth_client_id: nil,
121
+ proxy_settings: nil, environment: nil, o_auth_client_id: nil,
92
122
  o_auth_client_secret: nil, o_auth_token: nil,
93
123
  client_credentials_auth_credentials: nil)
94
124
  connection ||= self.connection
@@ -100,6 +130,7 @@ module ShellEv
100
130
  retry_statuses ||= self.retry_statuses
101
131
  retry_methods ||= self.retry_methods
102
132
  http_callback ||= self.http_callback
133
+ proxy_settings ||= self.proxy_settings
103
134
  environment ||= self.environment
104
135
  client_credentials_auth_credentials = create_auth_credentials_object(
105
136
  o_auth_client_id, o_auth_client_secret, o_auth_token,
@@ -111,7 +142,7 @@ module ShellEv
111
142
  max_retries: max_retries, retry_interval: retry_interval,
112
143
  backoff_factor: backoff_factor, retry_statuses: retry_statuses,
113
144
  retry_methods: retry_methods, http_callback: http_callback,
114
- environment: environment,
145
+ proxy_settings: proxy_settings, environment: environment,
115
146
  client_credentials_auth_credentials: client_credentials_auth_credentials
116
147
  )
117
148
  end
@@ -144,11 +175,11 @@ module ShellEv
144
175
  # All the environments the SDK can run in.
145
176
  ENVIRONMENTS = {
146
177
  Environment::PRODUCTION => {
147
- Server::DEFAULT => 'https://api.shell.com/ev/v1',
178
+ Server::DEFAULT => 'https://api.shell.com/ev',
148
179
  Server::ACCESS_TOKEN_SERVER => 'https://api.shell.com/v2/oauth'
149
180
  },
150
181
  Environment::ENVIRONMENT2 => {
151
- Server::DEFAULT => 'https://api-test.shell.com/ev/v1',
182
+ Server::DEFAULT => 'https://api-test.shell.com/ev',
152
183
  Server::ACCESS_TOKEN_SERVER => 'https://api.shell.com/v2/oauth'
153
184
  }
154
185
  }.freeze
@@ -160,5 +191,46 @@ module ShellEv
160
191
  def get_base_uri(server = Server::DEFAULT)
161
192
  ENVIRONMENTS[environment][server].clone
162
193
  end
194
+
195
+ # Builds a Configuration instance using environment variables.
196
+ def self.build_default_config_from_env
197
+ # === Core environment ===
198
+ environment = Environment.from_value(ENV.fetch('ENVIRONMENT', 'production'))
199
+ timeout = (ENV['TIMEOUT'] || 60).to_f
200
+ max_retries = (ENV['MAX_RETRIES'] || 0).to_i
201
+ retry_interval = (ENV['RETRY_INTERVAL'] || 1).to_f
202
+ backoff_factor = (ENV['BACKOFF_FACTOR'] || 2).to_f
203
+ retry_statuses = ENV.fetch('RETRY_STATUSES',
204
+ '[408, 413, 429, 500, 502, 503, 504, 521, 522, 524]').gsub(/[\[\]]/, '')
205
+ .split(',')
206
+ .map(&:strip)
207
+ .map do |item|
208
+ item.match?(/\A\d+\z/) ? item.to_i : item.downcase
209
+ end
210
+ retry_methods = ENV.fetch('RETRY_METHODS', '%i[get put]').gsub(/[\[\]]/, '')
211
+ .split(',')
212
+ .map(&:strip)
213
+ .map do |item|
214
+ item.match?(/\A\d+\z/) ? item.to_i : item.downcase
215
+ end
216
+
217
+ # === Authentication credentials ===
218
+ client_credentials_auth_credentials = ClientCredentialsAuthCredentials.from_env
219
+
220
+ # === Proxy settings ===
221
+ proxy_settings = ProxySettings.from_env
222
+
223
+ Configuration.new(
224
+ environment: environment,
225
+ timeout: timeout,
226
+ max_retries: max_retries,
227
+ retry_interval: retry_interval,
228
+ backoff_factor: backoff_factor,
229
+ retry_statuses: retry_statuses,
230
+ retry_methods: retry_methods,
231
+ client_credentials_auth_credentials: client_credentials_auth_credentials,
232
+ proxy_settings: proxy_settings
233
+ )
234
+ end
163
235
  end
164
236
  end
@@ -1,7 +1,7 @@
1
1
  # shell_ev
2
2
  #
3
- # This file was automatically generated by APIMATIC v2.0
4
- # ( https://apimatic.io ).
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
5
 
6
6
  module ShellEv
7
7
  # BaseController.
@@ -26,13 +26,7 @@ module ShellEv
26
26
  @global_configuration = global_configuration
27
27
  @config = @global_configuration.client_configuration
28
28
  @http_call_back = @config.http_callback
29
- @api_call = ApiCall.new(@global_configuration)
30
- end
31
-
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
29
+ @api_call = ApiCall.new(@global_configuration)
36
30
  end
37
31
 
38
32
  # Creates a new instance of the request builder.
@@ -1,7 +1,7 @@
1
1
  # shell_ev
2
2
  #
3
- # This file was automatically generated by APIMATIC v2.0
4
- # ( https://apimatic.io ).
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
5
 
6
6
  module ShellEv
7
7
  # ChargingController
@@ -14,13 +14,14 @@ module ShellEv
14
14
  # digits, displayed in five groups separated by hyphens, in the form
15
15
  # 8-4-4-4-12 for a total of 36 characters (32 hexadecimal characters and 4
16
16
  # hyphens) <br>
17
- # @param [ChargesessionStartBody] body Optional parameter: Example:
18
- # @return [InlineResponse202] response from the API call.
17
+ # @param [ChargesessionStartBody] body Optional parameter: TODO: type
18
+ # description here
19
+ # @return [InlineResponse202] Response from the API call.
19
20
  def start(request_id,
20
21
  body: nil)
21
- new_api_call_builder
22
+ @api_call
22
23
  .request(new_request_builder(HttpMethodEnum::POST,
23
- '/charge-session/start',
24
+ '/v2/charge-session/start',
24
25
  Server::DEFAULT)
25
26
  .header_param(new_parameter(request_id, key: 'RequestId'))
26
27
  .header_param(new_parameter('application/json', key: 'Content-Type'))
@@ -43,7 +44,7 @@ module ShellEv
43
44
  UnauthorizedException)
44
45
  .local_error('404',
45
46
  'Location Not Found',
46
- NotFoundException)
47
+ V2ChargeSessionStart404ErrorException)
47
48
  .local_error('429',
48
49
  'The Request reached maximum allocated rate limit',
49
50
  TooManyRequestsException)
@@ -66,12 +67,12 @@ module ShellEv
66
67
  # 8-4-4-4-12 for a total of 36 characters (32 hexadecimal characters and 4
67
68
  # hyphens) <br>
68
69
  # @param [String] session_id Required parameter: Session Id
69
- # @return [InlineResponse2021] response from the API call.
70
+ # @return [InlineResponse2021] Response from the API call.
70
71
  def stop(request_id,
71
72
  session_id)
72
- new_api_call_builder
73
+ @api_call
73
74
  .request(new_request_builder(HttpMethodEnum::POST,
74
- '/charge-session/stop',
75
+ '/v2/charge-session/stop',
75
76
  Server::DEFAULT)
76
77
  .header_param(new_parameter(request_id, key: 'RequestId'))
77
78
  .query_param(new_parameter(session_id, key: 'sessionId'))
@@ -92,7 +93,7 @@ module ShellEv
92
93
  UnauthorizedException)
93
94
  .local_error('404',
94
95
  'Location Not Found',
95
- NotFoundException)
96
+ V2ChargeSessionStop404ErrorException)
96
97
  .local_error('429',
97
98
  'The Request reached maximum allocated rate limit',
98
99
  TooManyRequestsException)
@@ -114,12 +115,12 @@ module ShellEv
114
115
  # 8-4-4-4-12 for a total of 36 characters (32 hexadecimal characters and 4
115
116
  # hyphens) <br>
116
117
  # @param [String] session_id Required parameter: Session Id
117
- # @return [GetChargeSessionRetrieveResponse200Json] response from the API call.
118
+ # @return [GetChargeSessionRetrieveResponse200Json] Response from the API call.
118
119
  def get_charge_session_retrieve(request_id,
119
120
  session_id)
120
- new_api_call_builder
121
+ @api_call
121
122
  .request(new_request_builder(HttpMethodEnum::GET,
122
- '/charge-session/retrieve',
123
+ '/v2/charge-session/retrieve',
123
124
  Server::DEFAULT)
124
125
  .header_param(new_parameter(request_id, key: 'RequestId'))
125
126
  .query_param(new_parameter(session_id, key: 'sessionId'))
@@ -140,7 +141,7 @@ module ShellEv
140
141
  UnauthorizedException)
141
142
  .local_error('404',
142
143
  'Location Not Found',
143
- NotFoundException)
144
+ V2ChargeSessionRetrieve404ErrorException)
144
145
  .local_error('429',
145
146
  'The Request reached maximum allocated rate limit',
146
147
  TooManyRequestsException)
@@ -163,12 +164,12 @@ module ShellEv
163
164
  # hyphens) <br>
164
165
  # @param [String] ema_id Required parameter: Emobility Account
165
166
  # Identifier(Ema-ID)
166
- # @return [ActiveResponse200Json] response from the API call.
167
+ # @return [ActiveResponse200Json] Response from the API call.
167
168
  def active(request_id,
168
169
  ema_id)
169
- new_api_call_builder
170
+ @api_call
170
171
  .request(new_request_builder(HttpMethodEnum::GET,
171
- '/charge-session/active',
172
+ '/v2/charge-session/active',
172
173
  Server::DEFAULT)
173
174
  .header_param(new_parameter(request_id, key: 'RequestId'))
174
175
  .query_param(new_parameter(ema_id, key: 'emaId'))