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,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
+ # Response2 Model.
8
+ class Response2 < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [Signaling]
14
+ attr_accessor :signaling
15
+
16
+ # A mapping from model property names to API property names.
17
+ def self.names
18
+ @_hash = {} if @_hash.nil?
19
+ @_hash['signaling'] = 'signaling'
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(signaling:, additional_properties: nil)
34
+ # Add additional model properties to the instance
35
+ additional_properties = {} if additional_properties.nil?
36
+
37
+ @signaling = signaling
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
+ signaling = Signaling.from_hash(hash['signaling']) if hash['signaling']
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
+ Response2.new(signaling: signaling,
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} signaling: #{@signaling}, additional_properties:"\
64
+ " #{@additional_properties}>"
65
+ end
66
+
67
+ # Provides a debugging-friendly string with detailed object information.
68
+ def inspect
69
+ class_name = self.class.name.split('::').last
70
+ "<#{class_name} signaling: #{@signaling.inspect}, additional_properties:"\
71
+ " #{@additional_properties}>"
72
+ end
73
+ end
74
+ end
@@ -0,0 +1,115 @@
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
+ # Response3 Model.
8
+ class Response3 < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [Array[ChargingLocation]]
14
+ attr_accessor :destination_charging
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [Array[ChargingLocation]]
18
+ attr_accessor :superchargers
19
+
20
+ # TODO: Write general description for this method
21
+ # @return [Integer]
22
+ attr_accessor :timestamp
23
+
24
+ # A mapping from model property names to API property names.
25
+ def self.names
26
+ @_hash = {} if @_hash.nil?
27
+ @_hash['destination_charging'] = 'destination_charging'
28
+ @_hash['superchargers'] = 'superchargers'
29
+ @_hash['timestamp'] = 'timestamp'
30
+ @_hash
31
+ end
32
+
33
+ # An array for optional fields
34
+ def self.optionals
35
+ %w[
36
+ destination_charging
37
+ superchargers
38
+ timestamp
39
+ ]
40
+ end
41
+
42
+ # An array for nullable fields
43
+ def self.nullables
44
+ []
45
+ end
46
+
47
+ def initialize(destination_charging: SKIP, superchargers: SKIP,
48
+ timestamp: SKIP, additional_properties: nil)
49
+ # Add additional model properties to the instance
50
+ additional_properties = {} if additional_properties.nil?
51
+
52
+ @destination_charging = destination_charging unless destination_charging == SKIP
53
+ @superchargers = superchargers unless superchargers == SKIP
54
+ @timestamp = timestamp unless timestamp == SKIP
55
+ @additional_properties = additional_properties
56
+ end
57
+
58
+ # Creates an instance of the object from a hash.
59
+ def self.from_hash(hash)
60
+ return nil unless hash
61
+
62
+ # Extract variables from the hash.
63
+ # Parameter is an array, so we need to iterate through it
64
+ destination_charging = nil
65
+ unless hash['destination_charging'].nil?
66
+ destination_charging = []
67
+ hash['destination_charging'].each do |structure|
68
+ destination_charging << (ChargingLocation.from_hash(structure) if structure)
69
+ end
70
+ end
71
+
72
+ destination_charging = SKIP unless hash.key?('destination_charging')
73
+ # Parameter is an array, so we need to iterate through it
74
+ superchargers = nil
75
+ unless hash['superchargers'].nil?
76
+ superchargers = []
77
+ hash['superchargers'].each do |structure|
78
+ superchargers << (ChargingLocation.from_hash(structure) if structure)
79
+ end
80
+ end
81
+
82
+ superchargers = SKIP unless hash.key?('superchargers')
83
+ timestamp = hash.key?('timestamp') ? hash['timestamp'] : SKIP
84
+
85
+ # Create a new hash for additional properties, removing known properties.
86
+ new_hash = hash.reject { |k, _| names.value?(k) }
87
+
88
+ additional_properties = APIHelper.get_additional_properties(
89
+ new_hash, proc { |value| value }
90
+ )
91
+
92
+ # Create object from extracted values.
93
+ Response3.new(destination_charging: destination_charging,
94
+ superchargers: superchargers,
95
+ timestamp: timestamp,
96
+ additional_properties: additional_properties)
97
+ end
98
+
99
+ # Provides a human-readable string representation of the object.
100
+ def to_s
101
+ class_name = self.class.name.split('::').last
102
+ "<#{class_name} destination_charging: #{@destination_charging}, superchargers:"\
103
+ " #{@superchargers}, timestamp: #{@timestamp}, additional_properties:"\
104
+ " #{@additional_properties}>"
105
+ end
106
+
107
+ # Provides a debugging-friendly string with detailed object information.
108
+ def inspect
109
+ class_name = self.class.name.split('::').last
110
+ "<#{class_name} destination_charging: #{@destination_charging.inspect}, superchargers:"\
111
+ " #{@superchargers.inspect}, timestamp: #{@timestamp.inspect}, additional_properties:"\
112
+ " #{@additional_properties}>"
113
+ end
114
+ end
115
+ end
@@ -0,0 +1,84 @@
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
+ # ResponseApi1DxVehiclesOptionsResponse Model.
8
+ class ResponseApi1DxVehiclesOptionsResponse < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [Array[VehicleOption]]
14
+ attr_accessor :codes
15
+
16
+ # A mapping from model property names to API property names.
17
+ def self.names
18
+ @_hash = {} if @_hash.nil?
19
+ @_hash['codes'] = 'codes'
20
+ @_hash
21
+ end
22
+
23
+ # An array for optional fields
24
+ def self.optionals
25
+ %w[
26
+ codes
27
+ ]
28
+ end
29
+
30
+ # An array for nullable fields
31
+ def self.nullables
32
+ []
33
+ end
34
+
35
+ def initialize(codes: SKIP, additional_properties: nil)
36
+ # Add additional model properties to the instance
37
+ additional_properties = {} if additional_properties.nil?
38
+
39
+ @codes = codes unless codes == 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
+ # Parameter is an array, so we need to iterate through it
49
+ codes = nil
50
+ unless hash['codes'].nil?
51
+ codes = []
52
+ hash['codes'].each do |structure|
53
+ codes << (VehicleOption.from_hash(structure) if structure)
54
+ end
55
+ end
56
+
57
+ codes = SKIP unless hash.key?('codes')
58
+
59
+ # Create a new hash for additional properties, removing known properties.
60
+ new_hash = hash.reject { |k, _| names.value?(k) }
61
+
62
+ additional_properties = APIHelper.get_additional_properties(
63
+ new_hash, proc { |value| value }
64
+ )
65
+
66
+ # Create object from extracted values.
67
+ ResponseApi1DxVehiclesOptionsResponse.new(codes: codes,
68
+ additional_properties: additional_properties)
69
+ end
70
+
71
+ # Provides a human-readable string representation of the object.
72
+ def to_s
73
+ class_name = self.class.name.split('::').last
74
+ "<#{class_name} codes: #{@codes}, additional_properties: #{@additional_properties}>"
75
+ end
76
+
77
+ # Provides a debugging-friendly string with detailed object information.
78
+ def inspect
79
+ class_name = self.class.name.split('::').last
80
+ "<#{class_name} codes: #{@codes.inspect}, additional_properties:"\
81
+ " #{@additional_properties}>"
82
+ end
83
+ end
84
+ end
@@ -0,0 +1,124 @@
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
+ # ResponseApi1DxWarrantyDetailsResponse Model.
8
+ class ResponseApi1DxWarrantyDetailsResponse < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [Array[WarrantyItem]]
14
+ attr_accessor :active_warranty
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [Array[WarrantyItem]]
18
+ attr_accessor :upcoming_warranty
19
+
20
+ # TODO: Write general description for this method
21
+ # @return [Array[WarrantyItem]]
22
+ attr_accessor :expired_warranty
23
+
24
+ # A mapping from model property names to API property names.
25
+ def self.names
26
+ @_hash = {} if @_hash.nil?
27
+ @_hash['active_warranty'] = 'activeWarranty'
28
+ @_hash['upcoming_warranty'] = 'upcomingWarranty'
29
+ @_hash['expired_warranty'] = 'expiredWarranty'
30
+ @_hash
31
+ end
32
+
33
+ # An array for optional fields
34
+ def self.optionals
35
+ %w[
36
+ active_warranty
37
+ upcoming_warranty
38
+ expired_warranty
39
+ ]
40
+ end
41
+
42
+ # An array for nullable fields
43
+ def self.nullables
44
+ []
45
+ end
46
+
47
+ def initialize(active_warranty: SKIP, upcoming_warranty: SKIP,
48
+ expired_warranty: SKIP, additional_properties: nil)
49
+ # Add additional model properties to the instance
50
+ additional_properties = {} if additional_properties.nil?
51
+
52
+ @active_warranty = active_warranty unless active_warranty == SKIP
53
+ @upcoming_warranty = upcoming_warranty unless upcoming_warranty == SKIP
54
+ @expired_warranty = expired_warranty unless expired_warranty == SKIP
55
+ @additional_properties = additional_properties
56
+ end
57
+
58
+ # Creates an instance of the object from a hash.
59
+ def self.from_hash(hash)
60
+ return nil unless hash
61
+
62
+ # Extract variables from the hash.
63
+ # Parameter is an array, so we need to iterate through it
64
+ active_warranty = nil
65
+ unless hash['activeWarranty'].nil?
66
+ active_warranty = []
67
+ hash['activeWarranty'].each do |structure|
68
+ active_warranty << (WarrantyItem.from_hash(structure) if structure)
69
+ end
70
+ end
71
+
72
+ active_warranty = SKIP unless hash.key?('activeWarranty')
73
+ # Parameter is an array, so we need to iterate through it
74
+ upcoming_warranty = nil
75
+ unless hash['upcomingWarranty'].nil?
76
+ upcoming_warranty = []
77
+ hash['upcomingWarranty'].each do |structure|
78
+ upcoming_warranty << (WarrantyItem.from_hash(structure) if structure)
79
+ end
80
+ end
81
+
82
+ upcoming_warranty = SKIP unless hash.key?('upcomingWarranty')
83
+ # Parameter is an array, so we need to iterate through it
84
+ expired_warranty = nil
85
+ unless hash['expiredWarranty'].nil?
86
+ expired_warranty = []
87
+ hash['expiredWarranty'].each do |structure|
88
+ expired_warranty << (WarrantyItem.from_hash(structure) if structure)
89
+ end
90
+ end
91
+
92
+ expired_warranty = SKIP unless hash.key?('expiredWarranty')
93
+
94
+ # Create a new hash for additional properties, removing known properties.
95
+ new_hash = hash.reject { |k, _| names.value?(k) }
96
+
97
+ additional_properties = APIHelper.get_additional_properties(
98
+ new_hash, proc { |value| value }
99
+ )
100
+
101
+ # Create object from extracted values.
102
+ ResponseApi1DxWarrantyDetailsResponse.new(active_warranty: active_warranty,
103
+ upcoming_warranty: upcoming_warranty,
104
+ expired_warranty: expired_warranty,
105
+ additional_properties: additional_properties)
106
+ end
107
+
108
+ # Provides a human-readable string representation of the object.
109
+ def to_s
110
+ class_name = self.class.name.split('::').last
111
+ "<#{class_name} active_warranty: #{@active_warranty}, upcoming_warranty:"\
112
+ " #{@upcoming_warranty}, expired_warranty: #{@expired_warranty}, additional_properties:"\
113
+ " #{@additional_properties}>"
114
+ end
115
+
116
+ # Provides a debugging-friendly string with detailed object information.
117
+ def inspect
118
+ class_name = self.class.name.split('::').last
119
+ "<#{class_name} active_warranty: #{@active_warranty.inspect}, upcoming_warranty:"\
120
+ " #{@upcoming_warranty.inspect}, expired_warranty: #{@expired_warranty.inspect},"\
121
+ " additional_properties: #{@additional_properties}>"
122
+ end
123
+ end
124
+ end
@@ -0,0 +1,91 @@
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
+ # ResponseCalendarHistoryResponse Model.
8
+ class ResponseCalendarHistoryResponse < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [Array[Event]]
14
+ attr_accessor :events
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [Integer]
18
+ attr_accessor :total_events
19
+
20
+ # A mapping from model property names to API property names.
21
+ def self.names
22
+ @_hash = {} if @_hash.nil?
23
+ @_hash['events'] = 'events'
24
+ @_hash['total_events'] = 'total_events'
25
+ @_hash
26
+ end
27
+
28
+ # An array for optional fields
29
+ def self.optionals
30
+ []
31
+ end
32
+
33
+ # An array for nullable fields
34
+ def self.nullables
35
+ []
36
+ end
37
+
38
+ def initialize(events:, total_events:, additional_properties: nil)
39
+ # Add additional model properties to the instance
40
+ additional_properties = {} if additional_properties.nil?
41
+
42
+ @events = events
43
+ @total_events = total_events
44
+ @additional_properties = additional_properties
45
+ end
46
+
47
+ # Creates an instance of the object from a hash.
48
+ def self.from_hash(hash)
49
+ return nil unless hash
50
+
51
+ # Extract variables from the hash.
52
+ # Parameter is an array, so we need to iterate through it
53
+ events = nil
54
+ unless hash['events'].nil?
55
+ events = []
56
+ hash['events'].each do |structure|
57
+ events << (Event.from_hash(structure) if structure)
58
+ end
59
+ end
60
+
61
+ events = nil unless hash.key?('events')
62
+ total_events = hash.key?('total_events') ? hash['total_events'] : nil
63
+
64
+ # Create a new hash for additional properties, removing known properties.
65
+ new_hash = hash.reject { |k, _| names.value?(k) }
66
+
67
+ additional_properties = APIHelper.get_additional_properties(
68
+ new_hash, proc { |value| value }
69
+ )
70
+
71
+ # Create object from extracted values.
72
+ ResponseCalendarHistoryResponse.new(events: events,
73
+ total_events: total_events,
74
+ additional_properties: additional_properties)
75
+ end
76
+
77
+ # Provides a human-readable string representation of the object.
78
+ def to_s
79
+ class_name = self.class.name.split('::').last
80
+ "<#{class_name} events: #{@events}, total_events: #{@total_events}, additional_properties:"\
81
+ " #{@additional_properties}>"
82
+ end
83
+
84
+ # Provides a debugging-friendly string with detailed object information.
85
+ def inspect
86
+ class_name = self.class.name.split('::').last
87
+ "<#{class_name} events: #{@events.inspect}, total_events: #{@total_events.inspect},"\
88
+ " additional_properties: #{@additional_properties}>"
89
+ end
90
+ end
91
+ end
@@ -0,0 +1,83 @@
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
+ # ResponseChargeHistoryResponse Model.
8
+ class ResponseChargeHistoryResponse < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [Array[ChargeHistory]]
14
+ attr_accessor :charge_history
15
+
16
+ # A mapping from model property names to API property names.
17
+ def self.names
18
+ @_hash = {} if @_hash.nil?
19
+ @_hash['charge_history'] = 'charge_history'
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(charge_history:, additional_properties: nil)
34
+ # Add additional model properties to the instance
35
+ additional_properties = {} if additional_properties.nil?
36
+
37
+ @charge_history = charge_history
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
+ # Parameter is an array, so we need to iterate through it
47
+ charge_history = nil
48
+ unless hash['charge_history'].nil?
49
+ charge_history = []
50
+ hash['charge_history'].each do |structure|
51
+ charge_history << (ChargeHistory.from_hash(structure) if structure)
52
+ end
53
+ end
54
+
55
+ charge_history = nil unless hash.key?('charge_history')
56
+
57
+ # Create a new hash for additional properties, removing known properties.
58
+ new_hash = hash.reject { |k, _| names.value?(k) }
59
+
60
+ additional_properties = APIHelper.get_additional_properties(
61
+ new_hash, proc { |value| value }
62
+ )
63
+
64
+ # Create object from extracted values.
65
+ ResponseChargeHistoryResponse.new(charge_history: charge_history,
66
+ additional_properties: additional_properties)
67
+ end
68
+
69
+ # Provides a human-readable string representation of the object.
70
+ def to_s
71
+ class_name = self.class.name.split('::').last
72
+ "<#{class_name} charge_history: #{@charge_history}, additional_properties:"\
73
+ " #{@additional_properties}>"
74
+ end
75
+
76
+ # Provides a debugging-friendly string with detailed object information.
77
+ def inspect
78
+ class_name = self.class.name.split('::').last
79
+ "<#{class_name} charge_history: #{@charge_history.inspect}, additional_properties:"\
80
+ " #{@additional_properties}>"
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,83 @@
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
+ # ResponseFleetTelemetryErrorsResponse Model.
8
+ class ResponseFleetTelemetryErrorsResponse < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [Array[FleetTelemetryError]]
14
+ attr_accessor :fleet_telemetry_errors
15
+
16
+ # A mapping from model property names to API property names.
17
+ def self.names
18
+ @_hash = {} if @_hash.nil?
19
+ @_hash['fleet_telemetry_errors'] = 'fleet_telemetry_errors'
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(fleet_telemetry_errors:, additional_properties: nil)
34
+ # Add additional model properties to the instance
35
+ additional_properties = {} if additional_properties.nil?
36
+
37
+ @fleet_telemetry_errors = fleet_telemetry_errors
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
+ # Parameter is an array, so we need to iterate through it
47
+ fleet_telemetry_errors = nil
48
+ unless hash['fleet_telemetry_errors'].nil?
49
+ fleet_telemetry_errors = []
50
+ hash['fleet_telemetry_errors'].each do |structure|
51
+ fleet_telemetry_errors << (FleetTelemetryError.from_hash(structure) if structure)
52
+ end
53
+ end
54
+
55
+ fleet_telemetry_errors = nil unless hash.key?('fleet_telemetry_errors')
56
+
57
+ # Create a new hash for additional properties, removing known properties.
58
+ new_hash = hash.reject { |k, _| names.value?(k) }
59
+
60
+ additional_properties = APIHelper.get_additional_properties(
61
+ new_hash, proc { |value| value }
62
+ )
63
+
64
+ # Create object from extracted values.
65
+ ResponseFleetTelemetryErrorsResponse.new(fleet_telemetry_errors: fleet_telemetry_errors,
66
+ additional_properties: additional_properties)
67
+ end
68
+
69
+ # Provides a human-readable string representation of the object.
70
+ def to_s
71
+ class_name = self.class.name.split('::').last
72
+ "<#{class_name} fleet_telemetry_errors: #{@fleet_telemetry_errors}, additional_properties:"\
73
+ " #{@additional_properties}>"
74
+ end
75
+
76
+ # Provides a debugging-friendly string with detailed object information.
77
+ def inspect
78
+ class_name = self.class.name.split('::').last
79
+ "<#{class_name} fleet_telemetry_errors: #{@fleet_telemetry_errors.inspect},"\
80
+ " additional_properties: #{@additional_properties}>"
81
+ end
82
+ end
83
+ end