tesla-api-sdk 1.0.0 → 1.0.1
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 +4 -4
- data/README.md +36 -31
- data/lib/tesla_fleet_management_api/client.rb +14 -8
- data/lib/tesla_fleet_management_api/configuration.rb +8 -8
- data/lib/tesla_fleet_management_api/controllers/base_controller.rb +1 -1
- data/lib/tesla_fleet_management_api/controllers/charging_controller.rb +3 -3
- data/lib/tesla_fleet_management_api/controllers/energy_controller.rb +11 -11
- data/lib/tesla_fleet_management_api/controllers/{oauth_authorization_controller.rb → o_auth_authorization_controller.rb} +16 -16
- data/lib/tesla_fleet_management_api/controllers/partner_controller.rb +4 -4
- data/lib/tesla_fleet_management_api/controllers/user_controller.rb +4 -4
- data/lib/tesla_fleet_management_api/controllers/vehicle_commands_controller.rb +486 -0
- data/lib/tesla_fleet_management_api/controllers/vehicles_controller.rb +21 -21
- data/lib/tesla_fleet_management_api/exceptions/{oauth_provider_exception.rb → o_auth_provider_exception.rb} +2 -2
- data/lib/tesla_fleet_management_api/http/auth/oauth2.rb +163 -0
- data/lib/tesla_fleet_management_api/models/actuate_trunk_request.rb +74 -0
- data/lib/tesla_fleet_management_api/models/add_charge_schedule_request.rb +160 -0
- data/lib/tesla_fleet_management_api/models/add_precondition_schedule_request.rb +132 -0
- data/lib/tesla_fleet_management_api/models/adjust_volume_request.rb +73 -0
- data/lib/tesla_fleet_management_api/models/command_response.rb +75 -0
- data/lib/tesla_fleet_management_api/models/command_result.rb +82 -0
- data/lib/tesla_fleet_management_api/models/guest_mode_request.rb +73 -0
- data/lib/tesla_fleet_management_api/models/kind_get_wall_connector_charging_history.rb +1 -1
- data/lib/tesla_fleet_management_api/models/{oauth_provider_error.rb → o_auth_provider_error.rb} +3 -3
- data/lib/tesla_fleet_management_api/models/o_auth_scope_oauth2.rb +82 -0
- data/lib/tesla_fleet_management_api/models/{oauth_token.rb → o_auth_token.rb} +2 -2
- data/lib/tesla_fleet_management_api/models/which_trunk.rb +36 -0
- data/lib/tesla_fleet_management_api.rb +17 -5
- metadata +17 -7
- data/lib/tesla_fleet_management_api/http/auth/oauth_2.rb +0 -154
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b1f1dec6f40d9a06ec7d8881b8fe4feeca9a5cedcc5edda398cf7826e014bda0
|
|
4
|
+
data.tar.gz: 33eb35da898558cc2688d92074f9e6a9d06b3bcc20fa5e4f413ea29e7a7c9104
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c5e335364d821060bcfff023fa3e9801fd58c76decadcea7894fdc91ea87ac237e661b5806324436a66f595047ecaf986a8558799c84c53e2873dfb5986f5b88
|
|
7
|
+
data.tar.gz: eb2b2f37ba154a77d3c57144743ec16d27f41fb3aec6961b06b8b940a30539bc6dc456ceb4615e1570eb8f80121df05d7d4f266f2389354aca1b3f2e4afd2b11
|
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.
|
|
13
|
+
gem install tesla-api-sdk -v 1.0.1
|
|
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.
|
|
19
|
+
gem 'tesla-api-sdk', '1.0.1'
|
|
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.
|
|
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).
|
|
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.
|
|
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)
|
|
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.
|
|
78
|
-
| logging_configuration | [`LoggingConfiguration`](https://www.github.com/sdks-io/tesla-api-ruby-sdk/tree/1.0.
|
|
79
|
-
| bearer_auth_credentials | [`BearerAuthCredentials`](https://www.github.com/sdks-io/tesla-api-ruby-sdk/tree/1.0.
|
|
80
|
-
| oauth_2_credentials | [`Oauth2Credentials`](https://www.github.com/sdks-io/tesla-api-ruby-sdk/tree/1.0.
|
|
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 |
|
|
81
81
|
|
|
82
82
|
The API client can be initialized as follows:
|
|
83
83
|
|
|
@@ -91,10 +91,14 @@ client = Client.new(
|
|
|
91
91
|
bearer_auth_credentials: BearerAuthCredentials.new(
|
|
92
92
|
access_token: 'AccessToken'
|
|
93
93
|
),
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
94
|
+
oauth2_credentials: Oauth2Credentials.new(
|
|
95
|
+
o_auth_client_id: 'OAuthClientId',
|
|
96
|
+
o_auth_client_secret: 'OAuthClientSecret',
|
|
97
|
+
o_auth_redirect_uri: 'OAuthRedirectUri',
|
|
98
|
+
o_auth_scopes: [
|
|
99
|
+
OAuthScopeOauth2::OPENID,
|
|
100
|
+
OAuthScopeOauth2::OFFLINE_ACCESS
|
|
101
|
+
]
|
|
98
102
|
),
|
|
99
103
|
environment: Environment::PRODUCTION,
|
|
100
104
|
logging_configuration: LoggingConfiguration.new(
|
|
@@ -119,42 +123,43 @@ include TeslaFleetManagementApi
|
|
|
119
123
|
client = Client.from_env
|
|
120
124
|
```
|
|
121
125
|
|
|
122
|
-
See the [`Environment-Based Client Initialization`](https://www.github.com/sdks-io/tesla-api-ruby-sdk/tree/1.0.
|
|
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.
|
|
123
127
|
|
|
124
128
|
## Authorization
|
|
125
129
|
|
|
126
130
|
This API uses the following authentication schemes.
|
|
127
131
|
|
|
128
|
-
* [`bearerAuth (OAuth 2 Bearer token)`](https://www.github.com/sdks-io/tesla-api-ruby-sdk/tree/1.0.
|
|
129
|
-
* [`oauth2 (OAuth 2 Authorization Code Grant)`](https://www.github.com/sdks-io/tesla-api-ruby-sdk/tree/1.0.
|
|
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)
|
|
130
134
|
|
|
131
135
|
## List of APIs
|
|
132
136
|
|
|
133
|
-
* [
|
|
134
|
-
* [
|
|
135
|
-
* [
|
|
136
|
-
* [
|
|
137
|
-
* [
|
|
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)
|
|
138
143
|
|
|
139
144
|
## SDK Infrastructure
|
|
140
145
|
|
|
141
146
|
### Configuration
|
|
142
147
|
|
|
143
|
-
* [ProxySettings](https://www.github.com/sdks-io/tesla-api-ruby-sdk/tree/1.0.
|
|
144
|
-
* [Environment-Based Client Initialization](https://www.github.com/sdks-io/tesla-api-ruby-sdk/tree/1.0.
|
|
145
|
-
* [AbstractLogger](https://www.github.com/sdks-io/tesla-api-ruby-sdk/tree/1.0.
|
|
146
|
-
* [LoggingConfiguration](https://www.github.com/sdks-io/tesla-api-ruby-sdk/tree/1.0.
|
|
147
|
-
* [RequestLoggingConfiguration](https://www.github.com/sdks-io/tesla-api-ruby-sdk/tree/1.0.
|
|
148
|
-
* [ResponseLoggingConfiguration](https://www.github.com/sdks-io/tesla-api-ruby-sdk/tree/1.0.
|
|
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)
|
|
149
154
|
|
|
150
155
|
### HTTP
|
|
151
156
|
|
|
152
|
-
* [HttpResponse](https://www.github.com/sdks-io/tesla-api-ruby-sdk/tree/1.0.
|
|
153
|
-
* [HttpRequest](https://www.github.com/sdks-io/tesla-api-ruby-sdk/tree/1.0.
|
|
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)
|
|
154
159
|
|
|
155
160
|
### Utilities
|
|
156
161
|
|
|
157
|
-
* [ApiResponse](https://www.github.com/sdks-io/tesla-api-ruby-sdk/tree/1.0.
|
|
158
|
-
* [ApiHelper](https://www.github.com/sdks-io/tesla-api-ruby-sdk/tree/1.0.
|
|
159
|
-
* [DateTimeHelper](https://www.github.com/sdks-io/tesla-api-ruby-sdk/tree/1.0.
|
|
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)
|
|
160
165
|
|
|
@@ -14,7 +14,7 @@ module TeslaFleetManagementApi
|
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
# Returns the configured authentication oauth2 instance.
|
|
17
|
-
def
|
|
17
|
+
def oauth2
|
|
18
18
|
@auth_managers['oauth2']
|
|
19
19
|
end
|
|
20
20
|
|
|
@@ -48,10 +48,16 @@ module TeslaFleetManagementApi
|
|
|
48
48
|
@vehicles ||= VehiclesController.new @global_configuration
|
|
49
49
|
end
|
|
50
50
|
|
|
51
|
-
# Access to
|
|
52
|
-
# @return [
|
|
53
|
-
def
|
|
54
|
-
@
|
|
51
|
+
# Access to vehicle_commands controller.
|
|
52
|
+
# @return [VehicleCommandsController] Returns the controller instance.
|
|
53
|
+
def vehicle_commands
|
|
54
|
+
@vehicle_commands ||= VehicleCommandsController.new @global_configuration
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# Access to o_auth_authorization controller.
|
|
58
|
+
# @return [OAuthAuthorizationController] Returns the controller instance.
|
|
59
|
+
def o_auth_authorization
|
|
60
|
+
@o_auth_authorization ||= OAuthAuthorizationController.new @global_configuration
|
|
55
61
|
end
|
|
56
62
|
|
|
57
63
|
def initialize(
|
|
@@ -60,7 +66,7 @@ module TeslaFleetManagementApi
|
|
|
60
66
|
retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
|
|
61
67
|
retry_methods: %i[get put], http_callback: nil, proxy_settings: nil,
|
|
62
68
|
logging_configuration: nil, environment: Environment::PRODUCTION,
|
|
63
|
-
bearer_auth_credentials: nil,
|
|
69
|
+
bearer_auth_credentials: nil, oauth2_credentials: nil, config: nil
|
|
64
70
|
)
|
|
65
71
|
@config = if config.nil?
|
|
66
72
|
Configuration.new(
|
|
@@ -73,7 +79,7 @@ module TeslaFleetManagementApi
|
|
|
73
79
|
logging_configuration: logging_configuration,
|
|
74
80
|
environment: environment,
|
|
75
81
|
bearer_auth_credentials: bearer_auth_credentials,
|
|
76
|
-
|
|
82
|
+
oauth2_credentials: oauth2_credentials
|
|
77
83
|
)
|
|
78
84
|
else
|
|
79
85
|
config
|
|
@@ -97,7 +103,7 @@ module TeslaFleetManagementApi
|
|
|
97
103
|
http_client_config = global_config.client_configuration
|
|
98
104
|
%w[bearerAuth oauth2].each { |auth| @auth_managers[auth] = nil }
|
|
99
105
|
@auth_managers['bearerAuth'] = BearerAuth.new(http_client_config.bearer_auth_credentials)
|
|
100
|
-
@auth_managers['oauth2'] = Oauth2.new(http_client_config.
|
|
106
|
+
@auth_managers['oauth2'] = Oauth2.new(http_client_config.oauth2_credentials, global_config)
|
|
101
107
|
end
|
|
102
108
|
|
|
103
109
|
# Creates a client directly from environment variables.
|
|
@@ -46,7 +46,7 @@ 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, :
|
|
49
|
+
attr_reader :environment, :bearer_auth_credentials, :oauth2_credentials
|
|
50
50
|
|
|
51
51
|
class << self
|
|
52
52
|
attr_reader :environments
|
|
@@ -58,7 +58,7 @@ module TeslaFleetManagementApi
|
|
|
58
58
|
retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
|
|
59
59
|
retry_methods: %i[get put], http_callback: nil, proxy_settings: nil,
|
|
60
60
|
logging_configuration: nil, environment: Environment::PRODUCTION,
|
|
61
|
-
bearer_auth_credentials: nil,
|
|
61
|
+
bearer_auth_credentials: nil, oauth2_credentials: nil
|
|
62
62
|
)
|
|
63
63
|
super connection: connection, adapter: adapter, timeout: timeout,
|
|
64
64
|
max_retries: max_retries, retry_interval: retry_interval,
|
|
@@ -74,7 +74,7 @@ module TeslaFleetManagementApi
|
|
|
74
74
|
@bearer_auth_credentials = bearer_auth_credentials
|
|
75
75
|
|
|
76
76
|
# The object holding OAuth 2 Authorization Code Grant credentials
|
|
77
|
-
@
|
|
77
|
+
@oauth2_credentials = oauth2_credentials
|
|
78
78
|
|
|
79
79
|
# The Http Client to use for making requests.
|
|
80
80
|
set_http_client CoreLibrary::FaradayClient.new(self)
|
|
@@ -85,7 +85,7 @@ module TeslaFleetManagementApi
|
|
|
85
85
|
retry_statuses: nil, retry_methods: nil, http_callback: nil,
|
|
86
86
|
proxy_settings: nil, logging_configuration: nil,
|
|
87
87
|
environment: nil, bearer_auth_credentials: nil,
|
|
88
|
-
|
|
88
|
+
oauth2_credentials: nil)
|
|
89
89
|
connection ||= self.connection
|
|
90
90
|
adapter ||= self.adapter
|
|
91
91
|
timeout ||= self.timeout
|
|
@@ -99,7 +99,7 @@ module TeslaFleetManagementApi
|
|
|
99
99
|
logging_configuration ||= self.logging_configuration
|
|
100
100
|
environment ||= self.environment
|
|
101
101
|
bearer_auth_credentials ||= self.bearer_auth_credentials
|
|
102
|
-
|
|
102
|
+
oauth2_credentials ||= self.oauth2_credentials
|
|
103
103
|
|
|
104
104
|
Configuration.new(connection: connection, adapter: adapter,
|
|
105
105
|
timeout: timeout, max_retries: max_retries,
|
|
@@ -112,7 +112,7 @@ module TeslaFleetManagementApi
|
|
|
112
112
|
logging_configuration: logging_configuration,
|
|
113
113
|
environment: environment,
|
|
114
114
|
bearer_auth_credentials: bearer_auth_credentials,
|
|
115
|
-
|
|
115
|
+
oauth2_credentials: oauth2_credentials)
|
|
116
116
|
end
|
|
117
117
|
|
|
118
118
|
|
|
@@ -156,7 +156,7 @@ module TeslaFleetManagementApi
|
|
|
156
156
|
|
|
157
157
|
# === Authentication credentials ===
|
|
158
158
|
bearer_auth_credentials = BearerAuthCredentials.from_env
|
|
159
|
-
|
|
159
|
+
oauth2_credentials = Oauth2Credentials.from_env
|
|
160
160
|
|
|
161
161
|
# === Proxy settings ===
|
|
162
162
|
proxy_settings = ProxySettings.from_env
|
|
@@ -172,7 +172,7 @@ module TeslaFleetManagementApi
|
|
|
172
172
|
retry_statuses: retry_statuses,
|
|
173
173
|
retry_methods: retry_methods,
|
|
174
174
|
bearer_auth_credentials: bearer_auth_credentials,
|
|
175
|
-
|
|
175
|
+
oauth2_credentials: oauth2_credentials,
|
|
176
176
|
proxy_settings: proxy_settings,
|
|
177
177
|
logging_configuration: logging_configuration
|
|
178
178
|
)
|
|
@@ -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(
|
|
17
|
+
.auth(And.new('bearerAuth', 'oauth2')))
|
|
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(
|
|
38
|
+
.auth(And.new('bearerAuth', 'oauth2')))
|
|
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(
|
|
54
|
+
.auth(And.new('bearerAuth', 'oauth2')))
|
|
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(
|
|
29
|
+
.auth(And.new('bearerAuth', 'oauth2')))
|
|
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(
|
|
71
|
+
.auth(And.new('bearerAuth', 'oauth2')))
|
|
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(
|
|
111
|
+
.auth(And.new('bearerAuth', 'oauth2')))
|
|
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(
|
|
132
|
+
.auth(And.new('bearerAuth', 'oauth2')))
|
|
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(
|
|
160
|
+
.auth(And.new('bearerAuth', 'oauth2')))
|
|
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(
|
|
186
|
+
.auth(And.new('bearerAuth', 'oauth2')))
|
|
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(
|
|
214
|
+
.auth(And.new('bearerAuth', 'oauth2')))
|
|
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(
|
|
242
|
+
.auth(And.new('bearerAuth', 'oauth2')))
|
|
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(
|
|
270
|
+
.auth(And.new('bearerAuth', 'oauth2')))
|
|
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(
|
|
286
|
+
.auth(And.new('bearerAuth', 'oauth2')))
|
|
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(
|
|
307
|
+
.auth(And.new('bearerAuth', 'oauth2')))
|
|
308
308
|
.response(new_response_handler
|
|
309
309
|
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
310
310
|
.deserialize_into(SiteInfoResponse.method(:from_hash))
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
5
5
|
|
|
6
6
|
module TeslaFleetManagementApi
|
|
7
|
-
#
|
|
8
|
-
class
|
|
7
|
+
# OAuthAuthorizationController
|
|
8
|
+
class OAuthAuthorizationController < BaseController
|
|
9
9
|
# Create a new OAuth 2 token.
|
|
10
10
|
# @param [String] authorization Required parameter: Authorization header in
|
|
11
11
|
# Basic auth format
|
|
@@ -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
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
def request_token_oauth2(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',
|
|
@@ -34,14 +34,14 @@ module TeslaFleetManagementApi
|
|
|
34
34
|
.additional_form_params(_field_parameters))
|
|
35
35
|
.response(new_response_handler
|
|
36
36
|
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
37
|
-
.deserialize_into(
|
|
37
|
+
.deserialize_into(OAuthToken.method(:from_hash))
|
|
38
38
|
.is_api_response(true)
|
|
39
39
|
.local_error('400',
|
|
40
40
|
'OAuth 2 provider returned an error.',
|
|
41
|
-
|
|
41
|
+
OAuthProviderException)
|
|
42
42
|
.local_error('401',
|
|
43
43
|
'OAuth 2 provider says client authentication failed.',
|
|
44
|
-
|
|
44
|
+
OAuthProviderException))
|
|
45
45
|
.execute
|
|
46
46
|
end
|
|
47
47
|
|
|
@@ -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
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
57
|
+
def refresh_token_oauth2(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',
|
|
@@ -73,14 +73,14 @@ module TeslaFleetManagementApi
|
|
|
73
73
|
.additional_form_params(_field_parameters))
|
|
74
74
|
.response(new_response_handler
|
|
75
75
|
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
76
|
-
.deserialize_into(
|
|
76
|
+
.deserialize_into(OAuthToken.method(:from_hash))
|
|
77
77
|
.is_api_response(true)
|
|
78
78
|
.local_error('400',
|
|
79
79
|
'OAuth 2 provider returned an error.',
|
|
80
|
-
|
|
80
|
+
OAuthProviderException)
|
|
81
81
|
.local_error('401',
|
|
82
82
|
'OAuth 2 provider says client authentication failed.',
|
|
83
|
-
|
|
83
|
+
OAuthProviderException))
|
|
84
84
|
.execute
|
|
85
85
|
end
|
|
86
86
|
end
|
|
@@ -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(
|
|
17
|
+
.auth(And.new('bearerAuth', 'oauth2')))
|
|
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(
|
|
33
|
+
.auth(And.new('bearerAuth', 'oauth2')))
|
|
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(
|
|
52
|
+
.auth(And.new('bearerAuth', 'oauth2')))
|
|
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(
|
|
74
|
+
.auth(And.new('bearerAuth', 'oauth2')))
|
|
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(
|
|
17
|
+
.auth(And.new('bearerAuth', 'oauth2')))
|
|
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(
|
|
33
|
+
.auth(And.new('bearerAuth', 'oauth2')))
|
|
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(
|
|
49
|
+
.auth(And.new('bearerAuth', 'oauth2')))
|
|
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(
|
|
65
|
+
.auth(And.new('bearerAuth', 'oauth2')))
|
|
66
66
|
.response(new_response_handler
|
|
67
67
|
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
68
68
|
.deserialize_into(RegionResponse.method(:from_hash))
|