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,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
+ # PriceComponent Model.
8
+ class PriceComponent < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [String]
14
+ attr_accessor :type
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [Float]
18
+ attr_accessor :price
19
+
20
+ # TODO: Write general description for this method
21
+ # @return [Float]
22
+ attr_accessor :step_size
23
+
24
+ # A mapping from model property names to API property names.
25
+ def self.names
26
+ @_hash = {} if @_hash.nil?
27
+ @_hash['type'] = 'type'
28
+ @_hash['price'] = 'price'
29
+ @_hash['step_size'] = 'step_size'
30
+ @_hash
31
+ end
32
+
33
+ # An array for optional fields
34
+ def self.optionals
35
+ %w[
36
+ type
37
+ price
38
+ step_size
39
+ ]
40
+ end
41
+
42
+ # An array for nullable fields
43
+ def self.nullables
44
+ []
45
+ end
46
+
47
+ def initialize(type: SKIP, price: SKIP, step_size: SKIP,
48
+ additional_properties: nil)
49
+ # Add additional model properties to the instance
50
+ additional_properties = {} if additional_properties.nil?
51
+
52
+ @type = type unless type == SKIP
53
+ @price = price unless price == SKIP
54
+ @step_size = step_size unless step_size == 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
+ type = hash.key?('type') ? hash['type'] : SKIP
64
+ price = hash.key?('price') ? hash['price'] : SKIP
65
+ step_size = hash.key?('step_size') ? hash['step_size'] : 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
+ PriceComponent.new(type: type,
76
+ price: price,
77
+ step_size: step_size,
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} type: #{@type}, price: #{@price}, step_size: #{@step_size},"\
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} type: #{@type.inspect}, price: #{@price.inspect}, step_size:"\
92
+ " #{@step_size.inspect}, additional_properties: #{@additional_properties}>"
93
+ end
94
+ end
95
+ end
@@ -0,0 +1,85 @@
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
+ # ProductsResponse Model.
8
+ class ProductsResponse < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [Array[Object]]
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
+ response = hash.key?('response') ? hash['response'] : SKIP
56
+ count = hash.key?('count') ? hash['count'] : SKIP
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
+ ProductsResponse.new(response: response,
67
+ count: count,
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} response: #{@response}, count: #{@count}, additional_properties:"\
75
+ " #{@additional_properties}>"
76
+ end
77
+
78
+ # Provides a debugging-friendly string with detailed object information.
79
+ def inspect
80
+ class_name = self.class.name.split('::').last
81
+ "<#{class_name} response: #{@response.inspect}, count: #{@count.inspect},"\
82
+ " additional_properties: #{@additional_properties}>"
83
+ end
84
+ end
85
+ end
@@ -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
+ # PublicKeyResponse Model.
8
+ class PublicKeyResponse < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [ResponsePublicKeyResponse]
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 = ResponsePublicKeyResponse.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
+ PublicKeyResponse.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,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
+ # RegionResponse Model.
8
+ class RegionResponse < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [ResponseRegionResponse]
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 = ResponseRegionResponse.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
+ RegionResponse.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,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
+ # RegisterPartnerRequest Model.
8
+ class RegisterPartnerRequest < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [String]
14
+ attr_accessor :domain
15
+
16
+ # A mapping from model property names to API property names.
17
+ def self.names
18
+ @_hash = {} if @_hash.nil?
19
+ @_hash['domain'] = 'domain'
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(domain:, additional_properties: nil)
34
+ # Add additional model properties to the instance
35
+ additional_properties = {} if additional_properties.nil?
36
+
37
+ @domain = domain
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
+ domain = hash.key?('domain') ? hash['domain'] : nil
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
+ RegisterPartnerRequest.new(domain: domain,
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} domain: #{@domain}, 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} domain: #{@domain.inspect}, additional_properties:"\
70
+ " #{@additional_properties}>"
71
+ end
72
+ end
73
+ end
@@ -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
+ # RegisterPartnerResponse Model.
8
+ class RegisterPartnerResponse < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [ResponseRegisterPartnerResponse]
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 = ResponseRegisterPartnerResponse.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
+ RegisterPartnerResponse.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,82 @@
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
+ # Response Model.
8
+ class Response < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [Integer]
14
+ attr_accessor :code
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [String]
18
+ attr_accessor :message
19
+
20
+ # A mapping from model property names to API property names.
21
+ def self.names
22
+ @_hash = {} if @_hash.nil?
23
+ @_hash['code'] = 'code'
24
+ @_hash['message'] = 'message'
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(code:, message:, additional_properties: nil)
39
+ # Add additional model properties to the instance
40
+ additional_properties = {} if additional_properties.nil?
41
+
42
+ @code = code
43
+ @message = message
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
+ code = hash.key?('code') ? hash['code'] : nil
53
+ message = hash.key?('message') ? hash['message'] : nil
54
+
55
+ # Create a new hash for additional properties, removing known properties.
56
+ new_hash = hash.reject { |k, _| names.value?(k) }
57
+
58
+ additional_properties = APIHelper.get_additional_properties(
59
+ new_hash, proc { |value| value }
60
+ )
61
+
62
+ # Create object from extracted values.
63
+ Response.new(code: code,
64
+ message: message,
65
+ additional_properties: additional_properties)
66
+ end
67
+
68
+ # Provides a human-readable string representation of the object.
69
+ def to_s
70
+ class_name = self.class.name.split('::').last
71
+ "<#{class_name} code: #{@code}, message: #{@message}, additional_properties:"\
72
+ " #{@additional_properties}>"
73
+ end
74
+
75
+ # Provides a debugging-friendly string with detailed object information.
76
+ def inspect
77
+ class_name = self.class.name.split('::').last
78
+ "<#{class_name} code: #{@code.inspect}, message: #{@message.inspect},"\
79
+ " additional_properties: #{@additional_properties}>"
80
+ end
81
+ end
82
+ end
@@ -0,0 +1,75 @@
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
+ # Response1 Model.
8
+ class Response1 < 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 :fleet_telemetry_error_vins
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_error_vins'] = 'fleet_telemetry_error_vins'
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_error_vins:, additional_properties: nil)
34
+ # Add additional model properties to the instance
35
+ additional_properties = {} if additional_properties.nil?
36
+
37
+ @fleet_telemetry_error_vins = fleet_telemetry_error_vins
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
+ fleet_telemetry_error_vins =
47
+ hash.key?('fleet_telemetry_error_vins') ? hash['fleet_telemetry_error_vins'] : nil
48
+
49
+ # Create a new hash for additional properties, removing known properties.
50
+ new_hash = hash.reject { |k, _| names.value?(k) }
51
+
52
+ additional_properties = APIHelper.get_additional_properties(
53
+ new_hash, proc { |value| value }
54
+ )
55
+
56
+ # Create object from extracted values.
57
+ Response1.new(fleet_telemetry_error_vins: fleet_telemetry_error_vins,
58
+ additional_properties: additional_properties)
59
+ end
60
+
61
+ # Provides a human-readable string representation of the object.
62
+ def to_s
63
+ class_name = self.class.name.split('::').last
64
+ "<#{class_name} fleet_telemetry_error_vins: #{@fleet_telemetry_error_vins},"\
65
+ " 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} fleet_telemetry_error_vins: #{@fleet_telemetry_error_vins.inspect},"\
72
+ " additional_properties: #{@additional_properties}>"
73
+ end
74
+ end
75
+ end