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,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
+ # MobileEnabled Model.
8
+ class MobileEnabled < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [TrueClass | FalseClass]
14
+ attr_accessor :result
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [String]
18
+ attr_accessor :reason
19
+
20
+ # A mapping from model property names to API property names.
21
+ def self.names
22
+ @_hash = {} if @_hash.nil?
23
+ @_hash['result'] = 'result'
24
+ @_hash['reason'] = 'reason'
25
+ @_hash
26
+ end
27
+
28
+ # An array for optional fields
29
+ def self.optionals
30
+ %w[
31
+ result
32
+ reason
33
+ ]
34
+ end
35
+
36
+ # An array for nullable fields
37
+ def self.nullables
38
+ []
39
+ end
40
+
41
+ def initialize(result: SKIP, reason: SKIP, additional_properties: nil)
42
+ # Add additional model properties to the instance
43
+ additional_properties = {} if additional_properties.nil?
44
+
45
+ @result = result unless result == SKIP
46
+ @reason = reason unless reason == 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
+ result = hash.key?('result') ? hash['result'] : SKIP
56
+ reason = hash.key?('reason') ? hash['reason'] : 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
+ MobileEnabled.new(result: result,
67
+ reason: reason,
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} result: #{@result}, reason: #{@reason}, 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} result: #{@result.inspect}, reason: #{@reason.inspect},"\
82
+ " additional_properties: #{@additional_properties}>"
83
+ end
84
+ end
85
+ end
@@ -0,0 +1,62 @@
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
+ # OAuth 2 Authorization error codes
8
+ class OauthProviderError
9
+ OAUTH_PROVIDER_ERROR = [
10
+ # The request is missing a required parameter, includes an unsupported
11
+ # parameter value (other than grant type), repeats a parameter, includes
12
+ # multiple credentials, utilizes more than one mechanism for
13
+ # authenticating the client, or is otherwise malformed.
14
+ INVALID_REQUEST = 'invalid_request'.freeze,
15
+
16
+ # Client authentication failed (e.g., unknown client, no client
17
+ # authentication included, or unsupported authentication method).
18
+ INVALID_CLIENT = 'invalid_client'.freeze,
19
+
20
+ # The provided authorization grant (e.g., authorization code, resource
21
+ # owner credentials) or refresh token is invalid, expired, revoked, does
22
+ # not match the redirection URI used in the authorization request, or was
23
+ # issued to another client.
24
+ INVALID_GRANT = 'invalid_grant'.freeze,
25
+
26
+ # The authenticated client is not authorized to use this authorization
27
+ # grant type.
28
+ UNAUTHORIZED_CLIENT = 'unauthorized_client'.freeze,
29
+
30
+ # The authorization grant type is not supported by the authorization
31
+ # server.
32
+ UNSUPPORTED_GRANT_TYPE = 'unsupported_grant_type'.freeze,
33
+
34
+ # The requested scope is invalid, unknown, malformed, or exceeds the scope
35
+ # granted by the resource owner.
36
+ INVALID_SCOPE = 'invalid_scope'.freeze
37
+ ].freeze
38
+
39
+ def self.validate(value)
40
+ return false if value.nil?
41
+
42
+ OAUTH_PROVIDER_ERROR.include?(value)
43
+ end
44
+
45
+ def self.from_value(value, default_value = INVALID_REQUEST)
46
+ return default_value if value.nil?
47
+
48
+ str = value.to_s.strip
49
+
50
+ case str.downcase
51
+ when 'invalid_request' then INVALID_REQUEST
52
+ when 'invalid_client' then INVALID_CLIENT
53
+ when 'invalid_grant' then INVALID_GRANT
54
+ when 'unauthorized_client' then UNAUTHORIZED_CLIENT
55
+ when 'unsupported_grant_type' then UNSUPPORTED_GRANT_TYPE
56
+ when 'invalid_scope' then INVALID_SCOPE
57
+ else
58
+ default_value
59
+ end
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,96 @@
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
+ # OAuth 2 Authorization endpoint response
8
+ class OauthToken < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Access token
13
+ # @return [String]
14
+ attr_accessor :access_token
15
+
16
+ # Type of access token
17
+ # @return [String]
18
+ attr_accessor :token_type
19
+
20
+ # Time in seconds before the access token expires
21
+ # @return [Integer]
22
+ attr_accessor :expires_in
23
+
24
+ # List of scopes granted
25
+ # This is a space-delimited list of strings.
26
+ # @return [String]
27
+ attr_accessor :scope
28
+
29
+ # Time of token expiry as unix timestamp (UTC)
30
+ # @return [Integer]
31
+ attr_accessor :expiry
32
+
33
+ # Refresh token
34
+ # Used to get a new access token when it expires.
35
+ # @return [String]
36
+ attr_accessor :refresh_token
37
+
38
+ # A mapping from model property names to API property names.
39
+ def self.names
40
+ @_hash = {} if @_hash.nil?
41
+ @_hash['access_token'] = 'access_token'
42
+ @_hash['token_type'] = 'token_type'
43
+ @_hash['expires_in'] = 'expires_in'
44
+ @_hash['scope'] = 'scope'
45
+ @_hash['expiry'] = 'expiry'
46
+ @_hash['refresh_token'] = 'refresh_token'
47
+ @_hash
48
+ end
49
+
50
+ # An array for optional fields
51
+ def self.optionals
52
+ %w[
53
+ expires_in
54
+ scope
55
+ expiry
56
+ refresh_token
57
+ ]
58
+ end
59
+
60
+ # An array for nullable fields
61
+ def self.nullables
62
+ []
63
+ end
64
+
65
+ def initialize(access_token:, token_type:, expires_in: SKIP, scope: SKIP,
66
+ expiry: SKIP, refresh_token: SKIP)
67
+ @access_token = access_token
68
+ @token_type = token_type
69
+ @expires_in = expires_in unless expires_in == SKIP
70
+ @scope = scope unless scope == SKIP
71
+ @expiry = expiry unless expiry == SKIP
72
+ @refresh_token = refresh_token unless refresh_token == SKIP
73
+ end
74
+
75
+ # Creates an instance of the object from a hash.
76
+ def self.from_hash(hash)
77
+ return nil unless hash
78
+
79
+ # Extract variables from the hash.
80
+ access_token = hash.key?('access_token') ? hash['access_token'] : nil
81
+ token_type = hash.key?('token_type') ? hash['token_type'] : nil
82
+ expires_in = hash.key?('expires_in') ? hash['expires_in'] : SKIP
83
+ scope = hash.key?('scope') ? hash['scope'] : SKIP
84
+ expiry = hash.key?('expiry') ? hash['expiry'] : SKIP
85
+ refresh_token = hash.key?('refresh_token') ? hash['refresh_token'] : SKIP
86
+
87
+ # Create object from extracted values.
88
+ OauthToken.new(access_token: access_token,
89
+ token_type: token_type,
90
+ expires_in: expires_in,
91
+ scope: scope,
92
+ expiry: expiry,
93
+ refresh_token: refresh_token)
94
+ end
95
+ end
96
+ end
@@ -0,0 +1,79 @@
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
+ # OffGridVehicleChargingReserveRequest Model.
8
+ class OffGridVehicleChargingReserveRequest < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [Integer]
14
+ attr_accessor :off_grid_vehicle_charging_reserve_percent
15
+
16
+ # A mapping from model property names to API property names.
17
+ def self.names
18
+ @_hash = {} if @_hash.nil?
19
+ @_hash['off_grid_vehicle_charging_reserve_percent'] =
20
+ 'off_grid_vehicle_charging_reserve_percent'
21
+ @_hash
22
+ end
23
+
24
+ # An array for optional fields
25
+ def self.optionals
26
+ []
27
+ end
28
+
29
+ # An array for nullable fields
30
+ def self.nullables
31
+ []
32
+ end
33
+
34
+ def initialize(off_grid_vehicle_charging_reserve_percent:,
35
+ additional_properties: nil)
36
+ # Add additional model properties to the instance
37
+ additional_properties = {} if additional_properties.nil?
38
+
39
+ @off_grid_vehicle_charging_reserve_percent = off_grid_vehicle_charging_reserve_percent
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
+ off_grid_vehicle_charging_reserve_percent =
49
+ hash.key?('off_grid_vehicle_charging_reserve_percent') ? hash['off_grid_vehicle_charging_reserve_percent'] : nil
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
+ OffGridVehicleChargingReserveRequest.new(off_grid_vehicle_charging_reserve_percent: off_grid_vehicle_charging_reserve_percent,
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} off_grid_vehicle_charging_reserve_percent:"\
67
+ " #{@off_grid_vehicle_charging_reserve_percent}, additional_properties:"\
68
+ " #{@additional_properties}>"
69
+ end
70
+
71
+ # Provides a debugging-friendly string with detailed object information.
72
+ def inspect
73
+ class_name = self.class.name.split('::').last
74
+ "<#{class_name} off_grid_vehicle_charging_reserve_percent:"\
75
+ " #{@off_grid_vehicle_charging_reserve_percent.inspect}, additional_properties:"\
76
+ " #{@additional_properties}>"
77
+ end
78
+ end
79
+ 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
+ # OperationRequest Model.
8
+ class OperationRequest < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [DefaultRealMode]
14
+ attr_accessor :default_real_mode
15
+
16
+ # A mapping from model property names to API property names.
17
+ def self.names
18
+ @_hash = {} if @_hash.nil?
19
+ @_hash['default_real_mode'] = 'default_real_mode'
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(default_real_mode:, additional_properties: nil)
34
+ # Add additional model properties to the instance
35
+ additional_properties = {} if additional_properties.nil?
36
+
37
+ @default_real_mode = default_real_mode
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
+ default_real_mode =
47
+ hash.key?('default_real_mode') ? hash['default_real_mode'] : 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
+ OperationRequest.new(default_real_mode: default_real_mode,
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} default_real_mode: #{@default_real_mode}, additional_properties:"\
65
+ " #{@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} default_real_mode: #{@default_real_mode.inspect}, additional_properties:"\
72
+ " #{@additional_properties}>"
73
+ end
74
+ end
75
+ 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
+ # OrdersResponse Model.
8
+ class OrdersResponse < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [Array[ResponseOrdersResponse]]
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
+ []
31
+ end
32
+
33
+ # An array for nullable fields
34
+ def self.nullables
35
+ []
36
+ end
37
+
38
+ def initialize(response:, count:, additional_properties: nil)
39
+ # Add additional model properties to the instance
40
+ additional_properties = {} if additional_properties.nil?
41
+
42
+ @response = response
43
+ @count = count
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
+ response = nil
54
+ unless hash['response'].nil?
55
+ response = []
56
+ hash['response'].each do |structure|
57
+ response << (ResponseOrdersResponse.from_hash(structure) if structure)
58
+ end
59
+ end
60
+
61
+ response = nil unless hash.key?('response')
62
+ count = hash.key?('count') ? hash['count'] : 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
+ OrdersResponse.new(response: response,
73
+ count: count,
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} response: #{@response}, count: #{@count}, 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} response: #{@response.inspect}, count: #{@count.inspect},"\
88
+ " additional_properties: #{@additional_properties}>"
89
+ end
90
+ end
91
+ end
@@ -0,0 +1,127 @@
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
+ # Pagination Model.
8
+ class Pagination < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [Integer]
14
+ attr_accessor :previous
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [Integer]
18
+ attr_accessor :mnext
19
+
20
+ # TODO: Write general description for this method
21
+ # @return [Integer]
22
+ attr_accessor :current
23
+
24
+ # TODO: Write general description for this method
25
+ # @return [Integer]
26
+ attr_accessor :per_page
27
+
28
+ # TODO: Write general description for this method
29
+ # @return [Integer]
30
+ attr_accessor :count
31
+
32
+ # TODO: Write general description for this method
33
+ # @return [Integer]
34
+ attr_accessor :pages
35
+
36
+ # A mapping from model property names to API property names.
37
+ def self.names
38
+ @_hash = {} if @_hash.nil?
39
+ @_hash['previous'] = 'previous'
40
+ @_hash['mnext'] = 'next'
41
+ @_hash['current'] = 'current'
42
+ @_hash['per_page'] = 'per_page'
43
+ @_hash['count'] = 'count'
44
+ @_hash['pages'] = 'pages'
45
+ @_hash
46
+ end
47
+
48
+ # An array for optional fields
49
+ def self.optionals
50
+ %w[
51
+ previous
52
+ mnext
53
+ current
54
+ per_page
55
+ count
56
+ pages
57
+ ]
58
+ end
59
+
60
+ # An array for nullable fields
61
+ def self.nullables
62
+ %w[
63
+ previous
64
+ mnext
65
+ ]
66
+ end
67
+
68
+ def initialize(previous: SKIP, mnext: SKIP, current: SKIP, per_page: SKIP,
69
+ count: SKIP, pages: SKIP, additional_properties: nil)
70
+ # Add additional model properties to the instance
71
+ additional_properties = {} if additional_properties.nil?
72
+
73
+ @previous = previous unless previous == SKIP
74
+ @mnext = mnext unless mnext == SKIP
75
+ @current = current unless current == SKIP
76
+ @per_page = per_page unless per_page == SKIP
77
+ @count = count unless count == SKIP
78
+ @pages = pages unless pages == SKIP
79
+ @additional_properties = additional_properties
80
+ end
81
+
82
+ # Creates an instance of the object from a hash.
83
+ def self.from_hash(hash)
84
+ return nil unless hash
85
+
86
+ # Extract variables from the hash.
87
+ previous = hash.key?('previous') ? hash['previous'] : SKIP
88
+ mnext = hash.key?('next') ? hash['next'] : SKIP
89
+ current = hash.key?('current') ? hash['current'] : SKIP
90
+ per_page = hash.key?('per_page') ? hash['per_page'] : SKIP
91
+ count = hash.key?('count') ? hash['count'] : SKIP
92
+ pages = hash.key?('pages') ? hash['pages'] : SKIP
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
+ Pagination.new(previous: previous,
103
+ mnext: mnext,
104
+ current: current,
105
+ per_page: per_page,
106
+ count: count,
107
+ pages: pages,
108
+ additional_properties: additional_properties)
109
+ end
110
+
111
+ # Provides a human-readable string representation of the object.
112
+ def to_s
113
+ class_name = self.class.name.split('::').last
114
+ "<#{class_name} previous: #{@previous}, mnext: #{@mnext}, current: #{@current}, per_page:"\
115
+ " #{@per_page}, count: #{@count}, pages: #{@pages}, additional_properties:"\
116
+ " #{@additional_properties}>"
117
+ end
118
+
119
+ # Provides a debugging-friendly string with detailed object information.
120
+ def inspect
121
+ class_name = self.class.name.split('::').last
122
+ "<#{class_name} previous: #{@previous.inspect}, mnext: #{@mnext.inspect}, current:"\
123
+ " #{@current.inspect}, per_page: #{@per_page.inspect}, count: #{@count.inspect}, pages:"\
124
+ " #{@pages.inspect}, additional_properties: #{@additional_properties}>"
125
+ end
126
+ end
127
+ end