ev-recharge-sdk 1.0.0 → 1.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 (91) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +38 -21
  3. data/lib/shell_ev/client.rb +8 -8
  4. data/lib/shell_ev/configuration.rb +13 -17
  5. data/lib/shell_ev/controllers/base_controller.rb +9 -9
  6. data/lib/shell_ev/controllers/charging_controller.rb +121 -154
  7. data/lib/shell_ev/controllers/locations_controller.rb +226 -142
  8. data/lib/shell_ev/controllers/o_auth_authorization_controller.rb +8 -8
  9. data/lib/shell_ev/exceptions/bad_request_exception.rb +33 -18
  10. data/lib/shell_ev/exceptions/{m405_error_response_error1_exception.rb → internal_server_error_exception.rb} +31 -26
  11. data/lib/shell_ev/exceptions/not_found_exception.rb +36 -19
  12. data/lib/shell_ev/exceptions/o_auth_provider_exception.rb +15 -15
  13. data/lib/shell_ev/exceptions/{m400_error_response_error1_exception.rb → serviceunavailable_exception.rb} +28 -28
  14. data/lib/shell_ev/exceptions/{m401_error_response_error1_exception.rb → too_many_requests_exception.rb} +28 -28
  15. data/lib/shell_ev/exceptions/unauthorized_exception.rb +32 -18
  16. data/lib/shell_ev/http/auth/o_auth2.rb +54 -10
  17. data/lib/shell_ev/models/accessibility.rb +1 -2
  18. data/lib/shell_ev/models/active_response200_json.rb +11 -13
  19. data/lib/shell_ev/models/address.rb +1 -3
  20. data/lib/shell_ev/models/bad_request_err_msg.rb +82 -0
  21. data/lib/shell_ev/models/{stop_charge_session_request_body_json.rb → charge_error.rb} +21 -10
  22. data/lib/shell_ev/models/charge_retrieve_state.rb +63 -0
  23. data/lib/shell_ev/models/chargesession_start_body.rb +7 -9
  24. data/lib/shell_ev/models/connector_vo.rb +4 -9
  25. data/lib/shell_ev/models/coordinates.rb +1 -2
  26. data/lib/shell_ev/models/data_active.rb +27 -45
  27. data/lib/shell_ev/models/data_retrieve.rb +31 -49
  28. data/lib/shell_ev/models/electrical_properties.rb +1 -3
  29. data/lib/shell_ev/models/evse_vo.rb +3 -8
  30. data/lib/shell_ev/models/get_charge_session_retrieve_response200_json.rb +11 -13
  31. data/lib/shell_ev/models/{get_markers_list_authorization_methods_enum.rb → get_ev_locations_authorization_methods_enum.rb} +4 -4
  32. data/lib/shell_ev/models/{get_markers_list_connector_types_enum.rb → get_ev_locations_connector_types_enum.rb} +4 -4
  33. data/lib/shell_ev/models/{get_markers_list_evse_status_enum.rb → get_ev_locations_evse_status_enum.rb} +4 -4
  34. data/lib/shell_ev/models/inline_response202.rb +9 -11
  35. data/lib/shell_ev/models/inline_response2021.rb +5 -6
  36. data/lib/shell_ev/models/inline_response202_data.rb +7 -5
  37. data/lib/shell_ev/models/internal_error_object.rb +70 -0
  38. data/lib/shell_ev/models/location_respone_object.rb +4 -11
  39. data/lib/shell_ev/models/{get_locations_list_authorization_methods_enum.rb → locations_markers_authorization_methods_enum.rb} +4 -4
  40. data/lib/shell_ev/models/{get_locations_list_connector_types_enum.rb → locations_markers_connector_types_enum.rb} +4 -4
  41. data/lib/shell_ev/models/{get_locations_list_evse_status_enum.rb → locations_markers_evse_status_enum.rb} +4 -4
  42. data/lib/shell_ev/models/multi_location_marker.rb +2 -6
  43. data/lib/shell_ev/models/{get_nearby_locations_authorization_methods_enum.rb → nearby_locations_authorization_methods_enum.rb} +4 -4
  44. data/lib/shell_ev/models/{get_nearby_locations_connector_types_enum.rb → nearby_locations_connector_types_enum.rb} +4 -4
  45. data/lib/shell_ev/models/{get_nearby_locations_evse_status_enum.rb → nearby_locations_evse_status_enum.rb} +4 -4
  46. data/lib/shell_ev/models/not_found_err_msg.rb +82 -0
  47. data/lib/shell_ev/models/o_auth_token.rb +2 -6
  48. data/lib/shell_ev/models/opening_hours_object.rb +1 -3
  49. data/lib/shell_ev/models/ratelimit_err_msg.rb +82 -0
  50. data/lib/shell_ev/models/response.rb +78 -0
  51. data/lib/shell_ev/models/serviceunavailable_err_msg.rb +82 -0
  52. data/lib/shell_ev/models/single_location_marker.rb +5 -11
  53. data/lib/shell_ev/models/single_location_marker_authorization_methods_items_enum.rb +1 -1
  54. data/lib/shell_ev/models/single_location_marker_response.rb +81 -0
  55. data/lib/shell_ev/models/tariff_vo.rb +3 -7
  56. data/lib/shell_ev/models/unauthorized_err_msg.rb +82 -0
  57. data/lib/shell_ev/utilities/file_wrapper.rb +9 -9
  58. data/lib/shell_ev/utilities/union_type_lookup.rb +3 -2
  59. data/lib/shell_ev.rb +40 -60
  60. data/test/controllers/controller_test_base.rb +0 -5
  61. data/test/controllers/test_charging_controller.rb +74 -17
  62. data/test/controllers/test_locations_controller.rb +65 -0
  63. metadata +31 -49
  64. data/lib/shell_ev/exceptions/http401_error_response_exception.rb +0 -52
  65. data/lib/shell_ev/exceptions/m404_error_response_error1_exception.rb +0 -53
  66. data/lib/shell_ev/exceptions/m429_error_response_error1_exception.rb +0 -52
  67. data/lib/shell_ev/exceptions/m500_error_response_error1_exception.rb +0 -52
  68. data/lib/shell_ev/exceptions/m503_error_response_error1_exception.rb +0 -52
  69. data/lib/shell_ev/models/data_active_session_code_enum.rb +0 -44
  70. data/lib/shell_ev/models/data_active_session_state_enum.rb +0 -35
  71. data/lib/shell_ev/models/data_retrieve_session_code_enum.rb +0 -44
  72. data/lib/shell_ev/models/data_retrieve_session_state_enum.rb +0 -35
  73. data/lib/shell_ev/models/env_enum.rb +0 -23
  74. data/lib/shell_ev/models/m400_error_response.rb +0 -78
  75. data/lib/shell_ev/models/m400_error_response_error.rb +0 -80
  76. data/lib/shell_ev/models/m401_error_response.rb +0 -78
  77. data/lib/shell_ev/models/m401_error_response_error.rb +0 -80
  78. data/lib/shell_ev/models/m404_error_response.rb +0 -79
  79. data/lib/shell_ev/models/m404_error_response_error.rb +0 -80
  80. data/lib/shell_ev/models/m405_error_response.rb +0 -78
  81. data/lib/shell_ev/models/m405_error_response_error.rb +0 -80
  82. data/lib/shell_ev/models/m429_error_response.rb +0 -78
  83. data/lib/shell_ev/models/m429_error_response_error.rb +0 -80
  84. data/lib/shell_ev/models/m500_error_response.rb +0 -78
  85. data/lib/shell_ev/models/m500_error_response_error.rb +0 -80
  86. data/lib/shell_ev/models/m503_error_response.rb +0 -78
  87. data/lib/shell_ev/models/m503_error_response_error.rb +0 -80
  88. data/lib/shell_ev/models/response_base_status_enum.rb +0 -26
  89. data/lib/shell_ev/models/response_error401_all_of1.rb +0 -57
  90. data/lib/shell_ev/models/response_error401_all_of1_errors_items.rb +0 -80
  91. 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: b91582bc1739f9e24f85bc8815b4904c3c3aa4887dc4e4d986cb79508f3afeea
4
- data.tar.gz: 291214a251e8dc918b7f727336bb253e33129bf0c45252db46c47fa95770c1e1
3
+ metadata.gz: 0ca475d6391b018b580ab5ab4e9b0d8edc441fcdbedc4efb0b384fc18b2622c9
4
+ data.tar.gz: c103f47f6e71284c4d80d992c28270165bb484ad3118e615b08336f5bd1bbd2b
5
5
  SHA512:
6
- metadata.gz: a4f42064d469f193a69b9fabc12b4e8b75dd00ce17130371fd240c15504b73f076b78d1f744c73049c0f32d82b21432eb0c29e8192cad8f57509ab1558b41e5a
7
- data.tar.gz: e82d3a275a00e2e7239eefe970d53a4693bbe51af74619592dfdfd275aec9a508492fee569f7314eaf3a8c7e9729d1be8a94f94744fc6ff6fe46323f210c2113
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 option to manage charging at all public Shell Recharge locations. The end points provides control to start, stop and get status of the charging session.
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 Function
8
+ Supported Functions
9
9
 
10
- * Start a charging session
11
- * Stop a charging session
12
- * Retrieve the status of a charging session
13
- * Retrieve the list of all active sessions for a card termsOfService: 'https://developer.shell.com/terms-of-use'
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.0.0
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.0.0'
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.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/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.0.0/doc/client.md)
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.0.0/doc/$a/https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/1.0.0/oauth-2-client-credentials-grant.md) | The credential object for OAuth 2 Client Credentials Grant |
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.0.0/doc/$a/https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/1.0.0/oauth-2-client-credentials-grant.md)
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
- * [O Auth Authorization](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/1.0.0/doc/controllers/o-auth-authorization.md)
84
- * [Charging](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/1.0.0/doc/controllers/charging.md)
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.0.0/doc/utility-classes.md)
90
- * [HttpResponse](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/1.0.0/doc/http-response.md)
91
- * [HttpRequest](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/1.0.0/doc/http-request.md)
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
 
@@ -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, env: EnvEnum::ENUM_APITESTSHELLCOM,
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, env: env,
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, :env, :client_credentials_auth_credentials
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, env: EnvEnum::ENUM_APITESTSHELLCOM,
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, env: 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, env: env,
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://{env}'
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
- parameters = {
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 API initiates to start a session on a EVSE (Electric Vehicle Supply
10
- # Equipement). When the EV Charge Card number and the unique EVSE ID on the
11
- # location is provided, the session is initiated.
12
- # Please note that this is an asynchronous request, the request will be
13
- # passed on to the operator/platform to be processed further.
14
- # @param [UUID | String] request_id Required parameter: A unique request id
15
- # in GUID format. The value is written to the Shell API Platform audit log
16
- # for end to end traceability of a request.
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 start_charge_session(request_id,
20
- body: nil)
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
- .deserializer(APIHelper.method(:custom_type_deserializer))
33
- .deserialize_into(InlineResponse202.method(:from_hash))
34
- .local_error('400',
35
- "Bad Request\n",
36
- M400ErrorResponseError1Exception)
37
- .local_error('401',
38
- 'Unauthorized',
39
- HTTP401ErrorResponseException)
40
- .local_error('404',
41
- "Invalid charge token with given EmaId was not found.\n\nBackend'\
42
- ' HTTP 410 should be transformed to 404.",
43
- M404ErrorResponseError1Exception)
44
- .local_error('405',
45
- 'Method Not Allowed',
46
- M405ErrorResponseError1Exception)
47
- .local_error('429',
48
- 'Too Many Requests',
49
- M429ErrorResponseError1Exception)
50
- .local_error('500',
51
- 'Internal Server Error',
52
- M500ErrorResponseError1Exception)
53
- .local_error('503',
54
- 'Returned when a connectivity failure is encountered like DB'\
55
- ' connection failed, endpoint failed etc or when max number of'\
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
- # This API stops a session by providing the session ID which was retrieved
62
- # when starting the session. HTTP 202 response will be returned if the
63
- # request is accepted. Once the session is stopped the response will contain
64
- # the DateTime on which it is stopped. operationId: Stop
65
- # @param [UUID | String] request_id Required parameter: A unique request id
66
- # in GUID format. The value is written to the Shell API Platform audit log
67
- # for end to end traceability of a request.
68
- # @param [UUID | String] uuid Required parameter: Unique session ID which
69
- # was generated to activate a charging session.
70
- # @param [StopChargeSessionRequestBodyJson] body Optional parameter:
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 stop_charge_session(request_id,
74
- uuid,
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/{uuid}',
74
+ '/ev/v1/charge-session/stop',
79
75
  Server::DEFAULT)
80
76
  .header_param(new_parameter(request_id, key: 'RequestId'))
81
- .template_param(new_parameter(uuid, key: 'uuid')
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
- .deserializer(APIHelper.method(:custom_type_deserializer))
90
- .deserialize_into(InlineResponse2021.method(:from_hash))
91
- .local_error('400',
92
- "Bad Request\n",
93
- M400ErrorResponseError1Exception)
94
- .local_error('401',
95
- 'Unauthorized',
96
- M401ErrorResponseError1Exception)
97
- .local_error('404',
98
- 'Session not found or Session has already been stopped. Map 410'\
99
- ' Error message into 404.',
100
- M404ErrorResponseError1Exception)
101
- .local_error('405',
102
- 'Method Not Allowed',
103
- M405ErrorResponseError1Exception)
104
- .local_error('429',
105
- 'Too Many Requests',
106
- M429ErrorResponseError1Exception)
107
- .local_error('500',
108
- 'Internal Server Error',
109
- M500ErrorResponseError1Exception)
110
- .local_error('503',
111
- "Returned when a connectivity failure is encountered like DB'\
112
- ' connection failed, endpoint failed etc or when max number of'\
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 API retrieves the status and details of the session which was started
119
- # by the user. The session ID generated earlier needs to be passed in this
120
- # API in order to retrieve the status.
121
- # @param [UUID | String] request_id Required parameter: A unique request id
122
- # in GUID format. The value is written to the Shell API Platform audit log
123
- # for end to end traceability of a request.
124
- # @param [String] session_id Required parameter: Session Id is to be
125
- # fetched
126
- # @param [UUID | String] uuid Required parameter: Unique session ID which
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/{uuid}',
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: 'SessionId'))
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
- .deserializer(APIHelper.method(:custom_type_deserializer))
144
- .deserialize_into(GetChargeSessionRetrieveResponse200Json.method(:from_hash))
145
- .local_error('400',
146
- 'Bad Request',
147
- M400ErrorResponseError1Exception)
148
- .local_error('401',
149
- 'Unauthorized',
150
- M401ErrorResponseError1Exception)
151
- .local_error('404',
152
- 'Not Found',
153
- M404ErrorResponseError1Exception)
154
- .local_error('405',
155
- 'Method Not Allowed',
156
- M405ErrorResponseError1Exception)
157
- .local_error('429',
158
- 'Too Many Requests',
159
- M429ErrorResponseError1Exception)
160
- .local_error('500',
161
- 'Internal Server Error',
162
- M500ErrorResponseError1Exception)
163
- .local_error('503',
164
- 'Service Unavailable',
165
- M503ErrorResponseError1Exception))
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
- # This API retrieves the list of active sessions for a given set of EMAIds
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(ema_id,
177
- request_id)
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
- .deserializer(APIHelper.method(:custom_type_deserializer))
188
- .deserialize_into(ActiveResponse200Json.method(:from_hash))
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