Class: TeslaFleetManagementApi::PartnerController

Inherits:
BaseController show all
Defined in:
lib/tesla_fleet_management_api/controllers/partner_controller.rb

Overview

PartnerController

Constant Summary

Constants inherited from BaseController

BaseController::GLOBAL_ERRORS

Instance Attribute Summary

Attributes inherited from BaseController

#config, #http_call_back

Instance Method Summary collapse

Methods inherited from BaseController

#initialize, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters

Constructor Details

This class inherits a constructor from TeslaFleetManagementApi::BaseController

Instance Method Details

#get_public_key_for_a_domain(domain) ⇒ ApiResponse

TODO: type endpoint description here

Parameters:

  • domain (String)

    Required parameter: TODO: type description here

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/tesla_fleet_management_api/controllers/partner_controller.rb', line 44

def get_public_key_for_a_domain(domain)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/api/1/partner_accounts/public_key',
                                 Server::DEFAULT)
               .query_param(new_parameter(domain, key: 'domain')
                             .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('bearerAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(PublicKeyResponse.method(:from_hash))
                .is_api_response(true))
    .execute
end

#get_recent_fleet_telemetry_errorsApiResponse

TODO: type endpoint description here

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/tesla_fleet_management_api/controllers/partner_controller.rb', line 27

def get_recent_fleet_telemetry_errors
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/api/1/partner_accounts/fleet_telemetry_errors',
                                 Server::DEFAULT)
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('bearerAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(FleetTelemetryErrorsResponse.method(:from_hash))
                .is_api_response(true))
    .execute
end

#get_vins_with_fleet_telemetry_errorsApiResponse

TODO: type endpoint description here

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/tesla_fleet_management_api/controllers/partner_controller.rb', line 11

def get_vins_with_fleet_telemetry_errors
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/api/1/partner_accounts/fleet_telemetry_error_vins',
                                 Server::DEFAULT)
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('bearerAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(BackupResponse.method(:from_hash))
                .is_api_response(true))
    .execute
end

#register_a_partner_account(body) ⇒ ApiResponse

TODO: type endpoint description here description here

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/tesla_fleet_management_api/controllers/partner_controller.rb', line 64

def (body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/api/1/partner_accounts',
                                 Server::DEFAULT)
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('bearerAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(RegisterPartnerResponse.method(:from_hash))
                .is_api_response(true))
    .execute
end