tesla-api-sdk 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b1f1dec6f40d9a06ec7d8881b8fe4feeca9a5cedcc5edda398cf7826e014bda0
4
- data.tar.gz: 33eb35da898558cc2688d92074f9e6a9d06b3bcc20fa5e4f413ea29e7a7c9104
3
+ metadata.gz: eb2d42e3d25b281972d40951857c950b1e4fb3b74de096aed53ec6a9a9fbf418
4
+ data.tar.gz: d8e5979133e07e5a2c58c7458f59e4ecc63ea9a6b8c3004a11e85462567a160b
5
5
  SHA512:
6
- metadata.gz: c5e335364d821060bcfff023fa3e9801fd58c76decadcea7894fdc91ea87ac237e661b5806324436a66f595047ecaf986a8558799c84c53e2873dfb5986f5b88
7
- data.tar.gz: eb2b2f37ba154a77d3c57144743ec16d27f41fb3aec6961b06b8b940a30539bc6dc456ceb4615e1570eb8f80121df05d7d4f266f2389354aca1b3f2e4afd2b11
6
+ metadata.gz: 66eb18af24199b03162321e85a2ea318a0b0d190ce497a48eb5277ecc5743d777cd09d4f8ee7a3d09ec659b9aa0e7c33870d8fb6544745d5ed78cd3f83d4fc56
7
+ data.tar.gz: ea1dc8f5864cbd9b4c91e510781a8f5f83323fe74851a89e1975af992c39181975067a662392aab72d0825755153d42e0f355794144dc72342c066c22141d02e
data/README.md CHANGED
@@ -10,16 +10,16 @@ Unofficial OpenAPI specification for Tesla Fleet Management Charging endpoints.
10
10
  Install the gem from the command line:
11
11
 
12
12
  ```bash
13
- gem install tesla-api-sdk -v 1.0.1
13
+ gem install tesla-api-sdk -v 1.0.2
14
14
  ```
15
15
 
16
16
  Or add the gem to your Gemfile and run `bundle`:
17
17
 
18
18
  ```ruby
19
- gem 'tesla-api-sdk', '1.0.1'
19
+ gem 'tesla-api-sdk', '1.0.2'
20
20
  ```
21
21
 
22
- For additional gem details, see the [RubyGems page for the tesla-api-sdk gem](https://rubygems.org/gems/tesla-api-sdk/versions/1.0.1).
22
+ For additional gem details, see the [RubyGems page for the tesla-api-sdk gem](https://rubygems.org/gems/tesla-api-sdk/versions/1.0.2).
23
23
 
24
24
  ## IRB Console Usage
25
25
 
@@ -58,7 +58,7 @@ ruby bin/console
58
58
 
59
59
  ## Initialize the API Client
60
60
 
61
- **_Note:_** Documentation for the client can be found [here.](https://www.github.com/sdks-io/tesla-api-ruby-sdk/tree/1.0.1/doc/client.md)
61
+ **_Note:_** Documentation for the client can be found [here.](https://www.github.com/sdks-io/tesla-api-ruby-sdk/tree/1.0.2/doc/client.md)
62
62
 
63
63
  The following parameters are configurable for the API Client:
64
64
 
@@ -74,10 +74,10 @@ The following parameters are configurable for the API Client:
74
74
  | retry_statuses | `Array` | A list of HTTP statuses to retry. <br> **Default: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524]** |
75
75
  | retry_methods | `Array` | A list of HTTP methods to retry. <br> **Default: %i[get put]** |
76
76
  | http_callback | `HttpCallBack` | The Http CallBack allows defining callables for pre and post API calls. |
77
- | proxy_settings | [`ProxySettings`](https://www.github.com/sdks-io/tesla-api-ruby-sdk/tree/1.0.1/doc/proxy-settings.md) | Optional proxy configuration to route HTTP requests through a proxy server. |
78
- | logging_configuration | [`LoggingConfiguration`](https://www.github.com/sdks-io/tesla-api-ruby-sdk/tree/1.0.1/doc/logging-configuration.md) | The SDK logging configuration for API calls |
79
- | bearer_auth_credentials | [`BearerAuthCredentials`](https://www.github.com/sdks-io/tesla-api-ruby-sdk/tree/1.0.1/doc/auth/oauth-2-bearer-token.md) | The credential object for OAuth 2 Bearer token |
80
- | oauth_2_credentials | [`Oauth2Credentials`](https://www.github.com/sdks-io/tesla-api-ruby-sdk/tree/1.0.1/doc/auth/oauth-2-authorization-code-grant.md) | The credential object for OAuth 2 Authorization Code Grant |
77
+ | proxy_settings | [`ProxySettings`](https://www.github.com/sdks-io/tesla-api-ruby-sdk/tree/1.0.2/doc/proxy-settings.md) | Optional proxy configuration to route HTTP requests through a proxy server. |
78
+ | logging_configuration | [`LoggingConfiguration`](https://www.github.com/sdks-io/tesla-api-ruby-sdk/tree/1.0.2/doc/logging-configuration.md) | The SDK logging configuration for API calls |
79
+ | bearer_auth_credentials | [`BearerAuthCredentials`](https://www.github.com/sdks-io/tesla-api-ruby-sdk/tree/1.0.2/doc/auth/oauth-2-bearer-token.md) | The credential object for OAuth 2 Bearer token |
80
+ | thirdpartytoken_credentials | [`ThirdpartytokenCredentials`](https://www.github.com/sdks-io/tesla-api-ruby-sdk/tree/1.0.2/doc/auth/oauth-2-authorization-code-grant.md) | The credential object for OAuth 2 Authorization Code Grant |
81
81
 
82
82
  The API client can be initialized as follows:
83
83
 
@@ -91,13 +91,13 @@ client = Client.new(
91
91
  bearer_auth_credentials: BearerAuthCredentials.new(
92
92
  access_token: 'AccessToken'
93
93
  ),
94
- oauth2_credentials: Oauth2Credentials.new(
94
+ thirdpartytoken_credentials: ThirdpartytokenCredentials.new(
95
95
  o_auth_client_id: 'OAuthClientId',
96
96
  o_auth_client_secret: 'OAuthClientSecret',
97
97
  o_auth_redirect_uri: 'OAuthRedirectUri',
98
98
  o_auth_scopes: [
99
- OAuthScopeOauth2::OPENID,
100
- OAuthScopeOauth2::OFFLINE_ACCESS
99
+ OAuthScopeThirdpartytoken::OPENID,
100
+ OAuthScopeThirdpartytoken::OFFLINE_ACCESS
101
101
  ]
102
102
  ),
103
103
  environment: Environment::PRODUCTION,
@@ -123,43 +123,43 @@ include TeslaFleetManagementApi
123
123
  client = Client.from_env
124
124
  ```
125
125
 
126
- See the [`Environment-Based Client Initialization`](https://www.github.com/sdks-io/tesla-api-ruby-sdk/tree/1.0.1/doc/environment-based-client-initialization.md) section for details.
126
+ See the [`Environment-Based Client Initialization`](https://www.github.com/sdks-io/tesla-api-ruby-sdk/tree/1.0.2/doc/environment-based-client-initialization.md) section for details.
127
127
 
128
128
  ## Authorization
129
129
 
130
130
  This API uses the following authentication schemes.
131
131
 
132
- * [`bearerAuth (OAuth 2 Bearer token)`](https://www.github.com/sdks-io/tesla-api-ruby-sdk/tree/1.0.1/doc/auth/oauth-2-bearer-token.md)
133
- * [`oauth2 (OAuth 2 Authorization Code Grant)`](https://www.github.com/sdks-io/tesla-api-ruby-sdk/tree/1.0.1/doc/auth/oauth-2-authorization-code-grant.md)
132
+ * [`bearerAuth (OAuth 2 Bearer token)`](https://www.github.com/sdks-io/tesla-api-ruby-sdk/tree/1.0.2/doc/auth/oauth-2-bearer-token.md)
133
+ * [`thirdpartytoken (OAuth 2 Authorization Code Grant)`](https://www.github.com/sdks-io/tesla-api-ruby-sdk/tree/1.0.2/doc/auth/oauth-2-authorization-code-grant.md)
134
134
 
135
135
  ## List of APIs
136
136
 
137
- * [Vehicle Commands](https://www.github.com/sdks-io/tesla-api-ruby-sdk/tree/1.0.1/doc/controllers/vehicle-commands.md)
138
- * [Charging](https://www.github.com/sdks-io/tesla-api-ruby-sdk/tree/1.0.1/doc/controllers/charging.md)
139
- * [Energy](https://www.github.com/sdks-io/tesla-api-ruby-sdk/tree/1.0.1/doc/controllers/energy.md)
140
- * [Partner](https://www.github.com/sdks-io/tesla-api-ruby-sdk/tree/1.0.1/doc/controllers/partner.md)
141
- * [User](https://www.github.com/sdks-io/tesla-api-ruby-sdk/tree/1.0.1/doc/controllers/user.md)
142
- * [Vehicles](https://www.github.com/sdks-io/tesla-api-ruby-sdk/tree/1.0.1/doc/controllers/vehicles.md)
137
+ * [Vehicle Commands](https://www.github.com/sdks-io/tesla-api-ruby-sdk/tree/1.0.2/doc/controllers/vehicle-commands.md)
138
+ * [Charging](https://www.github.com/sdks-io/tesla-api-ruby-sdk/tree/1.0.2/doc/controllers/charging.md)
139
+ * [Energy](https://www.github.com/sdks-io/tesla-api-ruby-sdk/tree/1.0.2/doc/controllers/energy.md)
140
+ * [Partner](https://www.github.com/sdks-io/tesla-api-ruby-sdk/tree/1.0.2/doc/controllers/partner.md)
141
+ * [User](https://www.github.com/sdks-io/tesla-api-ruby-sdk/tree/1.0.2/doc/controllers/user.md)
142
+ * [Vehicles](https://www.github.com/sdks-io/tesla-api-ruby-sdk/tree/1.0.2/doc/controllers/vehicles.md)
143
143
 
144
144
  ## SDK Infrastructure
145
145
 
146
146
  ### Configuration
147
147
 
148
- * [ProxySettings](https://www.github.com/sdks-io/tesla-api-ruby-sdk/tree/1.0.1/doc/proxy-settings.md)
149
- * [Environment-Based Client Initialization](https://www.github.com/sdks-io/tesla-api-ruby-sdk/tree/1.0.1/doc/environment-based-client-initialization.md)
150
- * [AbstractLogger](https://www.github.com/sdks-io/tesla-api-ruby-sdk/tree/1.0.1/doc/abstract-logger.md)
151
- * [LoggingConfiguration](https://www.github.com/sdks-io/tesla-api-ruby-sdk/tree/1.0.1/doc/logging-configuration.md)
152
- * [RequestLoggingConfiguration](https://www.github.com/sdks-io/tesla-api-ruby-sdk/tree/1.0.1/doc/request-logging-configuration.md)
153
- * [ResponseLoggingConfiguration](https://www.github.com/sdks-io/tesla-api-ruby-sdk/tree/1.0.1/doc/response-logging-configuration.md)
148
+ * [ProxySettings](https://www.github.com/sdks-io/tesla-api-ruby-sdk/tree/1.0.2/doc/proxy-settings.md)
149
+ * [Environment-Based Client Initialization](https://www.github.com/sdks-io/tesla-api-ruby-sdk/tree/1.0.2/doc/environment-based-client-initialization.md)
150
+ * [AbstractLogger](https://www.github.com/sdks-io/tesla-api-ruby-sdk/tree/1.0.2/doc/abstract-logger.md)
151
+ * [LoggingConfiguration](https://www.github.com/sdks-io/tesla-api-ruby-sdk/tree/1.0.2/doc/logging-configuration.md)
152
+ * [RequestLoggingConfiguration](https://www.github.com/sdks-io/tesla-api-ruby-sdk/tree/1.0.2/doc/request-logging-configuration.md)
153
+ * [ResponseLoggingConfiguration](https://www.github.com/sdks-io/tesla-api-ruby-sdk/tree/1.0.2/doc/response-logging-configuration.md)
154
154
 
155
155
  ### HTTP
156
156
 
157
- * [HttpResponse](https://www.github.com/sdks-io/tesla-api-ruby-sdk/tree/1.0.1/doc/http-response.md)
158
- * [HttpRequest](https://www.github.com/sdks-io/tesla-api-ruby-sdk/tree/1.0.1/doc/http-request.md)
157
+ * [HttpResponse](https://www.github.com/sdks-io/tesla-api-ruby-sdk/tree/1.0.2/doc/http-response.md)
158
+ * [HttpRequest](https://www.github.com/sdks-io/tesla-api-ruby-sdk/tree/1.0.2/doc/http-request.md)
159
159
 
160
160
  ### Utilities
161
161
 
162
- * [ApiResponse](https://www.github.com/sdks-io/tesla-api-ruby-sdk/tree/1.0.1/doc/api-response.md)
163
- * [ApiHelper](https://www.github.com/sdks-io/tesla-api-ruby-sdk/tree/1.0.1/doc/api-helper.md)
164
- * [DateTimeHelper](https://www.github.com/sdks-io/tesla-api-ruby-sdk/tree/1.0.1/doc/date-time-helper.md)
162
+ * [ApiResponse](https://www.github.com/sdks-io/tesla-api-ruby-sdk/tree/1.0.2/doc/api-response.md)
163
+ * [ApiHelper](https://www.github.com/sdks-io/tesla-api-ruby-sdk/tree/1.0.2/doc/api-helper.md)
164
+ * [DateTimeHelper](https://www.github.com/sdks-io/tesla-api-ruby-sdk/tree/1.0.2/doc/date-time-helper.md)
165
165
 
@@ -13,9 +13,9 @@ module TeslaFleetManagementApi
13
13
  config.user_agent_detail
14
14
  end
15
15
 
16
- # Returns the configured authentication oauth2 instance.
17
- def oauth2
18
- @auth_managers['oauth2']
16
+ # Returns the configured authentication thirdpartytoken instance.
17
+ def thirdpartytoken
18
+ @auth_managers['thirdpartytoken']
19
19
  end
20
20
 
21
21
  # Access to charging controller.
@@ -66,7 +66,8 @@ module TeslaFleetManagementApi
66
66
  retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
67
67
  retry_methods: %i[get put], http_callback: nil, proxy_settings: nil,
68
68
  logging_configuration: nil, environment: Environment::PRODUCTION,
69
- bearer_auth_credentials: nil, oauth2_credentials: nil, config: nil
69
+ bearer_auth_credentials: nil, thirdpartytoken_credentials: nil,
70
+ config: nil
70
71
  )
71
72
  @config = if config.nil?
72
73
  Configuration.new(
@@ -79,7 +80,7 @@ module TeslaFleetManagementApi
79
80
  logging_configuration: logging_configuration,
80
81
  environment: environment,
81
82
  bearer_auth_credentials: bearer_auth_credentials,
82
- oauth2_credentials: oauth2_credentials
83
+ thirdpartytoken_credentials: thirdpartytoken_credentials
83
84
  )
84
85
  else
85
86
  config
@@ -101,9 +102,11 @@ module TeslaFleetManagementApi
101
102
  def initialize_auth_managers(global_config)
102
103
  @auth_managers = {}
103
104
  http_client_config = global_config.client_configuration
104
- %w[bearerAuth oauth2].each { |auth| @auth_managers[auth] = nil }
105
+ %w[bearerAuth thirdpartytoken].each { |auth| @auth_managers[auth] = nil }
105
106
  @auth_managers['bearerAuth'] = BearerAuth.new(http_client_config.bearer_auth_credentials)
106
- @auth_managers['oauth2'] = Oauth2.new(http_client_config.oauth2_credentials, global_config)
107
+ @auth_managers['thirdpartytoken'] = Thirdpartytoken.new(
108
+ http_client_config.thirdpartytoken_credentials, global_config
109
+ )
107
110
  end
108
111
 
109
112
  # Creates a client directly from environment variables.
@@ -46,7 +46,8 @@ module TeslaFleetManagementApi
46
46
  # are configured in this class.
47
47
  class Configuration < CoreLibrary::HttpClientConfiguration
48
48
  # The attribute readers for properties.
49
- attr_reader :environment, :bearer_auth_credentials, :oauth2_credentials
49
+ attr_reader :environment, :bearer_auth_credentials,
50
+ :thirdpartytoken_credentials
50
51
 
51
52
  class << self
52
53
  attr_reader :environments
@@ -58,7 +59,7 @@ module TeslaFleetManagementApi
58
59
  retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
59
60
  retry_methods: %i[get put], http_callback: nil, proxy_settings: nil,
60
61
  logging_configuration: nil, environment: Environment::PRODUCTION,
61
- bearer_auth_credentials: nil, oauth2_credentials: nil
62
+ bearer_auth_credentials: nil, thirdpartytoken_credentials: nil
62
63
  )
63
64
  super connection: connection, adapter: adapter, timeout: timeout,
64
65
  max_retries: max_retries, retry_interval: retry_interval,
@@ -74,7 +75,7 @@ module TeslaFleetManagementApi
74
75
  @bearer_auth_credentials = bearer_auth_credentials
75
76
 
76
77
  # The object holding OAuth 2 Authorization Code Grant credentials
77
- @oauth2_credentials = oauth2_credentials
78
+ @thirdpartytoken_credentials = thirdpartytoken_credentials
78
79
 
79
80
  # The Http Client to use for making requests.
80
81
  set_http_client CoreLibrary::FaradayClient.new(self)
@@ -85,7 +86,7 @@ module TeslaFleetManagementApi
85
86
  retry_statuses: nil, retry_methods: nil, http_callback: nil,
86
87
  proxy_settings: nil, logging_configuration: nil,
87
88
  environment: nil, bearer_auth_credentials: nil,
88
- oauth2_credentials: nil)
89
+ thirdpartytoken_credentials: nil)
89
90
  connection ||= self.connection
90
91
  adapter ||= self.adapter
91
92
  timeout ||= self.timeout
@@ -99,20 +100,18 @@ module TeslaFleetManagementApi
99
100
  logging_configuration ||= self.logging_configuration
100
101
  environment ||= self.environment
101
102
  bearer_auth_credentials ||= self.bearer_auth_credentials
102
- oauth2_credentials ||= self.oauth2_credentials
103
-
104
- Configuration.new(connection: connection, adapter: adapter,
105
- timeout: timeout, max_retries: max_retries,
106
- retry_interval: retry_interval,
107
- backoff_factor: backoff_factor,
108
- retry_statuses: retry_statuses,
109
- retry_methods: retry_methods,
110
- http_callback: http_callback,
111
- proxy_settings: proxy_settings,
112
- logging_configuration: logging_configuration,
113
- environment: environment,
114
- bearer_auth_credentials: bearer_auth_credentials,
115
- oauth2_credentials: oauth2_credentials)
103
+ thirdpartytoken_credentials ||= self.thirdpartytoken_credentials
104
+
105
+ Configuration.new(
106
+ connection: connection, adapter: adapter, timeout: timeout,
107
+ max_retries: max_retries, retry_interval: retry_interval,
108
+ backoff_factor: backoff_factor, retry_statuses: retry_statuses,
109
+ retry_methods: retry_methods, http_callback: http_callback,
110
+ proxy_settings: proxy_settings,
111
+ logging_configuration: logging_configuration, environment: environment,
112
+ bearer_auth_credentials: bearer_auth_credentials,
113
+ thirdpartytoken_credentials: thirdpartytoken_credentials
114
+ )
116
115
  end
117
116
 
118
117
 
@@ -156,7 +155,7 @@ module TeslaFleetManagementApi
156
155
 
157
156
  # === Authentication credentials ===
158
157
  bearer_auth_credentials = BearerAuthCredentials.from_env
159
- oauth2_credentials = Oauth2Credentials.from_env
158
+ thirdpartytoken_credentials = ThirdpartytokenCredentials.from_env
160
159
 
161
160
  # === Proxy settings ===
162
161
  proxy_settings = ProxySettings.from_env
@@ -172,7 +171,7 @@ module TeslaFleetManagementApi
172
171
  retry_statuses: retry_statuses,
173
172
  retry_methods: retry_methods,
174
173
  bearer_auth_credentials: bearer_auth_credentials,
175
- oauth2_credentials: oauth2_credentials,
174
+ thirdpartytoken_credentials: thirdpartytoken_credentials,
176
175
  proxy_settings: proxy_settings,
177
176
  logging_configuration: logging_configuration
178
177
  )
@@ -10,7 +10,7 @@ module TeslaFleetManagementApi
10
10
  attr_accessor :config, :http_call_back
11
11
 
12
12
  def self.user_agent
13
- 'Ruby SDK, Version: 1.0.1, on OS {os-info}'
13
+ 'Ruby SDK, Version: 1.0.2, on OS {os-info}'
14
14
  end
15
15
 
16
16
  def self.user_agent_parameters
@@ -14,7 +14,7 @@ module TeslaFleetManagementApi
14
14
  '/api/1/dx/charging/history',
15
15
  Server::DEFAULT)
16
16
  .header_param(new_parameter('application/json', key: 'accept'))
17
- .auth(And.new('bearerAuth', 'oauth2')))
17
+ .auth(And.new('bearerAuth', 'thirdpartytoken')))
18
18
  .response(new_response_handler
19
19
  .deserializer(APIHelper.method(:custom_type_deserializer))
20
20
  .deserialize_into(ChargingHistoryResponse.method(:from_hash))
@@ -35,7 +35,7 @@ module TeslaFleetManagementApi
35
35
  .is_required(true)
36
36
  .should_encode(true))
37
37
  .header_param(new_parameter('application/json', key: 'accept'))
38
- .auth(And.new('bearerAuth', 'oauth2')))
38
+ .auth(And.new('bearerAuth', 'thirdpartytoken')))
39
39
  .response(new_response_handler
40
40
  .deserializer(APIHelper.method(:dynamic_deserializer))
41
41
  .is_api_response(true))
@@ -51,7 +51,7 @@ module TeslaFleetManagementApi
51
51
  '/api/1/dx/charging/sessions',
52
52
  Server::DEFAULT)
53
53
  .header_param(new_parameter('application/json', key: 'accept'))
54
- .auth(And.new('bearerAuth', 'oauth2')))
54
+ .auth(And.new('bearerAuth', 'thirdpartytoken')))
55
55
  .response(new_response_handler
56
56
  .deserializer(APIHelper.method(:custom_type_deserializer))
57
57
  .deserialize_into(ChargingSessionsResponse.method(:from_hash))
@@ -26,7 +26,7 @@ module TeslaFleetManagementApi
26
26
  .is_required(true))
27
27
  .header_param(new_parameter('application/json', key: 'accept'))
28
28
  .body_serializer(proc do |param| param.to_json unless param.nil? end)
29
- .auth(And.new('bearerAuth', 'oauth2')))
29
+ .auth(And.new('bearerAuth', 'thirdpartytoken')))
30
30
  .response(new_response_handler
31
31
  .deserializer(APIHelper.method(:custom_type_deserializer))
32
32
  .deserialize_into(BackupResponse.method(:from_hash))
@@ -68,7 +68,7 @@ module TeslaFleetManagementApi
68
68
  .query_param(new_parameter(period, key: 'period'))
69
69
  .query_param(new_parameter(time_zone, key: 'time_zone'))
70
70
  .header_param(new_parameter('application/json', key: 'accept'))
71
- .auth(And.new('bearerAuth', 'oauth2')))
71
+ .auth(And.new('bearerAuth', 'thirdpartytoken')))
72
72
  .response(new_response_handler
73
73
  .deserializer(APIHelper.method(:custom_type_deserializer))
74
74
  .deserialize_into(CalendarHistoryResponse.method(:from_hash))
@@ -108,7 +108,7 @@ module TeslaFleetManagementApi
108
108
  .is_required(true))
109
109
  .query_param(new_parameter(time_zone, key: 'time_zone'))
110
110
  .header_param(new_parameter('application/json', key: 'accept'))
111
- .auth(And.new('bearerAuth', 'oauth2')))
111
+ .auth(And.new('bearerAuth', 'thirdpartytoken')))
112
112
  .response(new_response_handler
113
113
  .deserializer(APIHelper.method(:custom_type_deserializer))
114
114
  .deserialize_into(ChargeHistoryResponse.method(:from_hash))
@@ -129,7 +129,7 @@ module TeslaFleetManagementApi
129
129
  .is_required(true)
130
130
  .should_encode(true))
131
131
  .header_param(new_parameter('application/json', key: 'accept'))
132
- .auth(And.new('bearerAuth', 'oauth2')))
132
+ .auth(And.new('bearerAuth', 'thirdpartytoken')))
133
133
  .response(new_response_handler
134
134
  .deserializer(APIHelper.method(:custom_type_deserializer))
135
135
  .deserialize_into(LiveStatusResponse.method(:from_hash))
@@ -157,7 +157,7 @@ module TeslaFleetManagementApi
157
157
  .is_required(true))
158
158
  .header_param(new_parameter('application/json', key: 'accept'))
159
159
  .body_serializer(proc do |param| param.to_json unless param.nil? end)
160
- .auth(And.new('bearerAuth', 'oauth2')))
160
+ .auth(And.new('bearerAuth', 'thirdpartytoken')))
161
161
  .response(new_response_handler
162
162
  .deserializer(APIHelper.method(:custom_type_deserializer))
163
163
  .deserialize_into(GenericUpdateResponse.method(:from_hash))
@@ -183,7 +183,7 @@ module TeslaFleetManagementApi
183
183
  .body_param(new_parameter(body))
184
184
  .header_param(new_parameter('application/json', key: 'accept'))
185
185
  .body_serializer(APIHelper.method(:json_serialize))
186
- .auth(And.new('bearerAuth', 'oauth2')))
186
+ .auth(And.new('bearerAuth', 'thirdpartytoken')))
187
187
  .response(new_response_handler
188
188
  .deserializer(APIHelper.method(:custom_type_deserializer))
189
189
  .deserialize_into(GenericUpdateResponse.method(:from_hash))
@@ -211,7 +211,7 @@ module TeslaFleetManagementApi
211
211
  .is_required(true))
212
212
  .header_param(new_parameter('application/json', key: 'accept'))
213
213
  .body_serializer(proc do |param| param.to_json unless param.nil? end)
214
- .auth(And.new('bearerAuth', 'oauth2')))
214
+ .auth(And.new('bearerAuth', 'thirdpartytoken')))
215
215
  .response(new_response_handler
216
216
  .deserializer(APIHelper.method(:custom_type_deserializer))
217
217
  .deserialize_into(GenericUpdateResponse.method(:from_hash))
@@ -239,7 +239,7 @@ module TeslaFleetManagementApi
239
239
  .is_required(true))
240
240
  .header_param(new_parameter('application/json', key: 'accept'))
241
241
  .body_serializer(proc do |param| param.to_json unless param.nil? end)
242
- .auth(And.new('bearerAuth', 'oauth2')))
242
+ .auth(And.new('bearerAuth', 'thirdpartytoken')))
243
243
  .response(new_response_handler
244
244
  .deserializer(APIHelper.method(:custom_type_deserializer))
245
245
  .deserialize_into(GenericUpdateResponse.method(:from_hash))
@@ -267,7 +267,7 @@ module TeslaFleetManagementApi
267
267
  .is_required(true))
268
268
  .header_param(new_parameter('application/json', key: 'accept'))
269
269
  .body_serializer(proc do |param| param.to_json unless param.nil? end)
270
- .auth(And.new('bearerAuth', 'oauth2')))
270
+ .auth(And.new('bearerAuth', 'thirdpartytoken')))
271
271
  .response(new_response_handler
272
272
  .deserializer(APIHelper.method(:custom_type_deserializer))
273
273
  .deserialize_into(GenericUpdateResponse.method(:from_hash))
@@ -283,7 +283,7 @@ module TeslaFleetManagementApi
283
283
  '/api/1/products',
284
284
  Server::DEFAULT)
285
285
  .header_param(new_parameter('application/json', key: 'accept'))
286
- .auth(And.new('bearerAuth', 'oauth2')))
286
+ .auth(And.new('bearerAuth', 'thirdpartytoken')))
287
287
  .response(new_response_handler
288
288
  .deserializer(APIHelper.method(:custom_type_deserializer))
289
289
  .deserialize_into(ProductsResponse.method(:from_hash))
@@ -304,7 +304,7 @@ module TeslaFleetManagementApi
304
304
  .is_required(true)
305
305
  .should_encode(true))
306
306
  .header_param(new_parameter('application/json', key: 'accept'))
307
- .auth(And.new('bearerAuth', 'oauth2')))
307
+ .auth(And.new('bearerAuth', 'thirdpartytoken')))
308
308
  .response(new_response_handler
309
309
  .deserializer(APIHelper.method(:custom_type_deserializer))
310
310
  .deserialize_into(SiteInfoResponse.method(:from_hash))
@@ -14,10 +14,10 @@ module TeslaFleetManagementApi
14
14
  # @param [Hash] _field_parameters Additional optional form parameters are
15
15
  # supported by this endpoint.
16
16
  # @return [ApiResponse] Complete http response with raw body and status code.
17
- def request_token_oauth2(authorization,
18
- code,
19
- redirect_uri,
20
- _field_parameters: nil)
17
+ def request_token_thirdpartytoken(authorization,
18
+ code,
19
+ redirect_uri,
20
+ _field_parameters: nil)
21
21
  @api_call
22
22
  .request(new_request_builder(HttpMethodEnum::POST,
23
23
  '/token',
@@ -54,10 +54,10 @@ module TeslaFleetManagementApi
54
54
  # @param [Hash] _field_parameters Additional optional form parameters are
55
55
  # supported by this endpoint.
56
56
  # @return [ApiResponse] Complete http response with raw body and status code.
57
- def refresh_token_oauth2(authorization,
58
- refresh_token,
59
- scope: nil,
60
- _field_parameters: nil)
57
+ def refresh_token_thirdpartytoken(authorization,
58
+ refresh_token,
59
+ scope: nil,
60
+ _field_parameters: nil)
61
61
  @api_call
62
62
  .request(new_request_builder(HttpMethodEnum::POST,
63
63
  '/token',
@@ -14,7 +14,7 @@ module TeslaFleetManagementApi
14
14
  '/api/1/partner_accounts/fleet_telemetry_error_vins',
15
15
  Server::DEFAULT)
16
16
  .header_param(new_parameter('application/json', key: 'accept'))
17
- .auth(And.new('bearerAuth', 'oauth2')))
17
+ .auth(And.new('bearerAuth', 'thirdpartytoken')))
18
18
  .response(new_response_handler
19
19
  .deserializer(APIHelper.method(:custom_type_deserializer))
20
20
  .deserialize_into(BackupResponse.method(:from_hash))
@@ -30,7 +30,7 @@ module TeslaFleetManagementApi
30
30
  '/api/1/partner_accounts/fleet_telemetry_errors',
31
31
  Server::DEFAULT)
32
32
  .header_param(new_parameter('application/json', key: 'accept'))
33
- .auth(And.new('bearerAuth', 'oauth2')))
33
+ .auth(And.new('bearerAuth', 'thirdpartytoken')))
34
34
  .response(new_response_handler
35
35
  .deserializer(APIHelper.method(:custom_type_deserializer))
36
36
  .deserialize_into(FleetTelemetryErrorsResponse.method(:from_hash))
@@ -49,7 +49,7 @@ module TeslaFleetManagementApi
49
49
  .query_param(new_parameter(domain, key: 'domain')
50
50
  .is_required(true))
51
51
  .header_param(new_parameter('application/json', key: 'accept'))
52
- .auth(And.new('bearerAuth', 'oauth2')))
52
+ .auth(And.new('bearerAuth', 'thirdpartytoken')))
53
53
  .response(new_response_handler
54
54
  .deserializer(APIHelper.method(:custom_type_deserializer))
55
55
  .deserialize_into(PublicKeyResponse.method(:from_hash))
@@ -71,7 +71,7 @@ module TeslaFleetManagementApi
71
71
  .is_required(true))
72
72
  .header_param(new_parameter('application/json', key: 'accept'))
73
73
  .body_serializer(proc do |param| param.to_json unless param.nil? end)
74
- .auth(And.new('bearerAuth', 'oauth2')))
74
+ .auth(And.new('bearerAuth', 'thirdpartytoken')))
75
75
  .response(new_response_handler
76
76
  .deserializer(APIHelper.method(:custom_type_deserializer))
77
77
  .deserialize_into(RegisterPartnerResponse.method(:from_hash))
@@ -14,7 +14,7 @@ module TeslaFleetManagementApi
14
14
  '/api/1/users/feature_config',
15
15
  Server::DEFAULT)
16
16
  .header_param(new_parameter('application/json', key: 'accept'))
17
- .auth(And.new('bearerAuth', 'oauth2')))
17
+ .auth(And.new('bearerAuth', 'thirdpartytoken')))
18
18
  .response(new_response_handler
19
19
  .deserializer(APIHelper.method(:custom_type_deserializer))
20
20
  .deserialize_into(BackupResponse.method(:from_hash))
@@ -30,7 +30,7 @@ module TeslaFleetManagementApi
30
30
  '/api/1/users/me',
31
31
  Server::DEFAULT)
32
32
  .header_param(new_parameter('application/json', key: 'accept'))
33
- .auth(And.new('bearerAuth', 'oauth2')))
33
+ .auth(And.new('bearerAuth', 'thirdpartytoken')))
34
34
  .response(new_response_handler
35
35
  .deserializer(APIHelper.method(:custom_type_deserializer))
36
36
  .deserialize_into(MeResponse.method(:from_hash))
@@ -46,7 +46,7 @@ module TeslaFleetManagementApi
46
46
  '/api/1/users/orders',
47
47
  Server::DEFAULT)
48
48
  .header_param(new_parameter('application/json', key: 'accept'))
49
- .auth(And.new('bearerAuth', 'oauth2')))
49
+ .auth(And.new('bearerAuth', 'thirdpartytoken')))
50
50
  .response(new_response_handler
51
51
  .deserializer(APIHelper.method(:custom_type_deserializer))
52
52
  .deserialize_into(OrdersResponse.method(:from_hash))
@@ -62,7 +62,7 @@ module TeslaFleetManagementApi
62
62
  '/api/1/users/region',
63
63
  Server::DEFAULT)
64
64
  .header_param(new_parameter('application/json', key: 'accept'))
65
- .auth(And.new('bearerAuth', 'oauth2')))
65
+ .auth(And.new('bearerAuth', 'thirdpartytoken')))
66
66
  .response(new_response_handler
67
67
  .deserializer(APIHelper.method(:custom_type_deserializer))
68
68
  .deserialize_into(RegionResponse.method(:from_hash))
@@ -26,7 +26,7 @@ module TeslaFleetManagementApi
26
26
  .is_required(true))
27
27
  .header_param(new_parameter('application/json', key: 'accept'))
28
28
  .body_serializer(proc do |param| param.to_json unless param.nil? end)
29
- .auth(And.new('bearerAuth', 'oauth2')))
29
+ .auth(And.new('bearerAuth', 'thirdpartytoken')))
30
30
  .response(new_response_handler
31
31
  .deserializer(APIHelper.method(:custom_type_deserializer))
32
32
  .deserialize_into(CommandResponse.method(:from_hash))
@@ -54,7 +54,7 @@ module TeslaFleetManagementApi
54
54
  .is_required(true))
55
55
  .header_param(new_parameter('application/json', key: 'accept'))
56
56
  .body_serializer(proc do |param| param.to_json unless param.nil? end)
57
- .auth(And.new('bearerAuth', 'oauth2')))
57
+ .auth(And.new('bearerAuth', 'thirdpartytoken')))
58
58
  .response(new_response_handler
59
59
  .deserializer(APIHelper.method(:custom_type_deserializer))
60
60
  .deserialize_into(CommandResponse.method(:from_hash))
@@ -82,7 +82,7 @@ module TeslaFleetManagementApi
82
82
  .is_required(true))
83
83
  .header_param(new_parameter('application/json', key: 'accept'))
84
84
  .body_serializer(proc do |param| param.to_json unless param.nil? end)
85
- .auth(And.new('bearerAuth', 'oauth2')))
85
+ .auth(And.new('bearerAuth', 'thirdpartytoken')))
86
86
  .response(new_response_handler
87
87
  .deserializer(APIHelper.method(:custom_type_deserializer))
88
88
  .deserialize_into(CommandResponse.method(:from_hash))
@@ -110,7 +110,7 @@ module TeslaFleetManagementApi
110
110
  .is_required(true))
111
111
  .header_param(new_parameter('application/json', key: 'accept'))
112
112
  .body_serializer(proc do |param| param.to_json unless param.nil? end)
113
- .auth(And.new('bearerAuth', 'oauth2')))
113
+ .auth(And.new('bearerAuth', 'thirdpartytoken')))
114
114
  .response(new_response_handler
115
115
  .deserializer(APIHelper.method(:custom_type_deserializer))
116
116
  .deserialize_into(CommandResponse.method(:from_hash))
@@ -131,7 +131,7 @@ module TeslaFleetManagementApi
131
131
  .is_required(true)
132
132
  .should_encode(true))
133
133
  .header_param(new_parameter('application/json', key: 'accept'))
134
- .auth(And.new('bearerAuth', 'oauth2')))
134
+ .auth(And.new('bearerAuth', 'thirdpartytoken')))
135
135
  .response(new_response_handler
136
136
  .deserializer(APIHelper.method(:custom_type_deserializer))
137
137
  .deserialize_into(CommandResponse.method(:from_hash))
@@ -152,7 +152,7 @@ module TeslaFleetManagementApi
152
152
  .is_required(true)
153
153
  .should_encode(true))
154
154
  .header_param(new_parameter('application/json', key: 'accept'))
155
- .auth(And.new('bearerAuth', 'oauth2')))
155
+ .auth(And.new('bearerAuth', 'thirdpartytoken')))
156
156
  .response(new_response_handler
157
157
  .deserializer(APIHelper.method(:custom_type_deserializer))
158
158
  .deserialize_into(CommandResponse.method(:from_hash))
@@ -173,7 +173,7 @@ module TeslaFleetManagementApi
173
173
  .is_required(true)
174
174
  .should_encode(true))
175
175
  .header_param(new_parameter('application/json', key: 'accept'))
176
- .auth(And.new('bearerAuth', 'oauth2')))
176
+ .auth(And.new('bearerAuth', 'thirdpartytoken')))
177
177
  .response(new_response_handler
178
178
  .deserializer(APIHelper.method(:custom_type_deserializer))
179
179
  .deserialize_into(CommandResponse.method(:from_hash))
@@ -194,7 +194,7 @@ module TeslaFleetManagementApi
194
194
  .is_required(true)
195
195
  .should_encode(true))
196
196
  .header_param(new_parameter('application/json', key: 'accept'))
197
- .auth(And.new('bearerAuth', 'oauth2')))
197
+ .auth(And.new('bearerAuth', 'thirdpartytoken')))
198
198
  .response(new_response_handler
199
199
  .deserializer(APIHelper.method(:custom_type_deserializer))
200
200
  .deserialize_into(CommandResponse.method(:from_hash))
@@ -215,7 +215,7 @@ module TeslaFleetManagementApi
215
215
  .is_required(true)
216
216
  .should_encode(true))
217
217
  .header_param(new_parameter('application/json', key: 'accept'))
218
- .auth(And.new('bearerAuth', 'oauth2')))
218
+ .auth(And.new('bearerAuth', 'thirdpartytoken')))
219
219
  .response(new_response_handler
220
220
  .deserializer(APIHelper.method(:custom_type_deserializer))
221
221
  .deserialize_into(CommandResponse.method(:from_hash))
@@ -236,7 +236,7 @@ module TeslaFleetManagementApi
236
236
  .is_required(true)
237
237
  .should_encode(true))
238
238
  .header_param(new_parameter('application/json', key: 'accept'))
239
- .auth(And.new('bearerAuth', 'oauth2')))
239
+ .auth(And.new('bearerAuth', 'thirdpartytoken')))
240
240
  .response(new_response_handler
241
241
  .deserializer(APIHelper.method(:custom_type_deserializer))
242
242
  .deserialize_into(CommandResponse.method(:from_hash))
@@ -257,7 +257,7 @@ module TeslaFleetManagementApi
257
257
  .is_required(true)
258
258
  .should_encode(true))
259
259
  .header_param(new_parameter('application/json', key: 'accept'))
260
- .auth(And.new('bearerAuth', 'oauth2')))
260
+ .auth(And.new('bearerAuth', 'thirdpartytoken')))
261
261
  .response(new_response_handler
262
262
  .deserializer(APIHelper.method(:custom_type_deserializer))
263
263
  .deserialize_into(CommandResponse.method(:from_hash))
@@ -278,7 +278,7 @@ module TeslaFleetManagementApi
278
278
  .is_required(true)
279
279
  .should_encode(true))
280
280
  .header_param(new_parameter('application/json', key: 'accept'))
281
- .auth(And.new('bearerAuth', 'oauth2')))
281
+ .auth(And.new('bearerAuth', 'thirdpartytoken')))
282
282
  .response(new_response_handler
283
283
  .deserializer(APIHelper.method(:custom_type_deserializer))
284
284
  .deserialize_into(CommandResponse.method(:from_hash))
@@ -299,7 +299,7 @@ module TeslaFleetManagementApi
299
299
  .is_required(true)
300
300
  .should_encode(true))
301
301
  .header_param(new_parameter('application/json', key: 'accept'))
302
- .auth(And.new('bearerAuth', 'oauth2')))
302
+ .auth(And.new('bearerAuth', 'thirdpartytoken')))
303
303
  .response(new_response_handler
304
304
  .deserializer(APIHelper.method(:custom_type_deserializer))
305
305
  .deserialize_into(CommandResponse.method(:from_hash))
@@ -321,7 +321,7 @@ module TeslaFleetManagementApi
321
321
  .is_required(true)
322
322
  .should_encode(true))
323
323
  .header_param(new_parameter('application/json', key: 'accept'))
324
- .auth(And.new('bearerAuth', 'oauth2')))
324
+ .auth(And.new('bearerAuth', 'thirdpartytoken')))
325
325
  .response(new_response_handler
326
326
  .deserializer(APIHelper.method(:custom_type_deserializer))
327
327
  .deserialize_into(CommandResponse.method(:from_hash))
@@ -342,7 +342,7 @@ module TeslaFleetManagementApi
342
342
  .is_required(true)
343
343
  .should_encode(true))
344
344
  .header_param(new_parameter('application/json', key: 'accept'))
345
- .auth(And.new('bearerAuth', 'oauth2')))
345
+ .auth(And.new('bearerAuth', 'thirdpartytoken')))
346
346
  .response(new_response_handler
347
347
  .deserializer(APIHelper.method(:custom_type_deserializer))
348
348
  .deserialize_into(CommandResponse.method(:from_hash))
@@ -363,7 +363,7 @@ module TeslaFleetManagementApi
363
363
  .is_required(true)
364
364
  .should_encode(true))
365
365
  .header_param(new_parameter('application/json', key: 'accept'))
366
- .auth(And.new('bearerAuth', 'oauth2')))
366
+ .auth(And.new('bearerAuth', 'thirdpartytoken')))
367
367
  .response(new_response_handler
368
368
  .deserializer(APIHelper.method(:custom_type_deserializer))
369
369
  .deserialize_into(CommandResponse.method(:from_hash))
@@ -384,7 +384,7 @@ module TeslaFleetManagementApi
384
384
  .is_required(true)
385
385
  .should_encode(true))
386
386
  .header_param(new_parameter('application/json', key: 'accept'))
387
- .auth(And.new('bearerAuth', 'oauth2')))
387
+ .auth(And.new('bearerAuth', 'thirdpartytoken')))
388
388
  .response(new_response_handler
389
389
  .deserializer(APIHelper.method(:custom_type_deserializer))
390
390
  .deserialize_into(CommandResponse.method(:from_hash))
@@ -405,7 +405,7 @@ module TeslaFleetManagementApi
405
405
  .is_required(true)
406
406
  .should_encode(true))
407
407
  .header_param(new_parameter('application/json', key: 'accept'))
408
- .auth(And.new('bearerAuth', 'oauth2')))
408
+ .auth(And.new('bearerAuth', 'thirdpartytoken')))
409
409
  .response(new_response_handler
410
410
  .deserializer(APIHelper.method(:custom_type_deserializer))
411
411
  .deserialize_into(CommandResponse.method(:from_hash))
@@ -433,7 +433,7 @@ module TeslaFleetManagementApi
433
433
  .is_required(true))
434
434
  .header_param(new_parameter('application/json', key: 'accept'))
435
435
  .body_serializer(proc do |param| param.to_json unless param.nil? end)
436
- .auth(And.new('bearerAuth', 'oauth2')))
436
+ .auth(And.new('bearerAuth', 'thirdpartytoken')))
437
437
  .response(new_response_handler
438
438
  .deserializer(APIHelper.method(:custom_type_deserializer))
439
439
  .deserialize_into(CommandResponse.method(:from_hash))
@@ -454,7 +454,7 @@ module TeslaFleetManagementApi
454
454
  .is_required(true)
455
455
  .should_encode(true))
456
456
  .header_param(new_parameter('application/json', key: 'accept'))
457
- .auth(And.new('bearerAuth', 'oauth2')))
457
+ .auth(And.new('bearerAuth', 'thirdpartytoken')))
458
458
  .response(new_response_handler
459
459
  .deserializer(APIHelper.method(:custom_type_deserializer))
460
460
  .deserialize_into(CommandResponse.method(:from_hash))
@@ -475,7 +475,7 @@ module TeslaFleetManagementApi
475
475
  .is_required(true)
476
476
  .should_encode(true))
477
477
  .header_param(new_parameter('application/json', key: 'accept'))
478
- .auth(And.new('bearerAuth', 'oauth2')))
478
+ .auth(And.new('bearerAuth', 'thirdpartytoken')))
479
479
  .response(new_response_handler
480
480
  .deserializer(APIHelper.method(:custom_type_deserializer))
481
481
  .deserialize_into(CommandResponse.method(:from_hash))
@@ -14,7 +14,7 @@ module TeslaFleetManagementApi
14
14
  '/api/1/vehicles',
15
15
  Server::DEFAULT)
16
16
  .header_param(new_parameter('application/json', key: 'accept'))
17
- .auth(And.new('bearerAuth', 'oauth2')))
17
+ .auth(And.new('bearerAuth', 'thirdpartytoken')))
18
18
  .response(new_response_handler
19
19
  .deserializer(APIHelper.method(:custom_type_deserializer))
20
20
  .deserialize_into(Api1VehiclesResponse.method(:from_hash))
@@ -35,7 +35,7 @@ module TeslaFleetManagementApi
35
35
  .is_required(true)
36
36
  .should_encode(true))
37
37
  .header_param(new_parameter('application/json', key: 'accept'))
38
- .auth(And.new('bearerAuth', 'oauth2')))
38
+ .auth(And.new('bearerAuth', 'thirdpartytoken')))
39
39
  .response(new_response_handler
40
40
  .deserializer(APIHelper.method(:custom_type_deserializer))
41
41
  .deserialize_into(Api1VehiclesResponseGetVehicle.method(:from_hash))
@@ -56,7 +56,7 @@ module TeslaFleetManagementApi
56
56
  .is_required(true)
57
57
  .should_encode(true))
58
58
  .header_param(new_parameter('application/json', key: 'accept'))
59
- .auth(And.new('bearerAuth', 'oauth2')))
59
+ .auth(And.new('bearerAuth', 'thirdpartytoken')))
60
60
  .response(new_response_handler
61
61
  .deserializer(APIHelper.method(:custom_type_deserializer))
62
62
  .deserialize_into(Api1VehiclesMobileEnabledResponse.method(:from_hash))
@@ -77,7 +77,7 @@ module TeslaFleetManagementApi
77
77
  .is_required(true)
78
78
  .should_encode(true))
79
79
  .header_param(new_parameter('application/json', key: 'accept'))
80
- .auth(And.new('bearerAuth', 'oauth2')))
80
+ .auth(And.new('bearerAuth', 'thirdpartytoken')))
81
81
  .response(new_response_handler
82
82
  .deserializer(APIHelper.method(:custom_type_deserializer))
83
83
  .deserialize_into(Api1VehiclesNearbyChargingSitesResponse.method(:from_hash))
@@ -98,7 +98,7 @@ module TeslaFleetManagementApi
98
98
  .is_required(true)
99
99
  .should_encode(true))
100
100
  .header_param(new_parameter('application/json', key: 'accept'))
101
- .auth(And.new('bearerAuth', 'oauth2')))
101
+ .auth(And.new('bearerAuth', 'thirdpartytoken')))
102
102
  .response(new_response_handler
103
103
  .deserializer(APIHelper.method(:custom_type_deserializer))
104
104
  .deserialize_into(SiteInfoResponse.method(:from_hash))
@@ -119,7 +119,7 @@ module TeslaFleetManagementApi
119
119
  .is_required(true)
120
120
  .should_encode(true))
121
121
  .header_param(new_parameter('application/json', key: 'accept'))
122
- .auth(And.new('bearerAuth', 'oauth2')))
122
+ .auth(And.new('bearerAuth', 'thirdpartytoken')))
123
123
  .response(new_response_handler
124
124
  .deserializer(APIHelper.method(:custom_type_deserializer))
125
125
  .deserialize_into(Api1VehiclesWakeUpResponse.method(:from_hash))
@@ -139,7 +139,7 @@ module TeslaFleetManagementApi
139
139
  .is_required(true)
140
140
  .should_encode(true))
141
141
  .header_param(new_parameter('application/json', key: 'accept'))
142
- .auth(And.new('bearerAuth', 'oauth2')))
142
+ .auth(And.new('bearerAuth', 'thirdpartytoken')))
143
143
  .response(new_response_handler
144
144
  .deserializer(APIHelper.method(:custom_type_deserializer))
145
145
  .deserialize_into(SiteInfoResponse.method(:from_hash))
@@ -158,7 +158,7 @@ module TeslaFleetManagementApi
158
158
  .query_param(new_parameter(vin, key: 'vin')
159
159
  .is_required(true))
160
160
  .header_param(new_parameter('application/json', key: 'accept'))
161
- .auth(And.new('bearerAuth', 'oauth2')))
161
+ .auth(And.new('bearerAuth', 'thirdpartytoken')))
162
162
  .response(new_response_handler
163
163
  .deserializer(APIHelper.method(:custom_type_deserializer))
164
164
  .deserialize_into(Api1DxVehiclesOptionsResponse.method(:from_hash))
@@ -174,7 +174,7 @@ module TeslaFleetManagementApi
174
174
  '/api/1/dx/warranty/details',
175
175
  Server::DEFAULT)
176
176
  .header_param(new_parameter('application/json', key: 'accept'))
177
- .auth(And.new('bearerAuth', 'oauth2')))
177
+ .auth(And.new('bearerAuth', 'thirdpartytoken')))
178
178
  .response(new_response_handler
179
179
  .deserializer(APIHelper.method(:custom_type_deserializer))
180
180
  .deserialize_into(Api1DxWarrantyDetailsResponse.method(:from_hash))
@@ -195,7 +195,7 @@ module TeslaFleetManagementApi
195
195
  .is_required(true)
196
196
  .should_encode(true))
197
197
  .header_param(new_parameter('application/json', key: 'accept'))
198
- .auth(And.new('bearerAuth', 'oauth2')))
198
+ .auth(And.new('bearerAuth', 'thirdpartytoken')))
199
199
  .response(new_response_handler
200
200
  .deserializer(APIHelper.method(:custom_type_deserializer))
201
201
  .deserialize_into(DriversResponse.method(:from_hash))
@@ -216,7 +216,7 @@ module TeslaFleetManagementApi
216
216
  .is_required(true)
217
217
  .should_encode(true))
218
218
  .header_param(new_parameter('application/json', key: 'accept'))
219
- .auth(And.new('bearerAuth', 'oauth2')))
219
+ .auth(And.new('bearerAuth', 'thirdpartytoken')))
220
220
  .response(new_response_handler
221
221
  .deserializer(APIHelper.method(:custom_type_deserializer))
222
222
  .deserialize_into(SimpleOkResponse.method(:from_hash))
@@ -235,7 +235,7 @@ module TeslaFleetManagementApi
235
235
  .query_param(new_parameter(vin, key: 'vin')
236
236
  .is_required(true))
237
237
  .header_param(new_parameter('application/json', key: 'accept'))
238
- .auth(And.new('bearerAuth', 'oauth2')))
238
+ .auth(And.new('bearerAuth', 'thirdpartytoken')))
239
239
  .response(new_response_handler
240
240
  .deserializer(APIHelper.method(:custom_type_deserializer))
241
241
  .deserialize_into(SiteInfoResponse.method(:from_hash))
@@ -254,7 +254,7 @@ module TeslaFleetManagementApi
254
254
  .query_param(new_parameter(vin, key: 'vin')
255
255
  .is_required(true))
256
256
  .header_param(new_parameter('application/json', key: 'accept'))
257
- .auth(And.new('bearerAuth', 'oauth2')))
257
+ .auth(And.new('bearerAuth', 'thirdpartytoken')))
258
258
  .response(new_response_handler
259
259
  .deserializer(APIHelper.method(:custom_type_deserializer))
260
260
  .deserialize_into(SiteInfoResponse.method(:from_hash))
@@ -280,7 +280,7 @@ module TeslaFleetManagementApi
280
280
  .body_param(new_parameter(body)
281
281
  .is_required(true))
282
282
  .body_serializer(proc do |param| param.to_json unless param.nil? end)
283
- .auth(And.new('bearerAuth', 'oauth2')))
283
+ .auth(And.new('bearerAuth', 'thirdpartytoken')))
284
284
  .response(new_response_handler
285
285
  .is_response_void(true)
286
286
  .is_api_response(true))
@@ -299,7 +299,7 @@ module TeslaFleetManagementApi
299
299
  .is_required(true)
300
300
  .should_encode(true))
301
301
  .header_param(new_parameter('application/json', key: 'accept'))
302
- .auth(And.new('bearerAuth', 'oauth2')))
302
+ .auth(And.new('bearerAuth', 'thirdpartytoken')))
303
303
  .response(new_response_handler
304
304
  .deserializer(APIHelper.method(:json_deserialize))
305
305
  .is_api_response(true))
@@ -320,7 +320,7 @@ module TeslaFleetManagementApi
320
320
  .is_required(true))
321
321
  .header_param(new_parameter('application/json', key: 'accept'))
322
322
  .body_serializer(proc do |param| param.to_json unless param.nil? end)
323
- .auth(And.new('bearerAuth', 'oauth2')))
323
+ .auth(And.new('bearerAuth', 'thirdpartytoken')))
324
324
  .response(new_response_handler
325
325
  .deserializer(APIHelper.method(:json_deserialize))
326
326
  .is_api_response(true))
@@ -340,7 +340,7 @@ module TeslaFleetManagementApi
340
340
  .is_required(true))
341
341
  .header_param(new_parameter('application/json', key: 'accept'))
342
342
  .body_serializer(APIHelper.method(:json_serialize))
343
- .auth(And.new('bearerAuth', 'oauth2')))
343
+ .auth(And.new('bearerAuth', 'thirdpartytoken')))
344
344
  .response(new_response_handler
345
345
  .deserializer(APIHelper.method(:json_deserialize))
346
346
  .is_api_response(true))
@@ -360,7 +360,7 @@ module TeslaFleetManagementApi
360
360
  .is_required(true)
361
361
  .should_encode(true))
362
362
  .header_param(new_parameter('application/json', key: 'accept'))
363
- .auth(And.new('bearerAuth', 'oauth2')))
363
+ .auth(And.new('bearerAuth', 'thirdpartytoken')))
364
364
  .response(new_response_handler
365
365
  .deserializer(APIHelper.method(:json_deserialize))
366
366
  .is_api_response(true))
@@ -380,7 +380,7 @@ module TeslaFleetManagementApi
380
380
  .is_required(true)
381
381
  .should_encode(true))
382
382
  .header_param(new_parameter('application/json', key: 'accept'))
383
- .auth(And.new('bearerAuth', 'oauth2')))
383
+ .auth(And.new('bearerAuth', 'thirdpartytoken')))
384
384
  .response(new_response_handler
385
385
  .deserializer(APIHelper.method(:json_deserialize))
386
386
  .is_api_response(true))
@@ -401,7 +401,7 @@ module TeslaFleetManagementApi
401
401
  .is_required(true))
402
402
  .header_param(new_parameter('application/json', key: 'accept'))
403
403
  .body_serializer(proc do |param| param.to_json unless param.nil? end)
404
- .auth(And.new('bearerAuth', 'oauth2')))
404
+ .auth(And.new('bearerAuth', 'thirdpartytoken')))
405
405
  .response(new_response_handler
406
406
  .deserializer(APIHelper.method(:json_deserialize))
407
407
  .is_api_response(true))
@@ -421,7 +421,7 @@ module TeslaFleetManagementApi
421
421
  .is_required(true)
422
422
  .should_encode(true))
423
423
  .header_param(new_parameter('application/json', key: 'accept'))
424
- .auth(And.new('bearerAuth', 'oauth2')))
424
+ .auth(And.new('bearerAuth', 'thirdpartytoken')))
425
425
  .response(new_response_handler
426
426
  .deserializer(APIHelper.method(:json_deserialize))
427
427
  .is_api_response(true))
@@ -5,27 +5,27 @@
5
5
 
6
6
  module TeslaFleetManagementApi
7
7
  # Utility class for OAuth 2 authorization and token management.
8
- class Oauth2 < CoreLibrary::HeaderAuth
8
+ class Thirdpartytoken < CoreLibrary::HeaderAuth
9
9
  include CoreLibrary
10
10
  # Display error message on occurrence of authentication failure.
11
11
  # @returns [String] The oAuth error message.
12
12
  def error_message
13
- 'Oauth2: OAuthToken is undefined or expired.'
13
+ 'Thirdpartytoken: OAuthToken is undefined or expired.'
14
14
  end
15
15
 
16
16
  # Initialization constructor.
17
- def initialize(oauth2_credentials, config)
17
+ def initialize(thirdpartytoken_credentials, config)
18
18
  auth_params = {}
19
- @_o_auth_client_id = oauth2_credentials.o_auth_client_id unless
20
- oauth2_credentials.nil? || oauth2_credentials.o_auth_client_id.nil?
21
- @_o_auth_client_secret = oauth2_credentials.o_auth_client_secret unless
22
- oauth2_credentials.nil? || oauth2_credentials.o_auth_client_secret.nil?
23
- @_o_auth_redirect_uri = oauth2_credentials.o_auth_redirect_uri unless
24
- oauth2_credentials.nil? || oauth2_credentials.o_auth_redirect_uri.nil?
25
- @_o_auth_token = oauth2_credentials.o_auth_token unless
26
- oauth2_credentials.nil? || oauth2_credentials.o_auth_token.nil?
27
- @_o_auth_scopes = oauth2_credentials.o_auth_scopes unless
28
- oauth2_credentials.nil? || oauth2_credentials.o_auth_scopes.nil?
19
+ @_o_auth_client_id = thirdpartytoken_credentials.o_auth_client_id unless
20
+ thirdpartytoken_credentials.nil? || thirdpartytoken_credentials.o_auth_client_id.nil?
21
+ @_o_auth_client_secret = thirdpartytoken_credentials.o_auth_client_secret unless
22
+ thirdpartytoken_credentials.nil? || thirdpartytoken_credentials.o_auth_client_secret.nil?
23
+ @_o_auth_redirect_uri = thirdpartytoken_credentials.o_auth_redirect_uri unless
24
+ thirdpartytoken_credentials.nil? || thirdpartytoken_credentials.o_auth_redirect_uri.nil?
25
+ @_o_auth_token = thirdpartytoken_credentials.o_auth_token unless
26
+ thirdpartytoken_credentials.nil? || thirdpartytoken_credentials.o_auth_token.nil?
27
+ @_o_auth_scopes = thirdpartytoken_credentials.o_auth_scopes unless
28
+ thirdpartytoken_credentials.nil? || thirdpartytoken_credentials.o_auth_scopes.nil?
29
29
  @_config = config
30
30
  @_o_auth_api = OAuthAuthorizationController.new(config)
31
31
  auth_params[:Authorization] = "Bearer #{@_o_auth_token.access_token}" unless @_o_auth_token.nil?
@@ -72,7 +72,7 @@ module TeslaFleetManagementApi
72
72
  # @param [Hash] additional_params Any additional form parameters.
73
73
  # @return [OAuthToken] The oAuth token instance.
74
74
  def fetch_token(auth_code, additional_params: nil)
75
- token = @_o_auth_api.request_token_oauth2(
75
+ token = @_o_auth_api.request_token_thirdpartytoken(
76
76
  build_basic_auth_header,
77
77
  auth_code,
78
78
  @_o_auth_redirect_uri,
@@ -95,7 +95,7 @@ module TeslaFleetManagementApi
95
95
  # @param [Hash] additional_params Any additional form parameters.
96
96
  # @return [OAuthToken] The oAuth token instance.
97
97
  def refresh_token(additional_params: nil)
98
- token = @_o_auth_api.refresh_token_oauth2(
98
+ token = @_o_auth_api.refresh_token_thirdpartytoken(
99
99
  build_basic_auth_header,
100
100
  @_o_auth_token.refresh_token,
101
101
  scope: !@_o_auth_scopes.nil? ? Array(@_o_auth_scopes).compact.join(' ') : nil,
@@ -108,8 +108,8 @@ module TeslaFleetManagementApi
108
108
  end
109
109
  end
110
110
 
111
- # Data class for Oauth2Credentials.
112
- class Oauth2Credentials
111
+ # Data class for ThirdpartytokenCredentials.
112
+ class ThirdpartytokenCredentials
113
113
  attr_reader :o_auth_client_id, :o_auth_client_secret, :o_auth_redirect_uri,
114
114
  :o_auth_token, :o_auth_scopes
115
115
 
@@ -127,10 +127,10 @@ module TeslaFleetManagementApi
127
127
  end
128
128
 
129
129
  def self.from_env
130
- o_auth_client_id = ENV['OAUTH2_O_AUTH_CLIENT_ID']
131
- o_auth_client_secret = ENV['OAUTH2_O_AUTH_CLIENT_SECRET']
132
- o_auth_redirect_uri = ENV['OAUTH2_O_AUTH_REDIRECT_URI']
133
- o_auth_scopes = ENV['OAUTH2_O_AUTH_SCOPES']
130
+ o_auth_client_id = ENV['THIRDPARTYTOKEN_O_AUTH_CLIENT_ID']
131
+ o_auth_client_secret = ENV['THIRDPARTYTOKEN_O_AUTH_CLIENT_SECRET']
132
+ o_auth_redirect_uri = ENV['THIRDPARTYTOKEN_O_AUTH_REDIRECT_URI']
133
+ o_auth_scopes = ENV['THIRDPARTYTOKEN_O_AUTH_SCOPES']
134
134
  all_nil = [
135
135
  o_auth_client_id,
136
136
  o_auth_client_secret,
@@ -153,11 +153,11 @@ module TeslaFleetManagementApi
153
153
  o_auth_token ||= self.o_auth_token
154
154
  o_auth_scopes ||= self.o_auth_scopes
155
155
 
156
- Oauth2Credentials.new(o_auth_client_id: o_auth_client_id,
157
- o_auth_client_secret: o_auth_client_secret,
158
- o_auth_redirect_uri: o_auth_redirect_uri,
159
- o_auth_token: o_auth_token,
160
- o_auth_scopes: o_auth_scopes)
156
+ ThirdpartytokenCredentials.new(o_auth_client_id: o_auth_client_id,
157
+ o_auth_client_secret: o_auth_client_secret,
158
+ o_auth_redirect_uri: o_auth_redirect_uri,
159
+ o_auth_token: o_auth_token,
160
+ o_auth_scopes: o_auth_scopes)
161
161
  end
162
162
  end
163
163
  end
@@ -5,8 +5,8 @@
5
5
 
6
6
  module TeslaFleetManagementApi
7
7
  # OAuth 2 scopes supported by the API
8
- class OAuthScopeOauth2
9
- O_AUTH_SCOPE_OAUTH2 = [
8
+ class OAuthScopeThirdpartytoken
9
+ O_AUTH_SCOPE_THIRDPARTYTOKEN = [
10
10
  # Allow Tesla customers to sign in to the application with their Tesla
11
11
  # credentials.
12
12
  OPENID = 'openid'.freeze,
@@ -54,7 +54,7 @@ module TeslaFleetManagementApi
54
54
  def self.validate(value)
55
55
  return false if value.nil?
56
56
 
57
- O_AUTH_SCOPE_OAUTH2.include?(value)
57
+ O_AUTH_SCOPE_THIRDPARTYTOKEN.include?(value)
58
58
  end
59
59
 
60
60
  def self.from_value(value, default_value = OPENID)
@@ -31,7 +31,7 @@ require_relative 'tesla_fleet_management_api/logging/configuration/' \
31
31
  'api_logging_configuration'
32
32
  require_relative 'tesla_fleet_management_api/logging/sdk_logger'
33
33
  require_relative 'tesla_fleet_management_api/http/auth/bearer_auth'
34
- require_relative 'tesla_fleet_management_api/http/auth/oauth2'
34
+ require_relative 'tesla_fleet_management_api/http/auth/thirdpartytoken'
35
35
 
36
36
  # Models
37
37
  require_relative 'tesla_fleet_management_api/models/base_model'
@@ -143,7 +143,8 @@ require_relative 'tesla_fleet_management_api/models/' \
143
143
  'kind_get_wall_connector_charging_history'
144
144
  require_relative 'tesla_fleet_management_api/models/which_trunk'
145
145
  require_relative 'tesla_fleet_management_api/models/o_auth_provider_error'
146
- require_relative 'tesla_fleet_management_api/models/o_auth_scope_oauth2'
146
+ require_relative 'tesla_fleet_management_api/models/' \
147
+ 'o_auth_scope_thirdpartytoken'
147
148
 
148
149
  # Exceptions
149
150
  require_relative 'tesla_fleet_management_api/exceptions/api_exception'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tesla-api-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Muhammad Rafay
@@ -78,7 +78,7 @@ files:
78
78
  - lib/tesla_fleet_management_api/exceptions/o_auth_provider_exception.rb
79
79
  - lib/tesla_fleet_management_api/http/api_response.rb
80
80
  - lib/tesla_fleet_management_api/http/auth/bearer_auth.rb
81
- - lib/tesla_fleet_management_api/http/auth/oauth2.rb
81
+ - lib/tesla_fleet_management_api/http/auth/thirdpartytoken.rb
82
82
  - lib/tesla_fleet_management_api/http/http_call_back.rb
83
83
  - lib/tesla_fleet_management_api/http/http_method_enum.rb
84
84
  - lib/tesla_fleet_management_api/http/http_request.rb
@@ -137,7 +137,7 @@ files:
137
137
  - lib/tesla_fleet_management_api/models/me_response.rb
138
138
  - lib/tesla_fleet_management_api/models/mobile_enabled.rb
139
139
  - lib/tesla_fleet_management_api/models/o_auth_provider_error.rb
140
- - lib/tesla_fleet_management_api/models/o_auth_scope_oauth2.rb
140
+ - lib/tesla_fleet_management_api/models/o_auth_scope_thirdpartytoken.rb
141
141
  - lib/tesla_fleet_management_api/models/o_auth_token.rb
142
142
  - lib/tesla_fleet_management_api/models/off_grid_vehicle_charging_reserve_request.rb
143
143
  - lib/tesla_fleet_management_api/models/operation_request.rb