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,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
+ # Tariffs Model.
8
+ class Tariffs < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [String]
14
+ attr_accessor :currency
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [Array[TariffElement]]
18
+ attr_accessor :elements
19
+
20
+ # A mapping from model property names to API property names.
21
+ def self.names
22
+ @_hash = {} if @_hash.nil?
23
+ @_hash['currency'] = 'currency'
24
+ @_hash['elements'] = 'elements'
25
+ @_hash
26
+ end
27
+
28
+ # An array for optional fields
29
+ def self.optionals
30
+ %w[
31
+ currency
32
+ elements
33
+ ]
34
+ end
35
+
36
+ # An array for nullable fields
37
+ def self.nullables
38
+ []
39
+ end
40
+
41
+ def initialize(currency: SKIP, elements: SKIP, additional_properties: nil)
42
+ # Add additional model properties to the instance
43
+ additional_properties = {} if additional_properties.nil?
44
+
45
+ @currency = currency unless currency == SKIP
46
+ @elements = elements unless elements == 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
+ currency = hash.key?('currency') ? hash['currency'] : SKIP
56
+ # Parameter is an array, so we need to iterate through it
57
+ elements = nil
58
+ unless hash['elements'].nil?
59
+ elements = []
60
+ hash['elements'].each do |structure|
61
+ elements << (TariffElement.from_hash(structure) if structure)
62
+ end
63
+ end
64
+
65
+ elements = SKIP unless hash.key?('elements')
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
+ Tariffs.new(currency: currency,
76
+ elements: elements,
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} currency: #{@currency}, elements: #{@elements}, 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} currency: #{@currency.inspect}, elements: #{@elements.inspect},"\
91
+ " additional_properties: #{@additional_properties}>"
92
+ end
93
+ end
94
+ 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
+ # TimeOfUseSettingsRequest Model.
8
+ class TimeOfUseSettingsRequest < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [TouSettings]
14
+ attr_accessor :tou_settings
15
+
16
+ # A mapping from model property names to API property names.
17
+ def self.names
18
+ @_hash = {} if @_hash.nil?
19
+ @_hash['tou_settings'] = 'tou_settings'
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(tou_settings:, additional_properties: nil)
34
+ # Add additional model properties to the instance
35
+ additional_properties = {} if additional_properties.nil?
36
+
37
+ @tou_settings = tou_settings
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
+ tou_settings = TouSettings.from_hash(hash['tou_settings']) if hash['tou_settings']
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
+ TimeOfUseSettingsRequest.new(tou_settings: tou_settings,
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} tou_settings: #{@tou_settings}, 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} tou_settings: #{@tou_settings.inspect}, additional_properties:"\
71
+ " #{@additional_properties}>"
72
+ end
73
+ end
74
+ end
@@ -0,0 +1,95 @@
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
+ # TotalCost Model.
8
+ class TotalCost < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [Float]
14
+ attr_accessor :excl_vat
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [Float]
18
+ attr_accessor :incl_vat
19
+
20
+ # TODO: Write general description for this method
21
+ # @return [Float]
22
+ attr_accessor :vat
23
+
24
+ # A mapping from model property names to API property names.
25
+ def self.names
26
+ @_hash = {} if @_hash.nil?
27
+ @_hash['excl_vat'] = 'excl_vat'
28
+ @_hash['incl_vat'] = 'incl_vat'
29
+ @_hash['vat'] = 'vat'
30
+ @_hash
31
+ end
32
+
33
+ # An array for optional fields
34
+ def self.optionals
35
+ %w[
36
+ excl_vat
37
+ incl_vat
38
+ vat
39
+ ]
40
+ end
41
+
42
+ # An array for nullable fields
43
+ def self.nullables
44
+ []
45
+ end
46
+
47
+ def initialize(excl_vat: SKIP, incl_vat: SKIP, vat: SKIP,
48
+ additional_properties: nil)
49
+ # Add additional model properties to the instance
50
+ additional_properties = {} if additional_properties.nil?
51
+
52
+ @excl_vat = excl_vat unless excl_vat == SKIP
53
+ @incl_vat = incl_vat unless incl_vat == SKIP
54
+ @vat = vat unless vat == 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
+ excl_vat = hash.key?('excl_vat') ? hash['excl_vat'] : SKIP
64
+ incl_vat = hash.key?('incl_vat') ? hash['incl_vat'] : SKIP
65
+ vat = hash.key?('vat') ? hash['vat'] : 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
+ TotalCost.new(excl_vat: excl_vat,
76
+ incl_vat: incl_vat,
77
+ vat: vat,
78
+ additional_properties: additional_properties)
79
+ end
80
+
81
+ # Provides a human-readable string representation of the object.
82
+ def to_s
83
+ class_name = self.class.name.split('::').last
84
+ "<#{class_name} excl_vat: #{@excl_vat}, incl_vat: #{@incl_vat}, vat: #{@vat},"\
85
+ " additional_properties: #{@additional_properties}>"
86
+ end
87
+
88
+ # Provides a debugging-friendly string with detailed object information.
89
+ def inspect
90
+ class_name = self.class.name.split('::').last
91
+ "<#{class_name} excl_vat: #{@excl_vat.inspect}, incl_vat: #{@incl_vat.inspect}, vat:"\
92
+ " #{@vat.inspect}, additional_properties: #{@additional_properties}>"
93
+ end
94
+ end
95
+ end
@@ -0,0 +1,77 @@
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
+ # TouSettings Model.
8
+ class TouSettings < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [Object]
14
+ attr_accessor :tariff_content_v2
15
+
16
+ # A mapping from model property names to API property names.
17
+ def self.names
18
+ @_hash = {} if @_hash.nil?
19
+ @_hash['tariff_content_v2'] = 'tariff_content_v2'
20
+ @_hash
21
+ end
22
+
23
+ # An array for optional fields
24
+ def self.optionals
25
+ %w[
26
+ tariff_content_v2
27
+ ]
28
+ end
29
+
30
+ # An array for nullable fields
31
+ def self.nullables
32
+ []
33
+ end
34
+
35
+ def initialize(tariff_content_v2: SKIP, additional_properties: nil)
36
+ # Add additional model properties to the instance
37
+ additional_properties = {} if additional_properties.nil?
38
+
39
+ @tariff_content_v2 = tariff_content_v2 unless tariff_content_v2 == 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
+ tariff_content_v2 =
49
+ hash.key?('tariff_content_v2') ? hash['tariff_content_v2'] : SKIP
50
+
51
+ # Create a new hash for additional properties, removing known properties.
52
+ new_hash = hash.reject { |k, _| names.value?(k) }
53
+
54
+ additional_properties = APIHelper.get_additional_properties(
55
+ new_hash, proc { |value| value }
56
+ )
57
+
58
+ # Create object from extracted values.
59
+ TouSettings.new(tariff_content_v2: tariff_content_v2,
60
+ additional_properties: additional_properties)
61
+ end
62
+
63
+ # Provides a human-readable string representation of the object.
64
+ def to_s
65
+ class_name = self.class.name.split('::').last
66
+ "<#{class_name} tariff_content_v2: #{@tariff_content_v2}, additional_properties:"\
67
+ " #{@additional_properties}>"
68
+ end
69
+
70
+ # Provides a debugging-friendly string with detailed object information.
71
+ def inspect
72
+ class_name = self.class.name.split('::').last
73
+ "<#{class_name} tariff_content_v2: #{@tariff_content_v2.inspect}, additional_properties:"\
74
+ " #{@additional_properties}>"
75
+ end
76
+ end
77
+ end
@@ -0,0 +1,147 @@
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
+ # VehicleBase Model.
8
+ class VehicleBase < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [Integer]
14
+ attr_accessor :id
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [Integer]
18
+ attr_accessor :vehicle_id
19
+
20
+ # TODO: Write general description for this method
21
+ # @return [String]
22
+ attr_accessor :vin
23
+
24
+ # TODO: Write general description for this method
25
+ # @return [String]
26
+ attr_accessor :display_name
27
+
28
+ # TODO: Write general description for this method
29
+ # @return [String]
30
+ attr_accessor :access_type
31
+
32
+ # TODO: Write general description for this method
33
+ # @return [String]
34
+ attr_accessor :state
35
+
36
+ # TODO: Write general description for this method
37
+ # @return [TrueClass | FalseClass]
38
+ attr_accessor :in_service
39
+
40
+ # TODO: Write general description for this method
41
+ # @return [TrueClass | FalseClass]
42
+ attr_accessor :calendar_enabled
43
+
44
+ # A mapping from model property names to API property names.
45
+ def self.names
46
+ @_hash = {} if @_hash.nil?
47
+ @_hash['id'] = 'id'
48
+ @_hash['vehicle_id'] = 'vehicle_id'
49
+ @_hash['vin'] = 'vin'
50
+ @_hash['display_name'] = 'display_name'
51
+ @_hash['access_type'] = 'access_type'
52
+ @_hash['state'] = 'state'
53
+ @_hash['in_service'] = 'in_service'
54
+ @_hash['calendar_enabled'] = 'calendar_enabled'
55
+ @_hash
56
+ end
57
+
58
+ # An array for optional fields
59
+ def self.optionals
60
+ %w[
61
+ id
62
+ vehicle_id
63
+ vin
64
+ display_name
65
+ access_type
66
+ state
67
+ in_service
68
+ calendar_enabled
69
+ ]
70
+ end
71
+
72
+ # An array for nullable fields
73
+ def self.nullables
74
+ []
75
+ end
76
+
77
+ def initialize(id: SKIP, vehicle_id: SKIP, vin: SKIP, display_name: SKIP,
78
+ access_type: SKIP, state: SKIP, in_service: SKIP,
79
+ calendar_enabled: SKIP, additional_properties: nil)
80
+ # Add additional model properties to the instance
81
+ additional_properties = {} if additional_properties.nil?
82
+
83
+ @id = id unless id == SKIP
84
+ @vehicle_id = vehicle_id unless vehicle_id == SKIP
85
+ @vin = vin unless vin == SKIP
86
+ @display_name = display_name unless display_name == SKIP
87
+ @access_type = access_type unless access_type == SKIP
88
+ @state = state unless state == SKIP
89
+ @in_service = in_service unless in_service == SKIP
90
+ @calendar_enabled = calendar_enabled unless calendar_enabled == SKIP
91
+ @additional_properties = additional_properties
92
+ end
93
+
94
+ # Creates an instance of the object from a hash.
95
+ def self.from_hash(hash)
96
+ return nil unless hash
97
+
98
+ # Extract variables from the hash.
99
+ id = hash.key?('id') ? hash['id'] : SKIP
100
+ vehicle_id = hash.key?('vehicle_id') ? hash['vehicle_id'] : SKIP
101
+ vin = hash.key?('vin') ? hash['vin'] : SKIP
102
+ display_name = hash.key?('display_name') ? hash['display_name'] : SKIP
103
+ access_type = hash.key?('access_type') ? hash['access_type'] : SKIP
104
+ state = hash.key?('state') ? hash['state'] : SKIP
105
+ in_service = hash.key?('in_service') ? hash['in_service'] : SKIP
106
+ calendar_enabled =
107
+ hash.key?('calendar_enabled') ? hash['calendar_enabled'] : SKIP
108
+
109
+ # Create a new hash for additional properties, removing known properties.
110
+ new_hash = hash.reject { |k, _| names.value?(k) }
111
+
112
+ additional_properties = APIHelper.get_additional_properties(
113
+ new_hash, proc { |value| value }
114
+ )
115
+
116
+ # Create object from extracted values.
117
+ VehicleBase.new(id: id,
118
+ vehicle_id: vehicle_id,
119
+ vin: vin,
120
+ display_name: display_name,
121
+ access_type: access_type,
122
+ state: state,
123
+ in_service: in_service,
124
+ calendar_enabled: calendar_enabled,
125
+ additional_properties: additional_properties)
126
+ end
127
+
128
+ # Provides a human-readable string representation of the object.
129
+ def to_s
130
+ class_name = self.class.name.split('::').last
131
+ "<#{class_name} id: #{@id}, vehicle_id: #{@vehicle_id}, vin: #{@vin}, display_name:"\
132
+ " #{@display_name}, access_type: #{@access_type}, state: #{@state}, in_service:"\
133
+ " #{@in_service}, calendar_enabled: #{@calendar_enabled}, additional_properties:"\
134
+ " #{@additional_properties}>"
135
+ end
136
+
137
+ # Provides a debugging-friendly string with detailed object information.
138
+ def inspect
139
+ class_name = self.class.name.split('::').last
140
+ "<#{class_name} id: #{@id.inspect}, vehicle_id: #{@vehicle_id.inspect}, vin:"\
141
+ " #{@vin.inspect}, display_name: #{@display_name.inspect}, access_type:"\
142
+ " #{@access_type.inspect}, state: #{@state.inspect}, in_service: #{@in_service.inspect},"\
143
+ " calendar_enabled: #{@calendar_enabled.inspect}, additional_properties:"\
144
+ " #{@additional_properties}>"
145
+ end
146
+ end
147
+ end
@@ -0,0 +1,107 @@
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
+ # VehicleOption Model.
8
+ class VehicleOption < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [String]
14
+ attr_accessor :code
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [String]
18
+ attr_accessor :display_name
19
+
20
+ # TODO: Write general description for this method
21
+ # @return [String]
22
+ attr_accessor :color_code
23
+
24
+ # TODO: Write general description for this method
25
+ # @return [TrueClass | FalseClass]
26
+ attr_accessor :is_active
27
+
28
+ # A mapping from model property names to API property names.
29
+ def self.names
30
+ @_hash = {} if @_hash.nil?
31
+ @_hash['code'] = 'code'
32
+ @_hash['display_name'] = 'displayName'
33
+ @_hash['color_code'] = 'colorCode'
34
+ @_hash['is_active'] = 'isActive'
35
+ @_hash
36
+ end
37
+
38
+ # An array for optional fields
39
+ def self.optionals
40
+ %w[
41
+ code
42
+ display_name
43
+ color_code
44
+ is_active
45
+ ]
46
+ end
47
+
48
+ # An array for nullable fields
49
+ def self.nullables
50
+ %w[
51
+ color_code
52
+ ]
53
+ end
54
+
55
+ def initialize(code: SKIP, display_name: SKIP, color_code: SKIP,
56
+ is_active: SKIP, additional_properties: nil)
57
+ # Add additional model properties to the instance
58
+ additional_properties = {} if additional_properties.nil?
59
+
60
+ @code = code unless code == SKIP
61
+ @display_name = display_name unless display_name == SKIP
62
+ @color_code = color_code unless color_code == SKIP
63
+ @is_active = is_active unless is_active == SKIP
64
+ @additional_properties = additional_properties
65
+ end
66
+
67
+ # Creates an instance of the object from a hash.
68
+ def self.from_hash(hash)
69
+ return nil unless hash
70
+
71
+ # Extract variables from the hash.
72
+ code = hash.key?('code') ? hash['code'] : SKIP
73
+ display_name = hash.key?('displayName') ? hash['displayName'] : SKIP
74
+ color_code = hash.key?('colorCode') ? hash['colorCode'] : SKIP
75
+ is_active = hash.key?('isActive') ? hash['isActive'] : SKIP
76
+
77
+ # Create a new hash for additional properties, removing known properties.
78
+ new_hash = hash.reject { |k, _| names.value?(k) }
79
+
80
+ additional_properties = APIHelper.get_additional_properties(
81
+ new_hash, proc { |value| value }
82
+ )
83
+
84
+ # Create object from extracted values.
85
+ VehicleOption.new(code: code,
86
+ display_name: display_name,
87
+ color_code: color_code,
88
+ is_active: is_active,
89
+ additional_properties: additional_properties)
90
+ end
91
+
92
+ # Provides a human-readable string representation of the object.
93
+ def to_s
94
+ class_name = self.class.name.split('::').last
95
+ "<#{class_name} code: #{@code}, display_name: #{@display_name}, color_code: #{@color_code},"\
96
+ " is_active: #{@is_active}, additional_properties: #{@additional_properties}>"
97
+ end
98
+
99
+ # Provides a debugging-friendly string with detailed object information.
100
+ def inspect
101
+ class_name = self.class.name.split('::').last
102
+ "<#{class_name} code: #{@code.inspect}, display_name: #{@display_name.inspect}, color_code:"\
103
+ " #{@color_code.inspect}, is_active: #{@is_active.inspect}, additional_properties:"\
104
+ " #{@additional_properties}>"
105
+ end
106
+ end
107
+ end