ev-recharge-sdk 1.0.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 (105) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +28 -0
  3. data/README.md +92 -0
  4. data/lib/shell_ev/api_helper.rb +10 -0
  5. data/lib/shell_ev/client.rb +77 -0
  6. data/lib/shell_ev/configuration.rb +110 -0
  7. data/lib/shell_ev/controllers/base_controller.rb +66 -0
  8. data/lib/shell_ev/controllers/charging_controller.rb +216 -0
  9. data/lib/shell_ev/controllers/locations_controller.rb +352 -0
  10. data/lib/shell_ev/controllers/o_auth_authorization_controller.rb +42 -0
  11. data/lib/shell_ev/exceptions/api_exception.rb +10 -0
  12. data/lib/shell_ev/exceptions/bad_request_exception.rb +37 -0
  13. data/lib/shell_ev/exceptions/http401_error_response_exception.rb +52 -0
  14. data/lib/shell_ev/exceptions/m400_error_response_error1_exception.rb +52 -0
  15. data/lib/shell_ev/exceptions/m401_error_response_error1_exception.rb +52 -0
  16. data/lib/shell_ev/exceptions/m404_error_response_error1_exception.rb +53 -0
  17. data/lib/shell_ev/exceptions/m405_error_response_error1_exception.rb +52 -0
  18. data/lib/shell_ev/exceptions/m429_error_response_error1_exception.rb +52 -0
  19. data/lib/shell_ev/exceptions/m500_error_response_error1_exception.rb +52 -0
  20. data/lib/shell_ev/exceptions/m503_error_response_error1_exception.rb +52 -0
  21. data/lib/shell_ev/exceptions/not_found_exception.rb +37 -0
  22. data/lib/shell_ev/exceptions/o_auth_provider_exception.rb +48 -0
  23. data/lib/shell_ev/exceptions/unauthorized_exception.rb +37 -0
  24. data/lib/shell_ev/http/auth/o_auth2.rb +90 -0
  25. data/lib/shell_ev/http/http_call_back.rb +10 -0
  26. data/lib/shell_ev/http/http_method_enum.rb +10 -0
  27. data/lib/shell_ev/http/http_request.rb +10 -0
  28. data/lib/shell_ev/http/http_response.rb +10 -0
  29. data/lib/shell_ev/models/accessibility.rb +60 -0
  30. data/lib/shell_ev/models/accessibility_status_enum.rb +29 -0
  31. data/lib/shell_ev/models/active_response200_json.rb +78 -0
  32. data/lib/shell_ev/models/active_response200_json_status_enum.rb +23 -0
  33. data/lib/shell_ev/models/address.rb +81 -0
  34. data/lib/shell_ev/models/base_model.rb +62 -0
  35. data/lib/shell_ev/models/chargesession_start_body.rb +59 -0
  36. data/lib/shell_ev/models/connector_vo.rb +134 -0
  37. data/lib/shell_ev/models/connector_vo_connector_type_enum.rb +71 -0
  38. data/lib/shell_ev/models/connector_vo_updated_by_enum.rb +29 -0
  39. data/lib/shell_ev/models/coordinates.rb +70 -0
  40. data/lib/shell_ev/models/data_active.rb +153 -0
  41. data/lib/shell_ev/models/data_active_session_code_enum.rb +44 -0
  42. data/lib/shell_ev/models/data_active_session_state_enum.rb +35 -0
  43. data/lib/shell_ev/models/data_retrieve.rb +152 -0
  44. data/lib/shell_ev/models/data_retrieve_session_code_enum.rb +44 -0
  45. data/lib/shell_ev/models/data_retrieve_session_state_enum.rb +35 -0
  46. data/lib/shell_ev/models/electrical_properties.rb +81 -0
  47. data/lib/shell_ev/models/electrical_properties_power_type_enum.rb +26 -0
  48. data/lib/shell_ev/models/env_enum.rb +23 -0
  49. data/lib/shell_ev/models/evse_vo.rb +143 -0
  50. data/lib/shell_ev/models/evse_vo_authorization_methods_enum.rb +26 -0
  51. data/lib/shell_ev/models/evse_vo_status_enum.rb +29 -0
  52. data/lib/shell_ev/models/get_charge_session_retrieve_response200_json.rb +78 -0
  53. data/lib/shell_ev/models/get_charge_session_retrieve_response200_json_status_enum.rb +23 -0
  54. data/lib/shell_ev/models/get_locations_list_authorization_methods_enum.rb +26 -0
  55. data/lib/shell_ev/models/get_locations_list_connector_types_enum.rb +71 -0
  56. data/lib/shell_ev/models/get_locations_list_evse_status_enum.rb +29 -0
  57. data/lib/shell_ev/models/get_markers_list_authorization_methods_enum.rb +26 -0
  58. data/lib/shell_ev/models/get_markers_list_connector_types_enum.rb +71 -0
  59. data/lib/shell_ev/models/get_markers_list_evse_status_enum.rb +29 -0
  60. data/lib/shell_ev/models/get_nearby_locations_authorization_methods_enum.rb +26 -0
  61. data/lib/shell_ev/models/get_nearby_locations_connector_types_enum.rb +71 -0
  62. data/lib/shell_ev/models/get_nearby_locations_evse_status_enum.rb +29 -0
  63. data/lib/shell_ev/models/inline_response202.rb +76 -0
  64. data/lib/shell_ev/models/inline_response2021.rb +58 -0
  65. data/lib/shell_ev/models/inline_response2021_status_enum.rb +23 -0
  66. data/lib/shell_ev/models/inline_response202_data.rb +48 -0
  67. data/lib/shell_ev/models/inline_response202_status_enum.rb +23 -0
  68. data/lib/shell_ev/models/location_respone_object.rb +172 -0
  69. data/lib/shell_ev/models/m400_error_response.rb +78 -0
  70. data/lib/shell_ev/models/m400_error_response_error.rb +80 -0
  71. data/lib/shell_ev/models/m401_error_response.rb +78 -0
  72. data/lib/shell_ev/models/m401_error_response_error.rb +80 -0
  73. data/lib/shell_ev/models/m404_error_response.rb +79 -0
  74. data/lib/shell_ev/models/m404_error_response_error.rb +80 -0
  75. data/lib/shell_ev/models/m405_error_response.rb +78 -0
  76. data/lib/shell_ev/models/m405_error_response_error.rb +80 -0
  77. data/lib/shell_ev/models/m429_error_response.rb +78 -0
  78. data/lib/shell_ev/models/m429_error_response_error.rb +80 -0
  79. data/lib/shell_ev/models/m500_error_response.rb +78 -0
  80. data/lib/shell_ev/models/m500_error_response_error.rb +80 -0
  81. data/lib/shell_ev/models/m503_error_response.rb +78 -0
  82. data/lib/shell_ev/models/m503_error_response_error.rb +80 -0
  83. data/lib/shell_ev/models/multi_location_marker.rb +126 -0
  84. data/lib/shell_ev/models/o_auth_provider_error_enum.rb +45 -0
  85. data/lib/shell_ev/models/o_auth_token.rb +100 -0
  86. data/lib/shell_ev/models/opening_hours_object.rb +70 -0
  87. data/lib/shell_ev/models/opening_hours_object_week_day_enum.rb +38 -0
  88. data/lib/shell_ev/models/response_base_status_enum.rb +26 -0
  89. data/lib/shell_ev/models/response_error401_all_of1.rb +57 -0
  90. data/lib/shell_ev/models/response_error401_all_of1_errors_items.rb +80 -0
  91. data/lib/shell_ev/models/single_location_marker.rb +157 -0
  92. data/lib/shell_ev/models/single_location_marker_authorization_methods_items_enum.rb +26 -0
  93. data/lib/shell_ev/models/single_location_marker_status_enum.rb +30 -0
  94. data/lib/shell_ev/models/stop_charge_session_request_body_json.rb +48 -0
  95. data/lib/shell_ev/models/success_response.rb +58 -0
  96. data/lib/shell_ev/models/tariff_vo.rb +111 -0
  97. data/lib/shell_ev/models/tariff_vo_updated_by_enum.rb +29 -0
  98. data/lib/shell_ev/utilities/date_time_helper.rb +11 -0
  99. data/lib/shell_ev/utilities/file_wrapper.rb +16 -0
  100. data/lib/shell_ev/utilities/union_type_lookup.rb +38 -0
  101. data/lib/shell_ev.rb +125 -0
  102. data/test/controllers/controller_test_base.rb +34 -0
  103. data/test/controllers/test_charging_controller.rb +78 -0
  104. data/test/http_response_catcher.rb +19 -0
  105. metadata +224 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: b91582bc1739f9e24f85bc8815b4904c3c3aa4887dc4e4d986cb79508f3afeea
4
+ data.tar.gz: 291214a251e8dc918b7f727336bb253e33129bf0c45252db46c47fa95770c1e1
5
+ SHA512:
6
+ metadata.gz: a4f42064d469f193a69b9fabc12b4e8b75dd00ce17130371fd240c15504b73f076b78d1f744c73049c0f32d82b21432eb0c29e8192cad8f57509ab1558b41e5a
7
+ data.tar.gz: e82d3a275a00e2e7239eefe970d53a4693bbe51af74619592dfdfd275aec9a508492fee569f7314eaf3a8c7e9729d1be8a94f94744fc6ff6fe46323f210c2113
data/LICENSE ADDED
@@ -0,0 +1,28 @@
1
+ License:
2
+ ========
3
+ The MIT License (MIT)
4
+ http://opensource.org/licenses/MIT
5
+
6
+ Copyright (c) 2014 - 2024 APIMATIC Limited
7
+
8
+ Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ of this software and associated documentation files (the "Software"), to deal
10
+ in the Software without restriction, including without limitation the rights
11
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ copies of the Software, and to permit persons to whom the Software is
13
+ furnished to do so, subject to the following conditions:
14
+
15
+ The above copyright notice and this permission notice shall be included in
16
+ all copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
+ THE SOFTWARE.
25
+
26
+ Trade Mark:
27
+ ==========
28
+ APIMATIC is a trade mark for APIMATIC Limited
data/README.md ADDED
@@ -0,0 +1,92 @@
1
+
2
+ # Getting Started with Shell EV
3
+
4
+ ## Introduction
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.
7
+
8
+ Supported Function
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'
14
+
15
+ Go to the Shell Developer Portal: [https://developer.shell.com](https://developer.shell.com)
16
+
17
+ ## Install the Package
18
+
19
+ Install the gem from the command line:
20
+
21
+ ```ruby
22
+ gem install ev-recharge-sdk -v 1.0.0
23
+ ```
24
+
25
+ Or add the gem to your Gemfile and run `bundle`:
26
+
27
+ ```ruby
28
+ gem 'ev-recharge-sdk', '1.0.0'
29
+ ```
30
+
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).
32
+
33
+ ## Test the SDK
34
+
35
+ To run the tests, navigate to the root directory of the SDK in your terminal and execute the following command:
36
+
37
+ ```
38
+ rake
39
+ ```
40
+
41
+ ## Initialize the API Client
42
+
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)
44
+
45
+ The following parameters are configurable for the API Client:
46
+
47
+ | Parameter | Type | Description |
48
+ | --- | --- | --- |
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
+ | `environment` | `Environment` | The API environment. <br> **Default: `Environment.PRODUCTION`** |
51
+ | `connection` | `Faraday::Connection` | The Faraday connection object passed by the SDK user for making requests |
52
+ | `adapter` | `Faraday::Adapter` | The Faraday adapter object passed by the SDK user for performing http requests |
53
+ | `timeout` | `Float` | The value to use for connection timeout. <br> **Default: 60** |
54
+ | `max_retries` | `Integer` | The number of times to retry an endpoint call if it fails. <br> **Default: 0** |
55
+ | `retry_interval` | `Float` | Pause in seconds between retries. <br> **Default: 1** |
56
+ | `backoff_factor` | `Float` | The amount to multiply each successive retry's interval amount by in order to provide backoff. <br> **Default: 2** |
57
+ | `retry_statuses` | `Array` | A list of HTTP statuses to retry. <br> **Default: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524]** |
58
+ | `retry_methods` | `Array` | A list of HTTP methods to retry. <br> **Default: %i[get put]** |
59
+ | `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 |
61
+
62
+ The API client can be initialized as follows:
63
+
64
+ ```ruby
65
+ client = ShellEv::Client.new(
66
+ client_credentials_auth_credentials: ClientCredentialsAuthCredentials.new(
67
+ o_auth_client_id: 'OAuthClientId',
68
+ o_auth_client_secret: 'OAuthClientSecret'
69
+ ),
70
+ environment: Environment::PRODUCTION,
71
+ env: EnvEnum::ENUM_APITESTSHELLCOM
72
+ )
73
+ ```
74
+
75
+ ## Authorization
76
+
77
+ This API uses the following authentication schemes.
78
+
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)
80
+
81
+ ## List of APIs
82
+
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)
86
+
87
+ ## Classes Documentation
88
+
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)
92
+
@@ -0,0 +1,10 @@
1
+ # shell_ev
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module ShellEv
7
+ # API utility class
8
+ class APIHelper < CoreLibrary::ApiHelper
9
+ end
10
+ end
@@ -0,0 +1,77 @@
1
+ # shell_ev
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module ShellEv
7
+ # shell_ev client class.
8
+ class Client
9
+ include CoreLibrary
10
+ attr_reader :config, :auth_managers
11
+
12
+ # Returns the configured authentication BearerAuth instance.
13
+ def bearer_auth
14
+ @auth_managers['BearerAuth']
15
+ end
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
+ # Access to locations controller.
24
+ # @return [LocationsController] Returns the controller instance.
25
+ def locations
26
+ @locations ||= LocationsController.new @global_configuration
27
+ end
28
+
29
+ # Access to o_auth_authorization controller.
30
+ # @return [OAuthAuthorizationController] Returns the controller instance.
31
+ def o_auth_authorization
32
+ @o_auth_authorization ||= OAuthAuthorizationController.new @global_configuration
33
+ end
34
+
35
+ def initialize(
36
+ connection: nil, adapter: :net_http_persistent, timeout: 60,
37
+ max_retries: 0, retry_interval: 1, backoff_factor: 2,
38
+ retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
39
+ retry_methods: %i[get put], http_callback: nil,
40
+ environment: Environment::PRODUCTION, env: EnvEnum::ENUM_APITESTSHELLCOM,
41
+ client_credentials_auth_credentials: nil, config: nil
42
+ )
43
+ @config = if config.nil?
44
+ Configuration.new(
45
+ connection: connection, adapter: adapter, timeout: timeout,
46
+ max_retries: max_retries, retry_interval: retry_interval,
47
+ backoff_factor: backoff_factor,
48
+ retry_statuses: retry_statuses,
49
+ retry_methods: retry_methods, http_callback: http_callback,
50
+ environment: environment, env: env,
51
+ client_credentials_auth_credentials: client_credentials_auth_credentials
52
+ )
53
+ else
54
+ config
55
+ end
56
+
57
+ @global_configuration = GlobalConfiguration.new(client_configuration: @config)
58
+ .base_uri_executor(@config.method(:get_base_uri))
59
+ .global_errors(BaseController::GLOBAL_ERRORS)
60
+ .user_agent(BaseController.user_agent)
61
+
62
+ initialize_auth_managers(@global_configuration)
63
+ @global_configuration = @global_configuration.auth_managers(@auth_managers)
64
+ end
65
+
66
+ # Initializes the auth managers hash used for authenticating API calls.
67
+ # @param [GlobalConfiguration] global_config The global configuration of the SDK)
68
+ def initialize_auth_managers(global_config)
69
+ @auth_managers = {}
70
+ http_client_config = global_config.client_configuration
71
+ %w[BearerAuth].each { |auth| @auth_managers[auth] = nil }
72
+ @auth_managers['BearerAuth'] = OAuth2.new(
73
+ http_client_config.client_credentials_auth_credentials, global_config
74
+ )
75
+ end
76
+ end
77
+ end
@@ -0,0 +1,110 @@
1
+ # shell_ev
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module ShellEv
7
+ # An enum for SDK environments.
8
+ class Environment
9
+ ENVIRONMENT = [
10
+ PRODUCTION = 'production'.freeze
11
+ ].freeze
12
+ end
13
+
14
+ # An enum for API servers.
15
+ class Server
16
+ SERVER = [
17
+ DEFAULT = 'default'.freeze
18
+ ].freeze
19
+ end
20
+
21
+ # All configuration including auth info and base URI for the API access
22
+ # are configured in this class.
23
+ class Configuration < CoreLibrary::HttpClientConfiguration
24
+ # The attribute readers for properties.
25
+ attr_reader :environment, :env, :client_credentials_auth_credentials
26
+
27
+ class << self
28
+ attr_reader :environments
29
+ end
30
+
31
+ def initialize(
32
+ connection: nil, adapter: :net_http_persistent, timeout: 60,
33
+ max_retries: 0, retry_interval: 1, backoff_factor: 2,
34
+ retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
35
+ retry_methods: %i[get put], http_callback: nil,
36
+ environment: Environment::PRODUCTION, env: EnvEnum::ENUM_APITESTSHELLCOM,
37
+ client_credentials_auth_credentials: nil
38
+ )
39
+
40
+ super connection: connection, adapter: adapter, timeout: timeout,
41
+ max_retries: max_retries, retry_interval: retry_interval,
42
+ backoff_factor: backoff_factor, retry_statuses: retry_statuses,
43
+ retry_methods: retry_methods, http_callback: http_callback
44
+
45
+ # Current API environment
46
+ @environment = String(environment)
47
+
48
+ # This variable specifies the type of environment. Environments: * `api` - Production * `api-test` - UAT
49
+ @env = env
50
+
51
+ # The object holding OAuth 2 Client Credentials Grant credentials
52
+ @client_credentials_auth_credentials = client_credentials_auth_credentials
53
+
54
+ # Initializing OAuth 2 Client Credentials Grant credentials with the provided auth parameters
55
+ @client_credentials_auth_credentials = client_credentials_auth_credentials
56
+
57
+ # The Http Client to use for making requests.
58
+ set_http_client CoreLibrary::FaradayClient.new(self)
59
+ end
60
+
61
+ def clone_with(connection: nil, adapter: nil, timeout: nil,
62
+ max_retries: nil, retry_interval: nil, backoff_factor: nil,
63
+ retry_statuses: nil, retry_methods: nil, http_callback: nil,
64
+ environment: nil, env: nil,
65
+ client_credentials_auth_credentials: nil)
66
+ connection ||= self.connection
67
+ adapter ||= self.adapter
68
+ timeout ||= self.timeout
69
+ max_retries ||= self.max_retries
70
+ retry_interval ||= self.retry_interval
71
+ backoff_factor ||= self.backoff_factor
72
+ retry_statuses ||= self.retry_statuses
73
+ retry_methods ||= self.retry_methods
74
+ http_callback ||= self.http_callback
75
+ environment ||= self.environment
76
+ env ||= self.env
77
+ client_credentials_auth_credentials ||= client_credentials_auth_credentials
78
+
79
+ Configuration.new(
80
+ connection: connection, adapter: adapter, timeout: timeout,
81
+ max_retries: max_retries, retry_interval: retry_interval,
82
+ backoff_factor: backoff_factor, retry_statuses: retry_statuses,
83
+ retry_methods: retry_methods, http_callback: http_callback,
84
+ environment: environment, env: env,
85
+ client_credentials_auth_credentials: client_credentials_auth_credentials
86
+ )
87
+ end
88
+
89
+
90
+ # All the environments the SDK can run in.
91
+ ENVIRONMENTS = {
92
+ Environment::PRODUCTION => {
93
+ Server::DEFAULT => 'https://{env}'
94
+ }
95
+ }.freeze
96
+
97
+ # Generates the appropriate base URI for the environment and the server.
98
+ # @param [Configuration::Server] server The server enum for which the base URI is
99
+ # required.
100
+ # @return [String] The base URI.
101
+ 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
+ )
108
+ end
109
+ end
110
+ end
@@ -0,0 +1,66 @@
1
+ # shell_ev
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module ShellEv
7
+ # BaseController.
8
+ class BaseController
9
+ include CoreLibrary
10
+ attr_accessor :config, :http_call_back
11
+
12
+ def self.user_agent
13
+ 'APIMATIC 3.0'
14
+ end
15
+
16
+
17
+ GLOBAL_ERRORS = {
18
+ 'default' => ErrorCase.new
19
+ .error_message('HTTP response not OK.')
20
+ .exception_type(APIException)
21
+ }.freeze
22
+
23
+ # Initialization constructor.
24
+ # @param [GlobalConfiguration] global_configuration The instance of GlobalConfiguration.
25
+ def initialize(global_configuration)
26
+ @global_configuration = global_configuration
27
+ @config = @global_configuration.client_configuration
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
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
+ # @return [RequestBuilder] The instance of RequestBuilder.
43
+ def new_request_builder(http_method, path, server)
44
+ RequestBuilder.new
45
+ .http_method(http_method)
46
+ .path(path)
47
+ .server(server)
48
+ end
49
+
50
+ # Creates a new instance of the response handler.
51
+ # @return [ResponseHandler] The instance of ResponseHandler.
52
+ def new_response_handler
53
+ ResponseHandler.new
54
+ end
55
+
56
+ # Creates a new instance of the parameter.
57
+ # @param [String|optional] key The key of the parameter.
58
+ # @param [Object] value The value of the parameter.
59
+ # @return [Parameter] The instance of Parameter.
60
+ def new_parameter(value, key: nil)
61
+ Parameter.new
62
+ .key(key)
63
+ .value(value)
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,216 @@
1
+ # shell_ev
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module ShellEv
7
+ # ChargingController
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.
17
+ # @param [ChargesessionStartBody] body Optional parameter: Example:
18
+ # @return [InlineResponse202] response from the API call
19
+ def start_charge_session(request_id,
20
+ body: nil)
21
+ new_api_call_builder
22
+ .request(new_request_builder(HttpMethodEnum::POST,
23
+ '/ev/v1/charge-session/start',
24
+ Server::DEFAULT)
25
+ .header_param(new_parameter(request_id, key: 'RequestId'))
26
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
27
+ .body_param(new_parameter(body))
28
+ .header_param(new_parameter('application/json', key: 'accept'))
29
+ .body_serializer(proc do |param| param.to_json unless param.nil? end)
30
+ .auth(Single.new('BearerAuth')))
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))
58
+ .execute
59
+ end
60
+
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:
72
+ # @return [InlineResponse2021] response from the API call
73
+ def stop_charge_session(request_id,
74
+ uuid,
75
+ body: nil)
76
+ new_api_call_builder
77
+ .request(new_request_builder(HttpMethodEnum::POST,
78
+ '/ev/v1/charge-session/stop/{uuid}',
79
+ Server::DEFAULT)
80
+ .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))
85
+ .header_param(new_parameter('application/json', key: 'accept'))
86
+ .body_serializer(proc do |param| param.to_json unless param.nil? end)
87
+ .auth(Single.new('BearerAuth')))
88
+ .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))
115
+ .execute
116
+ end
117
+
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.
128
+ # @return [GetChargeSessionRetrieveResponse200Json] response from the API call
129
+ def get_charge_session_retrieve(request_id,
130
+ session_id,
131
+ uuid)
132
+ new_api_call_builder
133
+ .request(new_request_builder(HttpMethodEnum::GET,
134
+ '/ev/v1/charge-session/retrieve/{uuid}',
135
+ Server::DEFAULT)
136
+ .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))
140
+ .header_param(new_parameter('application/json', key: 'accept'))
141
+ .auth(Single.new('BearerAuth')))
142
+ .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))
166
+ .execute
167
+ end
168
+
169
+ # This API retrieves the list of active sessions for a given set of EMAIds
170
+ # @param [String] ema_id Required parameter: Emobility Account
171
+ # 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
+ # @return [ActiveResponse200Json] response from the API call
176
+ def active(ema_id,
177
+ request_id)
178
+ new_api_call_builder
179
+ .request(new_request_builder(HttpMethodEnum::GET,
180
+ '/ev/v1/charge-session/active',
181
+ Server::DEFAULT)
182
+ .query_param(new_parameter(ema_id, key: 'EmaId'))
183
+ .header_param(new_parameter(request_id, key: 'RequestId'))
184
+ .header_param(new_parameter('application/json', key: 'accept'))
185
+ .auth(Single.new('BearerAuth')))
186
+ .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))
213
+ .execute
214
+ end
215
+ end
216
+ end