Class: TeslaFleetManagementApi::UserController

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

Overview

UserController

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_active_orders_for_a_userApiResponse

TODO: type endpoint description here

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/tesla_fleet_management_api/controllers/user_controller.rb', line 43

def get_active_orders_for_a_user
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/api/1/users/orders',
                                 Server::DEFAULT)
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Or.new('thirdpartytoken', 'bearerAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(OrdersResponse.method(:from_hash))
                .is_api_response(true))
    .execute
end

#get_custom_feature_flags_for_a_userApiResponse

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/user_controller.rb', line 11

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

#get_summary_of_a_user_s_accountApiResponse

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/user_controller.rb', line 27

def 
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/api/1/users/me',
                                 Server::DEFAULT)
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Or.new('thirdpartytoken', 'bearerAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(MeResponse.method(:from_hash))
                .is_api_response(true))
    .execute
end

#get_user_s_region_and_fleet_api_base_urlApiResponse

TODO: type endpoint description here

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/tesla_fleet_management_api/controllers/user_controller.rb', line 59

def get_user_s_region_and_fleet_api_base_url
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/api/1/users/region',
                                 Server::DEFAULT)
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Or.new('thirdpartytoken', 'bearerAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(RegionResponse.method(:from_hash))
                .is_api_response(true))
    .execute
end