tesla-api-sdk 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +28 -0
  3. data/README.md +160 -0
  4. data/bin/console +15 -0
  5. data/lib/tesla_fleet_management_api/api_helper.rb +10 -0
  6. data/lib/tesla_fleet_management_api/client.rb +110 -0
  7. data/lib/tesla_fleet_management_api/configuration.rb +181 -0
  8. data/lib/tesla_fleet_management_api/controllers/base_controller.rb +65 -0
  9. data/lib/tesla_fleet_management_api/controllers/charging_controller.rb +62 -0
  10. data/lib/tesla_fleet_management_api/controllers/energy_controller.rb +315 -0
  11. data/lib/tesla_fleet_management_api/controllers/oauth_authorization_controller.rb +87 -0
  12. data/lib/tesla_fleet_management_api/controllers/partner_controller.rb +82 -0
  13. data/lib/tesla_fleet_management_api/controllers/user_controller.rb +73 -0
  14. data/lib/tesla_fleet_management_api/controllers/vehicles_controller.rb +431 -0
  15. data/lib/tesla_fleet_management_api/exceptions/api_exception.rb +21 -0
  16. data/lib/tesla_fleet_management_api/exceptions/oauth_provider_exception.rb +64 -0
  17. data/lib/tesla_fleet_management_api/http/api_response.rb +19 -0
  18. data/lib/tesla_fleet_management_api/http/auth/bearer_auth.rb +53 -0
  19. data/lib/tesla_fleet_management_api/http/auth/oauth_2.rb +154 -0
  20. data/lib/tesla_fleet_management_api/http/http_call_back.rb +10 -0
  21. data/lib/tesla_fleet_management_api/http/http_method_enum.rb +10 -0
  22. data/lib/tesla_fleet_management_api/http/http_request.rb +10 -0
  23. data/lib/tesla_fleet_management_api/http/http_response.rb +10 -0
  24. data/lib/tesla_fleet_management_api/http/proxy_settings.rb +22 -0
  25. data/lib/tesla_fleet_management_api/logging/configuration/api_logging_configuration.rb +186 -0
  26. data/lib/tesla_fleet_management_api/logging/sdk_logger.rb +17 -0
  27. data/lib/tesla_fleet_management_api/models/api1_dx_vehicles_options_response.rb +76 -0
  28. data/lib/tesla_fleet_management_api/models/api1_dx_warranty_details_response.rb +76 -0
  29. data/lib/tesla_fleet_management_api/models/api1_vehicles_mobile_enabled_response.rb +75 -0
  30. data/lib/tesla_fleet_management_api/models/api1_vehicles_nearby_charging_sites_response.rb +75 -0
  31. data/lib/tesla_fleet_management_api/models/api1_vehicles_response.rb +104 -0
  32. data/lib/tesla_fleet_management_api/models/api1_vehicles_response_get_vehicle.rb +75 -0
  33. data/lib/tesla_fleet_management_api/models/api1_vehicles_wake_up_response.rb +75 -0
  34. data/lib/tesla_fleet_management_api/models/backup_request.rb +75 -0
  35. data/lib/tesla_fleet_management_api/models/backup_response.rb +73 -0
  36. data/lib/tesla_fleet_management_api/models/base_model.rb +110 -0
  37. data/lib/tesla_fleet_management_api/models/calendar_history_response.rb +73 -0
  38. data/lib/tesla_fleet_management_api/models/charge_duration.rb +73 -0
  39. data/lib/tesla_fleet_management_api/models/charge_history.rb +96 -0
  40. data/lib/tesla_fleet_management_api/models/charge_history_response.rb +73 -0
  41. data/lib/tesla_fleet_management_api/models/charge_start_time.rb +73 -0
  42. data/lib/tesla_fleet_management_api/models/charging_dimension.rb +85 -0
  43. data/lib/tesla_fleet_management_api/models/charging_fee.rb +312 -0
  44. data/lib/tesla_fleet_management_api/models/charging_history_data.rb +81 -0
  45. data/lib/tesla_fleet_management_api/models/charging_history_item.rb +222 -0
  46. data/lib/tesla_fleet_management_api/models/charging_history_response.rb +73 -0
  47. data/lib/tesla_fleet_management_api/models/charging_invoice.rb +95 -0
  48. data/lib/tesla_fleet_management_api/models/charging_location.rb +158 -0
  49. data/lib/tesla_fleet_management_api/models/charging_period.rb +96 -0
  50. data/lib/tesla_fleet_management_api/models/charging_session.rb +187 -0
  51. data/lib/tesla_fleet_management_api/models/charging_sessions_data.rb +116 -0
  52. data/lib/tesla_fleet_management_api/models/charging_sessions_response.rb +73 -0
  53. data/lib/tesla_fleet_management_api/models/default_real_mode.rb +36 -0
  54. data/lib/tesla_fleet_management_api/models/driver.rb +164 -0
  55. data/lib/tesla_fleet_management_api/models/drivers_response.rb +94 -0
  56. data/lib/tesla_fleet_management_api/models/enterprise_payer_request.rb +94 -0
  57. data/lib/tesla_fleet_management_api/models/event.rb +89 -0
  58. data/lib/tesla_fleet_management_api/models/fleet_status_request.rb +74 -0
  59. data/lib/tesla_fleet_management_api/models/fleet_telemetry_error.rb +90 -0
  60. data/lib/tesla_fleet_management_api/models/fleet_telemetry_errors_response.rb +74 -0
  61. data/lib/tesla_fleet_management_api/models/fleet_telemetry_jws_request.rb +85 -0
  62. data/lib/tesla_fleet_management_api/models/generic_update_response.rb +73 -0
  63. data/lib/tesla_fleet_management_api/models/kind.rb +36 -0
  64. data/lib/tesla_fleet_management_api/models/kind_get_wall_connector_charging_history.rb +26 -0
  65. data/lib/tesla_fleet_management_api/models/live_status_response.rb +73 -0
  66. data/lib/tesla_fleet_management_api/models/location.rb +85 -0
  67. data/lib/tesla_fleet_management_api/models/location1.rb +85 -0
  68. data/lib/tesla_fleet_management_api/models/me_response.rb +73 -0
  69. data/lib/tesla_fleet_management_api/models/mobile_enabled.rb +85 -0
  70. data/lib/tesla_fleet_management_api/models/oauth_provider_error.rb +62 -0
  71. data/lib/tesla_fleet_management_api/models/oauth_token.rb +96 -0
  72. data/lib/tesla_fleet_management_api/models/off_grid_vehicle_charging_reserve_request.rb +79 -0
  73. data/lib/tesla_fleet_management_api/models/operation_request.rb +75 -0
  74. data/lib/tesla_fleet_management_api/models/orders_response.rb +91 -0
  75. data/lib/tesla_fleet_management_api/models/pagination.rb +127 -0
  76. data/lib/tesla_fleet_management_api/models/price_component.rb +95 -0
  77. data/lib/tesla_fleet_management_api/models/products_response.rb +85 -0
  78. data/lib/tesla_fleet_management_api/models/public_key_response.rb +73 -0
  79. data/lib/tesla_fleet_management_api/models/region_response.rb +73 -0
  80. data/lib/tesla_fleet_management_api/models/register_partner_request.rb +73 -0
  81. data/lib/tesla_fleet_management_api/models/register_partner_response.rb +73 -0
  82. data/lib/tesla_fleet_management_api/models/response.rb +82 -0
  83. data/lib/tesla_fleet_management_api/models/response1.rb +75 -0
  84. data/lib/tesla_fleet_management_api/models/response2.rb +74 -0
  85. data/lib/tesla_fleet_management_api/models/response3.rb +115 -0
  86. data/lib/tesla_fleet_management_api/models/response_api1_dx_vehicles_options_response.rb +84 -0
  87. data/lib/tesla_fleet_management_api/models/response_api1_dx_warranty_details_response.rb +124 -0
  88. data/lib/tesla_fleet_management_api/models/response_calendar_history_response.rb +91 -0
  89. data/lib/tesla_fleet_management_api/models/response_charge_history_response.rb +83 -0
  90. data/lib/tesla_fleet_management_api/models/response_fleet_telemetry_errors_response.rb +83 -0
  91. data/lib/tesla_fleet_management_api/models/response_live_status_response.rb +196 -0
  92. data/lib/tesla_fleet_management_api/models/response_me_response.rb +102 -0
  93. data/lib/tesla_fleet_management_api/models/response_orders_response.rb +157 -0
  94. data/lib/tesla_fleet_management_api/models/response_public_key_response.rb +74 -0
  95. data/lib/tesla_fleet_management_api/models/response_region_response.rb +83 -0
  96. data/lib/tesla_fleet_management_api/models/response_register_partner_response.rb +223 -0
  97. data/lib/tesla_fleet_management_api/models/signaling.rb +94 -0
  98. data/lib/tesla_fleet_management_api/models/simple_ok_response.rb +75 -0
  99. data/lib/tesla_fleet_management_api/models/site_info_response.rb +75 -0
  100. data/lib/tesla_fleet_management_api/models/storm_mode_request.rb +73 -0
  101. data/lib/tesla_fleet_management_api/models/tariff_element.rb +95 -0
  102. data/lib/tesla_fleet_management_api/models/tariffs.rb +94 -0
  103. data/lib/tesla_fleet_management_api/models/time_of_use_settings_request.rb +74 -0
  104. data/lib/tesla_fleet_management_api/models/total_cost.rb +95 -0
  105. data/lib/tesla_fleet_management_api/models/tou_settings.rb +77 -0
  106. data/lib/tesla_fleet_management_api/models/vehicle_base.rb +147 -0
  107. data/lib/tesla_fleet_management_api/models/vehicle_option.rb +107 -0
  108. data/lib/tesla_fleet_management_api/models/warranty_item.rb +155 -0
  109. data/lib/tesla_fleet_management_api/utilities/date_time_helper.rb +11 -0
  110. data/lib/tesla_fleet_management_api/utilities/file_wrapper.rb +28 -0
  111. data/lib/tesla_fleet_management_api.rb +153 -0
  112. metadata +195 -0
@@ -0,0 +1,73 @@
1
+ # tesla_fleet_management_api
2
+ #
3
+ # This file was automatically generated by
4
+ # APIMATIC v3.0 ( https://www.apimatic.io ).
5
+
6
+ module TeslaFleetManagementApi
7
+ # ChargingSessionsResponse Model.
8
+ class ChargingSessionsResponse < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [ChargingSessionsData]
14
+ attr_accessor :response
15
+
16
+ # A mapping from model property names to API property names.
17
+ def self.names
18
+ @_hash = {} if @_hash.nil?
19
+ @_hash['response'] = 'response'
20
+ @_hash
21
+ end
22
+
23
+ # An array for optional fields
24
+ def self.optionals
25
+ []
26
+ end
27
+
28
+ # An array for nullable fields
29
+ def self.nullables
30
+ []
31
+ end
32
+
33
+ def initialize(response:, additional_properties: nil)
34
+ # Add additional model properties to the instance
35
+ additional_properties = {} if additional_properties.nil?
36
+
37
+ @response = response
38
+ @additional_properties = additional_properties
39
+ end
40
+
41
+ # Creates an instance of the object from a hash.
42
+ def self.from_hash(hash)
43
+ return nil unless hash
44
+
45
+ # Extract variables from the hash.
46
+ response = ChargingSessionsData.from_hash(hash['response']) if hash['response']
47
+
48
+ # Create a new hash for additional properties, removing known properties.
49
+ new_hash = hash.reject { |k, _| names.value?(k) }
50
+
51
+ additional_properties = APIHelper.get_additional_properties(
52
+ new_hash, proc { |value| value }
53
+ )
54
+
55
+ # Create object from extracted values.
56
+ ChargingSessionsResponse.new(response: response,
57
+ additional_properties: additional_properties)
58
+ end
59
+
60
+ # Provides a human-readable string representation of the object.
61
+ def to_s
62
+ class_name = self.class.name.split('::').last
63
+ "<#{class_name} response: #{@response}, additional_properties: #{@additional_properties}>"
64
+ end
65
+
66
+ # Provides a debugging-friendly string with detailed object information.
67
+ def inspect
68
+ class_name = self.class.name.split('::').last
69
+ "<#{class_name} response: #{@response.inspect}, additional_properties:"\
70
+ " #{@additional_properties}>"
71
+ end
72
+ end
73
+ end
@@ -0,0 +1,36 @@
1
+ # tesla_fleet_management_api
2
+ #
3
+ # This file was automatically generated by
4
+ # APIMATIC v3.0 ( https://www.apimatic.io ).
5
+
6
+ module TeslaFleetManagementApi
7
+ # DefaultRealMode.
8
+ class DefaultRealMode
9
+ DEFAULT_REAL_MODE = [
10
+ # TODO: Write general description for AUTONOMOUS
11
+ AUTONOMOUS = 'autonomous'.freeze,
12
+
13
+ # TODO: Write general description for SELF_CONSUMPTION
14
+ SELF_CONSUMPTION = 'self_consumption'.freeze
15
+ ].freeze
16
+
17
+ def self.validate(value)
18
+ return false if value.nil?
19
+
20
+ true
21
+ end
22
+
23
+ def self.from_value(value, default_value = AUTONOMOUS)
24
+ return default_value if value.nil?
25
+
26
+ str = value.to_s.strip
27
+
28
+ case str.downcase
29
+ when 'autonomous' then AUTONOMOUS
30
+ when 'self_consumption' then SELF_CONSUMPTION
31
+ else
32
+ default_value
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,164 @@
1
+ # tesla_fleet_management_api
2
+ #
3
+ # This file was automatically generated by
4
+ # APIMATIC v3.0 ( https://www.apimatic.io ).
5
+
6
+ module TeslaFleetManagementApi
7
+ # Driver Model.
8
+ class Driver < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [Integer]
14
+ attr_accessor :my_tesla_unique_id
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [Integer]
18
+ attr_accessor :user_id
19
+
20
+ # TODO: Write general description for this method
21
+ # @return [String]
22
+ attr_accessor :user_id_s
23
+
24
+ # TODO: Write general description for this method
25
+ # @return [String]
26
+ attr_accessor :vault_uuid
27
+
28
+ # TODO: Write general description for this method
29
+ # @return [String]
30
+ attr_accessor :driver_first_name
31
+
32
+ # TODO: Write general description for this method
33
+ # @return [String]
34
+ attr_accessor :driver_last_name
35
+
36
+ # TODO: Write general description for this method
37
+ # @return [Object]
38
+ attr_accessor :granular_access
39
+
40
+ # TODO: Write general description for this method
41
+ # @return [Array[String]]
42
+ attr_accessor :active_pubkeys
43
+
44
+ # TODO: Write general description for this method
45
+ # @return [String]
46
+ attr_accessor :public_key
47
+
48
+ # A mapping from model property names to API property names.
49
+ def self.names
50
+ @_hash = {} if @_hash.nil?
51
+ @_hash['my_tesla_unique_id'] = 'my_tesla_unique_id'
52
+ @_hash['user_id'] = 'user_id'
53
+ @_hash['user_id_s'] = 'user_id_s'
54
+ @_hash['vault_uuid'] = 'vault_uuid'
55
+ @_hash['driver_first_name'] = 'driver_first_name'
56
+ @_hash['driver_last_name'] = 'driver_last_name'
57
+ @_hash['granular_access'] = 'granular_access'
58
+ @_hash['active_pubkeys'] = 'active_pubkeys'
59
+ @_hash['public_key'] = 'public_key'
60
+ @_hash
61
+ end
62
+
63
+ # An array for optional fields
64
+ def self.optionals
65
+ %w[
66
+ my_tesla_unique_id
67
+ user_id
68
+ user_id_s
69
+ vault_uuid
70
+ driver_first_name
71
+ driver_last_name
72
+ granular_access
73
+ active_pubkeys
74
+ public_key
75
+ ]
76
+ end
77
+
78
+ # An array for nullable fields
79
+ def self.nullables
80
+ []
81
+ end
82
+
83
+ def initialize(my_tesla_unique_id: SKIP, user_id: SKIP, user_id_s: SKIP,
84
+ vault_uuid: SKIP, driver_first_name: SKIP,
85
+ driver_last_name: SKIP, granular_access: SKIP,
86
+ active_pubkeys: SKIP, public_key: SKIP,
87
+ additional_properties: nil)
88
+ # Add additional model properties to the instance
89
+ additional_properties = {} if additional_properties.nil?
90
+
91
+ @my_tesla_unique_id = my_tesla_unique_id unless my_tesla_unique_id == SKIP
92
+ @user_id = user_id unless user_id == SKIP
93
+ @user_id_s = user_id_s unless user_id_s == SKIP
94
+ @vault_uuid = vault_uuid unless vault_uuid == SKIP
95
+ @driver_first_name = driver_first_name unless driver_first_name == SKIP
96
+ @driver_last_name = driver_last_name unless driver_last_name == SKIP
97
+ @granular_access = granular_access unless granular_access == SKIP
98
+ @active_pubkeys = active_pubkeys unless active_pubkeys == SKIP
99
+ @public_key = public_key unless public_key == SKIP
100
+ @additional_properties = additional_properties
101
+ end
102
+
103
+ # Creates an instance of the object from a hash.
104
+ def self.from_hash(hash)
105
+ return nil unless hash
106
+
107
+ # Extract variables from the hash.
108
+ my_tesla_unique_id =
109
+ hash.key?('my_tesla_unique_id') ? hash['my_tesla_unique_id'] : SKIP
110
+ user_id = hash.key?('user_id') ? hash['user_id'] : SKIP
111
+ user_id_s = hash.key?('user_id_s') ? hash['user_id_s'] : SKIP
112
+ vault_uuid = hash.key?('vault_uuid') ? hash['vault_uuid'] : SKIP
113
+ driver_first_name =
114
+ hash.key?('driver_first_name') ? hash['driver_first_name'] : SKIP
115
+ driver_last_name =
116
+ hash.key?('driver_last_name') ? hash['driver_last_name'] : SKIP
117
+ granular_access =
118
+ hash.key?('granular_access') ? hash['granular_access'] : SKIP
119
+ active_pubkeys =
120
+ hash.key?('active_pubkeys') ? hash['active_pubkeys'] : SKIP
121
+ public_key = hash.key?('public_key') ? hash['public_key'] : SKIP
122
+
123
+ # Create a new hash for additional properties, removing known properties.
124
+ new_hash = hash.reject { |k, _| names.value?(k) }
125
+
126
+ additional_properties = APIHelper.get_additional_properties(
127
+ new_hash, proc { |value| value }
128
+ )
129
+
130
+ # Create object from extracted values.
131
+ Driver.new(my_tesla_unique_id: my_tesla_unique_id,
132
+ user_id: user_id,
133
+ user_id_s: user_id_s,
134
+ vault_uuid: vault_uuid,
135
+ driver_first_name: driver_first_name,
136
+ driver_last_name: driver_last_name,
137
+ granular_access: granular_access,
138
+ active_pubkeys: active_pubkeys,
139
+ public_key: public_key,
140
+ additional_properties: additional_properties)
141
+ end
142
+
143
+ # Provides a human-readable string representation of the object.
144
+ def to_s
145
+ class_name = self.class.name.split('::').last
146
+ "<#{class_name} my_tesla_unique_id: #{@my_tesla_unique_id}, user_id: #{@user_id},"\
147
+ " user_id_s: #{@user_id_s}, vault_uuid: #{@vault_uuid}, driver_first_name:"\
148
+ " #{@driver_first_name}, driver_last_name: #{@driver_last_name}, granular_access:"\
149
+ " #{@granular_access}, active_pubkeys: #{@active_pubkeys}, public_key: #{@public_key},"\
150
+ " additional_properties: #{@additional_properties}>"
151
+ end
152
+
153
+ # Provides a debugging-friendly string with detailed object information.
154
+ def inspect
155
+ class_name = self.class.name.split('::').last
156
+ "<#{class_name} my_tesla_unique_id: #{@my_tesla_unique_id.inspect}, user_id:"\
157
+ " #{@user_id.inspect}, user_id_s: #{@user_id_s.inspect}, vault_uuid: #{@vault_uuid.inspect},"\
158
+ " driver_first_name: #{@driver_first_name.inspect}, driver_last_name:"\
159
+ " #{@driver_last_name.inspect}, granular_access: #{@granular_access.inspect},"\
160
+ " active_pubkeys: #{@active_pubkeys.inspect}, public_key: #{@public_key.inspect},"\
161
+ " additional_properties: #{@additional_properties}>"
162
+ end
163
+ end
164
+ end
@@ -0,0 +1,94 @@
1
+ # tesla_fleet_management_api
2
+ #
3
+ # This file was automatically generated by
4
+ # APIMATIC v3.0 ( https://www.apimatic.io ).
5
+
6
+ module TeslaFleetManagementApi
7
+ # DriversResponse Model.
8
+ class DriversResponse < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [Array[Driver]]
14
+ attr_accessor :response
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [Integer]
18
+ attr_accessor :count
19
+
20
+ # A mapping from model property names to API property names.
21
+ def self.names
22
+ @_hash = {} if @_hash.nil?
23
+ @_hash['response'] = 'response'
24
+ @_hash['count'] = 'count'
25
+ @_hash
26
+ end
27
+
28
+ # An array for optional fields
29
+ def self.optionals
30
+ %w[
31
+ response
32
+ count
33
+ ]
34
+ end
35
+
36
+ # An array for nullable fields
37
+ def self.nullables
38
+ []
39
+ end
40
+
41
+ def initialize(response: SKIP, count: SKIP, additional_properties: nil)
42
+ # Add additional model properties to the instance
43
+ additional_properties = {} if additional_properties.nil?
44
+
45
+ @response = response unless response == SKIP
46
+ @count = count unless count == SKIP
47
+ @additional_properties = additional_properties
48
+ end
49
+
50
+ # Creates an instance of the object from a hash.
51
+ def self.from_hash(hash)
52
+ return nil unless hash
53
+
54
+ # Extract variables from the hash.
55
+ # Parameter is an array, so we need to iterate through it
56
+ response = nil
57
+ unless hash['response'].nil?
58
+ response = []
59
+ hash['response'].each do |structure|
60
+ response << (Driver.from_hash(structure) if structure)
61
+ end
62
+ end
63
+
64
+ response = SKIP unless hash.key?('response')
65
+ count = hash.key?('count') ? hash['count'] : SKIP
66
+
67
+ # Create a new hash for additional properties, removing known properties.
68
+ new_hash = hash.reject { |k, _| names.value?(k) }
69
+
70
+ additional_properties = APIHelper.get_additional_properties(
71
+ new_hash, proc { |value| value }
72
+ )
73
+
74
+ # Create object from extracted values.
75
+ DriversResponse.new(response: response,
76
+ count: count,
77
+ additional_properties: additional_properties)
78
+ end
79
+
80
+ # Provides a human-readable string representation of the object.
81
+ def to_s
82
+ class_name = self.class.name.split('::').last
83
+ "<#{class_name} response: #{@response}, count: #{@count}, additional_properties:"\
84
+ " #{@additional_properties}>"
85
+ end
86
+
87
+ # Provides a debugging-friendly string with detailed object information.
88
+ def inspect
89
+ class_name = self.class.name.split('::').last
90
+ "<#{class_name} response: #{@response.inspect}, count: #{@count.inspect},"\
91
+ " additional_properties: #{@additional_properties}>"
92
+ end
93
+ end
94
+ end
@@ -0,0 +1,94 @@
1
+ # tesla_fleet_management_api
2
+ #
3
+ # This file was automatically generated by
4
+ # APIMATIC v3.0 ( https://www.apimatic.io ).
5
+
6
+ module TeslaFleetManagementApi
7
+ # EnterprisePayerRequest Model.
8
+ class EnterprisePayerRequest < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [String]
14
+ attr_accessor :role
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [String]
18
+ attr_accessor :federation_id
19
+
20
+ # TODO: Write general description for this method
21
+ # @return [String]
22
+ attr_accessor :account_id
23
+
24
+ # A mapping from model property names to API property names.
25
+ def self.names
26
+ @_hash = {} if @_hash.nil?
27
+ @_hash['role'] = 'role'
28
+ @_hash['federation_id'] = 'federation_id'
29
+ @_hash['account_id'] = 'account_id'
30
+ @_hash
31
+ end
32
+
33
+ # An array for optional fields
34
+ def self.optionals
35
+ %w[
36
+ federation_id
37
+ account_id
38
+ ]
39
+ end
40
+
41
+ # An array for nullable fields
42
+ def self.nullables
43
+ []
44
+ end
45
+
46
+ def initialize(role:, federation_id: SKIP, account_id: SKIP,
47
+ additional_properties: nil)
48
+ # Add additional model properties to the instance
49
+ additional_properties = {} if additional_properties.nil?
50
+
51
+ @role = role
52
+ @federation_id = federation_id unless federation_id == SKIP
53
+ @account_id = account_id unless account_id == SKIP
54
+ @additional_properties = additional_properties
55
+ end
56
+
57
+ # Creates an instance of the object from a hash.
58
+ def self.from_hash(hash)
59
+ return nil unless hash
60
+
61
+ # Extract variables from the hash.
62
+ role = hash.key?('role') ? hash['role'] : nil
63
+ federation_id = hash.key?('federation_id') ? hash['federation_id'] : SKIP
64
+ account_id = hash.key?('account_id') ? hash['account_id'] : SKIP
65
+
66
+ # Create a new hash for additional properties, removing known properties.
67
+ new_hash = hash.reject { |k, _| names.value?(k) }
68
+
69
+ additional_properties = APIHelper.get_additional_properties(
70
+ new_hash, proc { |value| value }
71
+ )
72
+
73
+ # Create object from extracted values.
74
+ EnterprisePayerRequest.new(role: role,
75
+ federation_id: federation_id,
76
+ account_id: account_id,
77
+ additional_properties: additional_properties)
78
+ end
79
+
80
+ # Provides a human-readable string representation of the object.
81
+ def to_s
82
+ class_name = self.class.name.split('::').last
83
+ "<#{class_name} role: #{@role}, federation_id: #{@federation_id}, account_id:"\
84
+ " #{@account_id}, additional_properties: #{@additional_properties}>"
85
+ end
86
+
87
+ # Provides a debugging-friendly string with detailed object information.
88
+ def inspect
89
+ class_name = self.class.name.split('::').last
90
+ "<#{class_name} role: #{@role.inspect}, federation_id: #{@federation_id.inspect},"\
91
+ " account_id: #{@account_id.inspect}, additional_properties: #{@additional_properties}>"
92
+ end
93
+ end
94
+ end
@@ -0,0 +1,89 @@
1
+ # tesla_fleet_management_api
2
+ #
3
+ # This file was automatically generated by
4
+ # APIMATIC v3.0 ( https://www.apimatic.io ).
5
+
6
+ require 'date'
7
+ module TeslaFleetManagementApi
8
+ # Event Model.
9
+ class Event < BaseModel
10
+ SKIP = Object.new
11
+ private_constant :SKIP
12
+
13
+ # TODO: Write general description for this method
14
+ # @return [DateTime]
15
+ attr_accessor :timestamp
16
+
17
+ # TODO: Write general description for this method
18
+ # @return [Integer]
19
+ attr_accessor :duration
20
+
21
+ # A mapping from model property names to API property names.
22
+ def self.names
23
+ @_hash = {} if @_hash.nil?
24
+ @_hash['timestamp'] = 'timestamp'
25
+ @_hash['duration'] = 'duration'
26
+ @_hash
27
+ end
28
+
29
+ # An array for optional fields
30
+ def self.optionals
31
+ []
32
+ end
33
+
34
+ # An array for nullable fields
35
+ def self.nullables
36
+ []
37
+ end
38
+
39
+ def initialize(timestamp:, duration:, additional_properties: nil)
40
+ # Add additional model properties to the instance
41
+ additional_properties = {} if additional_properties.nil?
42
+
43
+ @timestamp = timestamp
44
+ @duration = duration
45
+ @additional_properties = additional_properties
46
+ end
47
+
48
+ # Creates an instance of the object from a hash.
49
+ def self.from_hash(hash)
50
+ return nil unless hash
51
+
52
+ # Extract variables from the hash.
53
+ timestamp = if hash.key?('timestamp')
54
+ (DateTimeHelper.from_rfc3339(hash['timestamp']) if hash['timestamp'])
55
+ end
56
+ duration = hash.key?('duration') ? hash['duration'] : nil
57
+
58
+ # Create a new hash for additional properties, removing known properties.
59
+ new_hash = hash.reject { |k, _| names.value?(k) }
60
+
61
+ additional_properties = APIHelper.get_additional_properties(
62
+ new_hash, proc { |value| value }
63
+ )
64
+
65
+ # Create object from extracted values.
66
+ Event.new(timestamp: timestamp,
67
+ duration: duration,
68
+ additional_properties: additional_properties)
69
+ end
70
+
71
+ def to_custom_timestamp
72
+ DateTimeHelper.to_rfc3339(timestamp)
73
+ end
74
+
75
+ # Provides a human-readable string representation of the object.
76
+ def to_s
77
+ class_name = self.class.name.split('::').last
78
+ "<#{class_name} timestamp: #{@timestamp}, duration: #{@duration}, additional_properties:"\
79
+ " #{@additional_properties}>"
80
+ end
81
+
82
+ # Provides a debugging-friendly string with detailed object information.
83
+ def inspect
84
+ class_name = self.class.name.split('::').last
85
+ "<#{class_name} timestamp: #{@timestamp.inspect}, duration: #{@duration.inspect},"\
86
+ " additional_properties: #{@additional_properties}>"
87
+ end
88
+ end
89
+ end
@@ -0,0 +1,74 @@
1
+ # tesla_fleet_management_api
2
+ #
3
+ # This file was automatically generated by
4
+ # APIMATIC v3.0 ( https://www.apimatic.io ).
5
+
6
+ module TeslaFleetManagementApi
7
+ # FleetStatusRequest Model.
8
+ class FleetStatusRequest < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [Array[String]]
14
+ attr_accessor :vins
15
+
16
+ # A mapping from model property names to API property names.
17
+ def self.names
18
+ @_hash = {} if @_hash.nil?
19
+ @_hash['vins'] = 'vins'
20
+ @_hash
21
+ end
22
+
23
+ # An array for optional fields
24
+ def self.optionals
25
+ %w[
26
+ vins
27
+ ]
28
+ end
29
+
30
+ # An array for nullable fields
31
+ def self.nullables
32
+ []
33
+ end
34
+
35
+ def initialize(vins: SKIP, additional_properties: nil)
36
+ # Add additional model properties to the instance
37
+ additional_properties = {} if additional_properties.nil?
38
+
39
+ @vins = vins unless vins == SKIP
40
+ @additional_properties = additional_properties
41
+ end
42
+
43
+ # Creates an instance of the object from a hash.
44
+ def self.from_hash(hash)
45
+ return nil unless hash
46
+
47
+ # Extract variables from the hash.
48
+ vins = hash.key?('vins') ? hash['vins'] : SKIP
49
+
50
+ # Create a new hash for additional properties, removing known properties.
51
+ new_hash = hash.reject { |k, _| names.value?(k) }
52
+
53
+ additional_properties = APIHelper.get_additional_properties(
54
+ new_hash, proc { |value| value }
55
+ )
56
+
57
+ # Create object from extracted values.
58
+ FleetStatusRequest.new(vins: vins,
59
+ additional_properties: additional_properties)
60
+ end
61
+
62
+ # Provides a human-readable string representation of the object.
63
+ def to_s
64
+ class_name = self.class.name.split('::').last
65
+ "<#{class_name} vins: #{@vins}, additional_properties: #{@additional_properties}>"
66
+ end
67
+
68
+ # Provides a debugging-friendly string with detailed object information.
69
+ def inspect
70
+ class_name = self.class.name.split('::').last
71
+ "<#{class_name} vins: #{@vins.inspect}, additional_properties: #{@additional_properties}>"
72
+ end
73
+ end
74
+ end