ev-recharge-sdk 1.0.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +38 -21
  3. data/lib/shell_ev/client.rb +12 -8
  4. data/lib/shell_ev/configuration.rb +70 -19
  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: 3581a5328737a93ee89d58d621cd5b0cd8ab33f77a8940b52e7a5992e96c17ae
4
+ data.tar.gz: d6397da21ac9a71c372605d673fcf9f4afddf119405becae51a32228fdf4cb50
5
5
  SHA512:
6
- metadata.gz: a4f42064d469f193a69b9fabc12b4e8b75dd00ce17130371fd240c15504b73f076b78d1f744c73049c0f32d82b21432eb0c29e8192cad8f57509ab1558b41e5a
7
- data.tar.gz: e82d3a275a00e2e7239eefe970d53a4693bbe51af74619592dfdfd275aec9a508492fee569f7314eaf3a8c7e9729d1be8a94f94744fc6ff6fe46323f210c2113
6
+ metadata.gz: 3b459aa49f87f0aef6aa7d6aad385b8488718c06c3b69f1d6950e4732a71d454d3649fa80f7fd89ebe72ddff63c84adc5b4b410dba9dc4585e6753f662eabe6c
7
+ data.tar.gz: a484563a4340d88c652cfbaf24ba62ad4c875e501ccabccc7cce407e68574f1d335681bb62397adf75c5a1bda963443fc065e8c810d30218b5ea3a9779a8ed5a
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.2.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.2.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.2.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.2.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.2.0/doc/$a/https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/1.2.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.2.0/doc/$a/https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/1.2.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.2.0/doc/controllers/locations.md)
102
+ * [Charging](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/1.2.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.2.0/doc/utility-classes.md)
107
+ * [HttpResponse](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/1.2.0/doc/http-response.md)
108
+ * [HttpRequest](https://www.github.com/sdks-io/ev-recharge-ruby-sdk/tree/1.2.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,8 @@ 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, o_auth_client_id: nil,
41
+ o_auth_client_secret: nil, o_auth_token: nil,
41
42
  client_credentials_auth_credentials: nil, config: nil
42
43
  )
43
44
  @config = if config.nil?
@@ -47,7 +48,10 @@ module ShellEv
47
48
  backoff_factor: backoff_factor,
48
49
  retry_statuses: retry_statuses,
49
50
  retry_methods: retry_methods, http_callback: http_callback,
50
- environment: environment, env: env,
51
+ environment: environment,
52
+ o_auth_client_id: o_auth_client_id,
53
+ o_auth_client_secret: o_auth_client_secret,
54
+ o_auth_token: o_auth_token,
51
55
  client_credentials_auth_credentials: client_credentials_auth_credentials
52
56
  )
53
57
  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
 
@@ -21,8 +24,20 @@ module ShellEv
21
24
  # All configuration including auth info and base URI for the API access
22
25
  # are configured in this class.
23
26
  class Configuration < CoreLibrary::HttpClientConfiguration
27
+ def o_auth_client_id
28
+ @client_credentials_auth_credentials.o_auth_client_id
29
+ end
30
+
31
+ def o_auth_client_secret
32
+ @client_credentials_auth_credentials.o_auth_client_secret
33
+ end
34
+
35
+ def o_auth_token
36
+ @client_credentials_auth_credentials.o_auth_token
37
+ end
38
+
24
39
  # The attribute readers for properties.
25
- attr_reader :environment, :env, :client_credentials_auth_credentials
40
+ attr_reader :environment, :client_credentials_auth_credentials
26
41
 
27
42
  class << self
28
43
  attr_reader :environments
@@ -33,7 +48,8 @@ module ShellEv
33
48
  max_retries: 0, retry_interval: 1, backoff_factor: 2,
34
49
  retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
35
50
  retry_methods: %i[get put], http_callback: nil,
36
- environment: Environment::PRODUCTION, env: EnvEnum::ENUM_APITESTSHELLCOM,
51
+ environment: Environment::PRODUCTION, o_auth_client_id: nil,
52
+ o_auth_client_secret: nil, o_auth_token: nil,
37
53
  client_credentials_auth_credentials: nil
38
54
  )
39
55
 
@@ -45,14 +61,24 @@ module ShellEv
45
61
  # Current API environment
46
62
  @environment = String(environment)
47
63
 
48
- # This variable specifies the type of environment. Environments: * `api` - Production * `api-test` - UAT
49
- @env = env
64
+ # OAuth 2 Client ID
65
+ @o_auth_client_id = o_auth_client_id
66
+
67
+ # OAuth 2 Client Secret
68
+ @o_auth_client_secret = o_auth_client_secret
50
69
 
51
- # The object holding OAuth 2 Client Credentials Grant credentials
52
- @client_credentials_auth_credentials = client_credentials_auth_credentials
70
+ # Object for storing information about the OAuth token
71
+ @o_auth_token = if o_auth_token.is_a? OAuthToken
72
+ OAuthToken.from_hash o_auth_token.to_hash
73
+ else
74
+ o_auth_token
75
+ end
53
76
 
54
77
  # Initializing OAuth 2 Client Credentials Grant credentials with the provided auth parameters
55
- @client_credentials_auth_credentials = client_credentials_auth_credentials
78
+ @client_credentials_auth_credentials = create_auth_credentials_object(
79
+ o_auth_client_id, o_auth_client_secret, o_auth_token,
80
+ client_credentials_auth_credentials
81
+ )
56
82
 
57
83
  # The Http Client to use for making requests.
58
84
  set_http_client CoreLibrary::FaradayClient.new(self)
@@ -61,7 +87,8 @@ module ShellEv
61
87
  def clone_with(connection: nil, adapter: nil, timeout: nil,
62
88
  max_retries: nil, retry_interval: nil, backoff_factor: nil,
63
89
  retry_statuses: nil, retry_methods: nil, http_callback: nil,
64
- environment: nil, env: nil,
90
+ environment: nil, o_auth_client_id: nil,
91
+ o_auth_client_secret: nil, o_auth_token: nil,
65
92
  client_credentials_auth_credentials: nil)
66
93
  connection ||= self.connection
67
94
  adapter ||= self.adapter
@@ -73,24 +100,53 @@ module ShellEv
73
100
  retry_methods ||= self.retry_methods
74
101
  http_callback ||= self.http_callback
75
102
  environment ||= self.environment
76
- env ||= self.env
77
- client_credentials_auth_credentials ||= client_credentials_auth_credentials
103
+ client_credentials_auth_credentials = create_auth_credentials_object(
104
+ o_auth_client_id, o_auth_client_secret, o_auth_token,
105
+ client_credentials_auth_credentials || self.client_credentials_auth_credentials
106
+ )
78
107
 
79
108
  Configuration.new(
80
109
  connection: connection, adapter: adapter, timeout: timeout,
81
110
  max_retries: max_retries, retry_interval: retry_interval,
82
111
  backoff_factor: backoff_factor, retry_statuses: retry_statuses,
83
112
  retry_methods: retry_methods, http_callback: http_callback,
84
- environment: environment, env: env,
113
+ environment: environment,
85
114
  client_credentials_auth_credentials: client_credentials_auth_credentials
86
115
  )
87
116
  end
88
117
 
118
+ def create_auth_credentials_object(o_auth_client_id, o_auth_client_secret,
119
+ o_auth_token,
120
+ client_credentials_auth_credentials)
121
+ return client_credentials_auth_credentials if o_auth_client_id.nil? &&
122
+ o_auth_client_secret.nil? &&
123
+ o_auth_token.nil?
124
+
125
+ warn('The \'o_auth_client_id\', \'o_auth_client_secret\', \'o_auth_token'\
126
+ '\' params are deprecated. Use \'client_credentials_auth_credential'\
127
+ 's\' param instead.')
128
+
129
+ unless client_credentials_auth_credentials.nil?
130
+ return client_credentials_auth_credentials.clone_with(
131
+ o_auth_client_id: o_auth_client_id,
132
+ o_auth_client_secret: o_auth_client_secret,
133
+ o_auth_token: o_auth_token
134
+ )
135
+ end
136
+
137
+ ClientCredentialsAuthCredentials.new(
138
+ o_auth_client_id: o_auth_client_id,
139
+ o_auth_client_secret: o_auth_client_secret, o_auth_token: o_auth_token
140
+ )
141
+ end
89
142
 
90
143
  # All the environments the SDK can run in.
91
144
  ENVIRONMENTS = {
92
145
  Environment::PRODUCTION => {
93
- Server::DEFAULT => 'https://{env}'
146
+ Server::DEFAULT => 'https://api.shell.com'
147
+ },
148
+ Environment::ENVIRONMENT2 => {
149
+ Server::DEFAULT => 'https://api-test.shell.com'
94
150
  }
95
151
  }.freeze
96
152
 
@@ -99,12 +155,7 @@ module ShellEv
99
155
  # required.
100
156
  # @return [String] The base URI.
101
157
  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
- )
158
+ ENVIRONMENTS[environment][server].clone
108
159
  end
109
160
  end
110
161
  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