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.
- checksums.yaml +7 -0
- data/LICENSE +28 -0
- data/README.md +160 -0
- data/bin/console +15 -0
- data/lib/tesla_fleet_management_api/api_helper.rb +10 -0
- data/lib/tesla_fleet_management_api/client.rb +110 -0
- data/lib/tesla_fleet_management_api/configuration.rb +181 -0
- data/lib/tesla_fleet_management_api/controllers/base_controller.rb +65 -0
- data/lib/tesla_fleet_management_api/controllers/charging_controller.rb +62 -0
- data/lib/tesla_fleet_management_api/controllers/energy_controller.rb +315 -0
- data/lib/tesla_fleet_management_api/controllers/oauth_authorization_controller.rb +87 -0
- data/lib/tesla_fleet_management_api/controllers/partner_controller.rb +82 -0
- data/lib/tesla_fleet_management_api/controllers/user_controller.rb +73 -0
- data/lib/tesla_fleet_management_api/controllers/vehicles_controller.rb +431 -0
- data/lib/tesla_fleet_management_api/exceptions/api_exception.rb +21 -0
- data/lib/tesla_fleet_management_api/exceptions/oauth_provider_exception.rb +64 -0
- data/lib/tesla_fleet_management_api/http/api_response.rb +19 -0
- data/lib/tesla_fleet_management_api/http/auth/bearer_auth.rb +53 -0
- data/lib/tesla_fleet_management_api/http/auth/oauth_2.rb +154 -0
- data/lib/tesla_fleet_management_api/http/http_call_back.rb +10 -0
- data/lib/tesla_fleet_management_api/http/http_method_enum.rb +10 -0
- data/lib/tesla_fleet_management_api/http/http_request.rb +10 -0
- data/lib/tesla_fleet_management_api/http/http_response.rb +10 -0
- data/lib/tesla_fleet_management_api/http/proxy_settings.rb +22 -0
- data/lib/tesla_fleet_management_api/logging/configuration/api_logging_configuration.rb +186 -0
- data/lib/tesla_fleet_management_api/logging/sdk_logger.rb +17 -0
- data/lib/tesla_fleet_management_api/models/api1_dx_vehicles_options_response.rb +76 -0
- data/lib/tesla_fleet_management_api/models/api1_dx_warranty_details_response.rb +76 -0
- data/lib/tesla_fleet_management_api/models/api1_vehicles_mobile_enabled_response.rb +75 -0
- data/lib/tesla_fleet_management_api/models/api1_vehicles_nearby_charging_sites_response.rb +75 -0
- data/lib/tesla_fleet_management_api/models/api1_vehicles_response.rb +104 -0
- data/lib/tesla_fleet_management_api/models/api1_vehicles_response_get_vehicle.rb +75 -0
- data/lib/tesla_fleet_management_api/models/api1_vehicles_wake_up_response.rb +75 -0
- data/lib/tesla_fleet_management_api/models/backup_request.rb +75 -0
- data/lib/tesla_fleet_management_api/models/backup_response.rb +73 -0
- data/lib/tesla_fleet_management_api/models/base_model.rb +110 -0
- data/lib/tesla_fleet_management_api/models/calendar_history_response.rb +73 -0
- data/lib/tesla_fleet_management_api/models/charge_duration.rb +73 -0
- data/lib/tesla_fleet_management_api/models/charge_history.rb +96 -0
- data/lib/tesla_fleet_management_api/models/charge_history_response.rb +73 -0
- data/lib/tesla_fleet_management_api/models/charge_start_time.rb +73 -0
- data/lib/tesla_fleet_management_api/models/charging_dimension.rb +85 -0
- data/lib/tesla_fleet_management_api/models/charging_fee.rb +312 -0
- data/lib/tesla_fleet_management_api/models/charging_history_data.rb +81 -0
- data/lib/tesla_fleet_management_api/models/charging_history_item.rb +222 -0
- data/lib/tesla_fleet_management_api/models/charging_history_response.rb +73 -0
- data/lib/tesla_fleet_management_api/models/charging_invoice.rb +95 -0
- data/lib/tesla_fleet_management_api/models/charging_location.rb +158 -0
- data/lib/tesla_fleet_management_api/models/charging_period.rb +96 -0
- data/lib/tesla_fleet_management_api/models/charging_session.rb +187 -0
- data/lib/tesla_fleet_management_api/models/charging_sessions_data.rb +116 -0
- data/lib/tesla_fleet_management_api/models/charging_sessions_response.rb +73 -0
- data/lib/tesla_fleet_management_api/models/default_real_mode.rb +36 -0
- data/lib/tesla_fleet_management_api/models/driver.rb +164 -0
- data/lib/tesla_fleet_management_api/models/drivers_response.rb +94 -0
- data/lib/tesla_fleet_management_api/models/enterprise_payer_request.rb +94 -0
- data/lib/tesla_fleet_management_api/models/event.rb +89 -0
- data/lib/tesla_fleet_management_api/models/fleet_status_request.rb +74 -0
- data/lib/tesla_fleet_management_api/models/fleet_telemetry_error.rb +90 -0
- data/lib/tesla_fleet_management_api/models/fleet_telemetry_errors_response.rb +74 -0
- data/lib/tesla_fleet_management_api/models/fleet_telemetry_jws_request.rb +85 -0
- data/lib/tesla_fleet_management_api/models/generic_update_response.rb +73 -0
- data/lib/tesla_fleet_management_api/models/kind.rb +36 -0
- data/lib/tesla_fleet_management_api/models/kind_get_wall_connector_charging_history.rb +26 -0
- data/lib/tesla_fleet_management_api/models/live_status_response.rb +73 -0
- data/lib/tesla_fleet_management_api/models/location.rb +85 -0
- data/lib/tesla_fleet_management_api/models/location1.rb +85 -0
- data/lib/tesla_fleet_management_api/models/me_response.rb +73 -0
- data/lib/tesla_fleet_management_api/models/mobile_enabled.rb +85 -0
- data/lib/tesla_fleet_management_api/models/oauth_provider_error.rb +62 -0
- data/lib/tesla_fleet_management_api/models/oauth_token.rb +96 -0
- data/lib/tesla_fleet_management_api/models/off_grid_vehicle_charging_reserve_request.rb +79 -0
- data/lib/tesla_fleet_management_api/models/operation_request.rb +75 -0
- data/lib/tesla_fleet_management_api/models/orders_response.rb +91 -0
- data/lib/tesla_fleet_management_api/models/pagination.rb +127 -0
- data/lib/tesla_fleet_management_api/models/price_component.rb +95 -0
- data/lib/tesla_fleet_management_api/models/products_response.rb +85 -0
- data/lib/tesla_fleet_management_api/models/public_key_response.rb +73 -0
- data/lib/tesla_fleet_management_api/models/region_response.rb +73 -0
- data/lib/tesla_fleet_management_api/models/register_partner_request.rb +73 -0
- data/lib/tesla_fleet_management_api/models/register_partner_response.rb +73 -0
- data/lib/tesla_fleet_management_api/models/response.rb +82 -0
- data/lib/tesla_fleet_management_api/models/response1.rb +75 -0
- data/lib/tesla_fleet_management_api/models/response2.rb +74 -0
- data/lib/tesla_fleet_management_api/models/response3.rb +115 -0
- data/lib/tesla_fleet_management_api/models/response_api1_dx_vehicles_options_response.rb +84 -0
- data/lib/tesla_fleet_management_api/models/response_api1_dx_warranty_details_response.rb +124 -0
- data/lib/tesla_fleet_management_api/models/response_calendar_history_response.rb +91 -0
- data/lib/tesla_fleet_management_api/models/response_charge_history_response.rb +83 -0
- data/lib/tesla_fleet_management_api/models/response_fleet_telemetry_errors_response.rb +83 -0
- data/lib/tesla_fleet_management_api/models/response_live_status_response.rb +196 -0
- data/lib/tesla_fleet_management_api/models/response_me_response.rb +102 -0
- data/lib/tesla_fleet_management_api/models/response_orders_response.rb +157 -0
- data/lib/tesla_fleet_management_api/models/response_public_key_response.rb +74 -0
- data/lib/tesla_fleet_management_api/models/response_region_response.rb +83 -0
- data/lib/tesla_fleet_management_api/models/response_register_partner_response.rb +223 -0
- data/lib/tesla_fleet_management_api/models/signaling.rb +94 -0
- data/lib/tesla_fleet_management_api/models/simple_ok_response.rb +75 -0
- data/lib/tesla_fleet_management_api/models/site_info_response.rb +75 -0
- data/lib/tesla_fleet_management_api/models/storm_mode_request.rb +73 -0
- data/lib/tesla_fleet_management_api/models/tariff_element.rb +95 -0
- data/lib/tesla_fleet_management_api/models/tariffs.rb +94 -0
- data/lib/tesla_fleet_management_api/models/time_of_use_settings_request.rb +74 -0
- data/lib/tesla_fleet_management_api/models/total_cost.rb +95 -0
- data/lib/tesla_fleet_management_api/models/tou_settings.rb +77 -0
- data/lib/tesla_fleet_management_api/models/vehicle_base.rb +147 -0
- data/lib/tesla_fleet_management_api/models/vehicle_option.rb +107 -0
- data/lib/tesla_fleet_management_api/models/warranty_item.rb +155 -0
- data/lib/tesla_fleet_management_api/utilities/date_time_helper.rb +11 -0
- data/lib/tesla_fleet_management_api/utilities/file_wrapper.rb +28 -0
- data/lib/tesla_fleet_management_api.rb +153 -0
- 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
|
+
# ChargingInvoice Model.
|
|
8
|
+
class ChargingInvoice < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# TODO: Write general description for this method
|
|
13
|
+
# @return [String]
|
|
14
|
+
attr_accessor :file_name
|
|
15
|
+
|
|
16
|
+
# TODO: Write general description for this method
|
|
17
|
+
# @return [String]
|
|
18
|
+
attr_accessor :content_id
|
|
19
|
+
|
|
20
|
+
# TODO: Write general description for this method
|
|
21
|
+
# @return [String]
|
|
22
|
+
attr_accessor :invoice_type
|
|
23
|
+
|
|
24
|
+
# A mapping from model property names to API property names.
|
|
25
|
+
def self.names
|
|
26
|
+
@_hash = {} if @_hash.nil?
|
|
27
|
+
@_hash['file_name'] = 'fileName'
|
|
28
|
+
@_hash['content_id'] = 'contentId'
|
|
29
|
+
@_hash['invoice_type'] = 'invoiceType'
|
|
30
|
+
@_hash
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# An array for optional fields
|
|
34
|
+
def self.optionals
|
|
35
|
+
%w[
|
|
36
|
+
file_name
|
|
37
|
+
content_id
|
|
38
|
+
invoice_type
|
|
39
|
+
]
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# An array for nullable fields
|
|
43
|
+
def self.nullables
|
|
44
|
+
[]
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def initialize(file_name: SKIP, content_id: SKIP, invoice_type: SKIP,
|
|
48
|
+
additional_properties: nil)
|
|
49
|
+
# Add additional model properties to the instance
|
|
50
|
+
additional_properties = {} if additional_properties.nil?
|
|
51
|
+
|
|
52
|
+
@file_name = file_name unless file_name == SKIP
|
|
53
|
+
@content_id = content_id unless content_id == SKIP
|
|
54
|
+
@invoice_type = invoice_type unless invoice_type == 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
|
+
file_name = hash.key?('fileName') ? hash['fileName'] : SKIP
|
|
64
|
+
content_id = hash.key?('contentId') ? hash['contentId'] : SKIP
|
|
65
|
+
invoice_type = hash.key?('invoiceType') ? hash['invoiceType'] : 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
|
+
ChargingInvoice.new(file_name: file_name,
|
|
76
|
+
content_id: content_id,
|
|
77
|
+
invoice_type: invoice_type,
|
|
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} file_name: #{@file_name}, content_id: #{@content_id}, invoice_type:"\
|
|
85
|
+
" #{@invoice_type}, 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} file_name: #{@file_name.inspect}, content_id: #{@content_id.inspect},"\
|
|
92
|
+
" invoice_type: #{@invoice_type.inspect}, additional_properties: #{@additional_properties}>"
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
end
|
|
@@ -0,0 +1,158 @@
|
|
|
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
|
+
# ChargingLocation Model.
|
|
8
|
+
class ChargingLocation < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# TODO: Write general description for this method
|
|
13
|
+
# @return [String]
|
|
14
|
+
attr_accessor :name
|
|
15
|
+
|
|
16
|
+
# TODO: Write general description for this method
|
|
17
|
+
# @return [String]
|
|
18
|
+
attr_accessor :type
|
|
19
|
+
|
|
20
|
+
# TODO: Write general description for this method
|
|
21
|
+
# @return [Float]
|
|
22
|
+
attr_accessor :distance_miles
|
|
23
|
+
|
|
24
|
+
# TODO: Write general description for this method
|
|
25
|
+
# @return [String]
|
|
26
|
+
attr_accessor :amenities
|
|
27
|
+
|
|
28
|
+
# TODO: Write general description for this method
|
|
29
|
+
# @return [Integer]
|
|
30
|
+
attr_accessor :available_stalls
|
|
31
|
+
|
|
32
|
+
# TODO: Write general description for this method
|
|
33
|
+
# @return [Integer]
|
|
34
|
+
attr_accessor :total_stalls
|
|
35
|
+
|
|
36
|
+
# TODO: Write general description for this method
|
|
37
|
+
# @return [TrueClass | FalseClass]
|
|
38
|
+
attr_accessor :site_closed
|
|
39
|
+
|
|
40
|
+
# TODO: Write general description for this method
|
|
41
|
+
# @return [String]
|
|
42
|
+
attr_accessor :billing_info
|
|
43
|
+
|
|
44
|
+
# TODO: Write general description for this method
|
|
45
|
+
# @return [Location1]
|
|
46
|
+
attr_accessor :location
|
|
47
|
+
|
|
48
|
+
# A mapping from model property names to API property names.
|
|
49
|
+
def self.names
|
|
50
|
+
@_hash = {} if @_hash.nil?
|
|
51
|
+
@_hash['name'] = 'name'
|
|
52
|
+
@_hash['type'] = 'type'
|
|
53
|
+
@_hash['distance_miles'] = 'distance_miles'
|
|
54
|
+
@_hash['amenities'] = 'amenities'
|
|
55
|
+
@_hash['available_stalls'] = 'available_stalls'
|
|
56
|
+
@_hash['total_stalls'] = 'total_stalls'
|
|
57
|
+
@_hash['site_closed'] = 'site_closed'
|
|
58
|
+
@_hash['billing_info'] = 'billing_info'
|
|
59
|
+
@_hash['location'] = 'location'
|
|
60
|
+
@_hash
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# An array for optional fields
|
|
64
|
+
def self.optionals
|
|
65
|
+
%w[
|
|
66
|
+
name
|
|
67
|
+
type
|
|
68
|
+
distance_miles
|
|
69
|
+
amenities
|
|
70
|
+
available_stalls
|
|
71
|
+
total_stalls
|
|
72
|
+
site_closed
|
|
73
|
+
billing_info
|
|
74
|
+
location
|
|
75
|
+
]
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
# An array for nullable fields
|
|
79
|
+
def self.nullables
|
|
80
|
+
[]
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def initialize(name: SKIP, type: SKIP, distance_miles: SKIP,
|
|
84
|
+
amenities: SKIP, available_stalls: SKIP, total_stalls: SKIP,
|
|
85
|
+
site_closed: SKIP, billing_info: SKIP, location: SKIP,
|
|
86
|
+
additional_properties: nil)
|
|
87
|
+
# Add additional model properties to the instance
|
|
88
|
+
additional_properties = {} if additional_properties.nil?
|
|
89
|
+
|
|
90
|
+
@name = name unless name == SKIP
|
|
91
|
+
@type = type unless type == SKIP
|
|
92
|
+
@distance_miles = distance_miles unless distance_miles == SKIP
|
|
93
|
+
@amenities = amenities unless amenities == SKIP
|
|
94
|
+
@available_stalls = available_stalls unless available_stalls == SKIP
|
|
95
|
+
@total_stalls = total_stalls unless total_stalls == SKIP
|
|
96
|
+
@site_closed = site_closed unless site_closed == SKIP
|
|
97
|
+
@billing_info = billing_info unless billing_info == SKIP
|
|
98
|
+
@location = location unless location == SKIP
|
|
99
|
+
@additional_properties = additional_properties
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
# Creates an instance of the object from a hash.
|
|
103
|
+
def self.from_hash(hash)
|
|
104
|
+
return nil unless hash
|
|
105
|
+
|
|
106
|
+
# Extract variables from the hash.
|
|
107
|
+
name = hash.key?('name') ? hash['name'] : SKIP
|
|
108
|
+
type = hash.key?('type') ? hash['type'] : SKIP
|
|
109
|
+
distance_miles =
|
|
110
|
+
hash.key?('distance_miles') ? hash['distance_miles'] : SKIP
|
|
111
|
+
amenities = hash.key?('amenities') ? hash['amenities'] : SKIP
|
|
112
|
+
available_stalls =
|
|
113
|
+
hash.key?('available_stalls') ? hash['available_stalls'] : SKIP
|
|
114
|
+
total_stalls = hash.key?('total_stalls') ? hash['total_stalls'] : SKIP
|
|
115
|
+
site_closed = hash.key?('site_closed') ? hash['site_closed'] : SKIP
|
|
116
|
+
billing_info = hash.key?('billing_info') ? hash['billing_info'] : SKIP
|
|
117
|
+
location = Location1.from_hash(hash['location']) if hash['location']
|
|
118
|
+
|
|
119
|
+
# Create a new hash for additional properties, removing known properties.
|
|
120
|
+
new_hash = hash.reject { |k, _| names.value?(k) }
|
|
121
|
+
|
|
122
|
+
additional_properties = APIHelper.get_additional_properties(
|
|
123
|
+
new_hash, proc { |value| value }
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
# Create object from extracted values.
|
|
127
|
+
ChargingLocation.new(name: name,
|
|
128
|
+
type: type,
|
|
129
|
+
distance_miles: distance_miles,
|
|
130
|
+
amenities: amenities,
|
|
131
|
+
available_stalls: available_stalls,
|
|
132
|
+
total_stalls: total_stalls,
|
|
133
|
+
site_closed: site_closed,
|
|
134
|
+
billing_info: billing_info,
|
|
135
|
+
location: location,
|
|
136
|
+
additional_properties: additional_properties)
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
# Provides a human-readable string representation of the object.
|
|
140
|
+
def to_s
|
|
141
|
+
class_name = self.class.name.split('::').last
|
|
142
|
+
"<#{class_name} name: #{@name}, type: #{@type}, distance_miles: #{@distance_miles},"\
|
|
143
|
+
" amenities: #{@amenities}, available_stalls: #{@available_stalls}, total_stalls:"\
|
|
144
|
+
" #{@total_stalls}, site_closed: #{@site_closed}, billing_info: #{@billing_info}, location:"\
|
|
145
|
+
" #{@location}, additional_properties: #{@additional_properties}>"
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
149
|
+
def inspect
|
|
150
|
+
class_name = self.class.name.split('::').last
|
|
151
|
+
"<#{class_name} name: #{@name.inspect}, type: #{@type.inspect}, distance_miles:"\
|
|
152
|
+
" #{@distance_miles.inspect}, amenities: #{@amenities.inspect}, available_stalls:"\
|
|
153
|
+
" #{@available_stalls.inspect}, total_stalls: #{@total_stalls.inspect}, site_closed:"\
|
|
154
|
+
" #{@site_closed.inspect}, billing_info: #{@billing_info.inspect}, location:"\
|
|
155
|
+
" #{@location.inspect}, additional_properties: #{@additional_properties}>"
|
|
156
|
+
end
|
|
157
|
+
end
|
|
158
|
+
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
|
+
# ChargingPeriod Model.
|
|
8
|
+
class ChargingPeriod < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# TODO: Write general description for this method
|
|
13
|
+
# @return [String]
|
|
14
|
+
attr_accessor :start_date_time
|
|
15
|
+
|
|
16
|
+
# TODO: Write general description for this method
|
|
17
|
+
# @return [Array[ChargingDimension]]
|
|
18
|
+
attr_accessor :dimensions
|
|
19
|
+
|
|
20
|
+
# A mapping from model property names to API property names.
|
|
21
|
+
def self.names
|
|
22
|
+
@_hash = {} if @_hash.nil?
|
|
23
|
+
@_hash['start_date_time'] = 'start_date_time'
|
|
24
|
+
@_hash['dimensions'] = 'dimensions'
|
|
25
|
+
@_hash
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# An array for optional fields
|
|
29
|
+
def self.optionals
|
|
30
|
+
%w[
|
|
31
|
+
start_date_time
|
|
32
|
+
dimensions
|
|
33
|
+
]
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# An array for nullable fields
|
|
37
|
+
def self.nullables
|
|
38
|
+
[]
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def initialize(start_date_time: SKIP, dimensions: SKIP,
|
|
42
|
+
additional_properties: nil)
|
|
43
|
+
# Add additional model properties to the instance
|
|
44
|
+
additional_properties = {} if additional_properties.nil?
|
|
45
|
+
|
|
46
|
+
@start_date_time = start_date_time unless start_date_time == SKIP
|
|
47
|
+
@dimensions = dimensions unless dimensions == SKIP
|
|
48
|
+
@additional_properties = additional_properties
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Creates an instance of the object from a hash.
|
|
52
|
+
def self.from_hash(hash)
|
|
53
|
+
return nil unless hash
|
|
54
|
+
|
|
55
|
+
# Extract variables from the hash.
|
|
56
|
+
start_date_time =
|
|
57
|
+
hash.key?('start_date_time') ? hash['start_date_time'] : SKIP
|
|
58
|
+
# Parameter is an array, so we need to iterate through it
|
|
59
|
+
dimensions = nil
|
|
60
|
+
unless hash['dimensions'].nil?
|
|
61
|
+
dimensions = []
|
|
62
|
+
hash['dimensions'].each do |structure|
|
|
63
|
+
dimensions << (ChargingDimension.from_hash(structure) if structure)
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
dimensions = SKIP unless hash.key?('dimensions')
|
|
68
|
+
|
|
69
|
+
# Create a new hash for additional properties, removing known properties.
|
|
70
|
+
new_hash = hash.reject { |k, _| names.value?(k) }
|
|
71
|
+
|
|
72
|
+
additional_properties = APIHelper.get_additional_properties(
|
|
73
|
+
new_hash, proc { |value| value }
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
# Create object from extracted values.
|
|
77
|
+
ChargingPeriod.new(start_date_time: start_date_time,
|
|
78
|
+
dimensions: dimensions,
|
|
79
|
+
additional_properties: additional_properties)
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
# Provides a human-readable string representation of the object.
|
|
83
|
+
def to_s
|
|
84
|
+
class_name = self.class.name.split('::').last
|
|
85
|
+
"<#{class_name} start_date_time: #{@start_date_time}, dimensions: #{@dimensions},"\
|
|
86
|
+
" additional_properties: #{@additional_properties}>"
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
90
|
+
def inspect
|
|
91
|
+
class_name = self.class.name.split('::').last
|
|
92
|
+
"<#{class_name} start_date_time: #{@start_date_time.inspect}, dimensions:"\
|
|
93
|
+
" #{@dimensions.inspect}, additional_properties: #{@additional_properties}>"
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
end
|
|
@@ -0,0 +1,187 @@
|
|
|
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
|
+
# ChargingSession Model.
|
|
8
|
+
class ChargingSession < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# TODO: Write general description for this method
|
|
13
|
+
# @return [String]
|
|
14
|
+
attr_accessor :id
|
|
15
|
+
|
|
16
|
+
# TODO: Write general description for this method
|
|
17
|
+
# @return [String]
|
|
18
|
+
attr_accessor :vin
|
|
19
|
+
|
|
20
|
+
# TODO: Write general description for this method
|
|
21
|
+
# @return [String]
|
|
22
|
+
attr_accessor :model
|
|
23
|
+
|
|
24
|
+
# TODO: Write general description for this method
|
|
25
|
+
# @return [String]
|
|
26
|
+
attr_accessor :start_date_time
|
|
27
|
+
|
|
28
|
+
# TODO: Write general description for this method
|
|
29
|
+
# @return [String]
|
|
30
|
+
attr_accessor :stop_date_time
|
|
31
|
+
|
|
32
|
+
# TODO: Write general description for this method
|
|
33
|
+
# @return [Float]
|
|
34
|
+
attr_accessor :total_energy
|
|
35
|
+
|
|
36
|
+
# TODO: Write general description for this method
|
|
37
|
+
# @return [Float]
|
|
38
|
+
attr_accessor :total_time
|
|
39
|
+
|
|
40
|
+
# TODO: Write general description for this method
|
|
41
|
+
# @return [TotalCost]
|
|
42
|
+
attr_accessor :total_cost
|
|
43
|
+
|
|
44
|
+
# TODO: Write general description for this method
|
|
45
|
+
# @return [Location]
|
|
46
|
+
attr_accessor :location
|
|
47
|
+
|
|
48
|
+
# TODO: Write general description for this method
|
|
49
|
+
# @return [Array[ChargingPeriod]]
|
|
50
|
+
attr_accessor :charging_periods
|
|
51
|
+
|
|
52
|
+
# TODO: Write general description for this method
|
|
53
|
+
# @return [Tariffs]
|
|
54
|
+
attr_accessor :tariffs
|
|
55
|
+
|
|
56
|
+
# A mapping from model property names to API property names.
|
|
57
|
+
def self.names
|
|
58
|
+
@_hash = {} if @_hash.nil?
|
|
59
|
+
@_hash['id'] = 'id'
|
|
60
|
+
@_hash['vin'] = 'vin'
|
|
61
|
+
@_hash['model'] = 'model'
|
|
62
|
+
@_hash['start_date_time'] = 'start_date_time'
|
|
63
|
+
@_hash['stop_date_time'] = 'stop_date_time'
|
|
64
|
+
@_hash['total_energy'] = 'total_energy'
|
|
65
|
+
@_hash['total_time'] = 'total_time'
|
|
66
|
+
@_hash['total_cost'] = 'total_cost'
|
|
67
|
+
@_hash['location'] = 'location'
|
|
68
|
+
@_hash['charging_periods'] = 'charging_periods'
|
|
69
|
+
@_hash['tariffs'] = 'tariffs'
|
|
70
|
+
@_hash
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# An array for optional fields
|
|
74
|
+
def self.optionals
|
|
75
|
+
%w[
|
|
76
|
+
id
|
|
77
|
+
vin
|
|
78
|
+
model
|
|
79
|
+
start_date_time
|
|
80
|
+
stop_date_time
|
|
81
|
+
total_energy
|
|
82
|
+
total_time
|
|
83
|
+
total_cost
|
|
84
|
+
location
|
|
85
|
+
charging_periods
|
|
86
|
+
tariffs
|
|
87
|
+
]
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
# An array for nullable fields
|
|
91
|
+
def self.nullables
|
|
92
|
+
[]
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
def initialize(id: SKIP, vin: SKIP, model: SKIP, start_date_time: SKIP,
|
|
96
|
+
stop_date_time: SKIP, total_energy: SKIP, total_time: SKIP,
|
|
97
|
+
total_cost: SKIP, location: SKIP, charging_periods: SKIP,
|
|
98
|
+
tariffs: SKIP, additional_properties: nil)
|
|
99
|
+
# Add additional model properties to the instance
|
|
100
|
+
additional_properties = {} if additional_properties.nil?
|
|
101
|
+
|
|
102
|
+
@id = id unless id == SKIP
|
|
103
|
+
@vin = vin unless vin == SKIP
|
|
104
|
+
@model = model unless model == SKIP
|
|
105
|
+
@start_date_time = start_date_time unless start_date_time == SKIP
|
|
106
|
+
@stop_date_time = stop_date_time unless stop_date_time == SKIP
|
|
107
|
+
@total_energy = total_energy unless total_energy == SKIP
|
|
108
|
+
@total_time = total_time unless total_time == SKIP
|
|
109
|
+
@total_cost = total_cost unless total_cost == SKIP
|
|
110
|
+
@location = location unless location == SKIP
|
|
111
|
+
@charging_periods = charging_periods unless charging_periods == SKIP
|
|
112
|
+
@tariffs = tariffs unless tariffs == SKIP
|
|
113
|
+
@additional_properties = additional_properties
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
# Creates an instance of the object from a hash.
|
|
117
|
+
def self.from_hash(hash)
|
|
118
|
+
return nil unless hash
|
|
119
|
+
|
|
120
|
+
# Extract variables from the hash.
|
|
121
|
+
id = hash.key?('id') ? hash['id'] : SKIP
|
|
122
|
+
vin = hash.key?('vin') ? hash['vin'] : SKIP
|
|
123
|
+
model = hash.key?('model') ? hash['model'] : SKIP
|
|
124
|
+
start_date_time =
|
|
125
|
+
hash.key?('start_date_time') ? hash['start_date_time'] : SKIP
|
|
126
|
+
stop_date_time =
|
|
127
|
+
hash.key?('stop_date_time') ? hash['stop_date_time'] : SKIP
|
|
128
|
+
total_energy = hash.key?('total_energy') ? hash['total_energy'] : SKIP
|
|
129
|
+
total_time = hash.key?('total_time') ? hash['total_time'] : SKIP
|
|
130
|
+
total_cost = TotalCost.from_hash(hash['total_cost']) if hash['total_cost']
|
|
131
|
+
location = Location.from_hash(hash['location']) if hash['location']
|
|
132
|
+
# Parameter is an array, so we need to iterate through it
|
|
133
|
+
charging_periods = nil
|
|
134
|
+
unless hash['charging_periods'].nil?
|
|
135
|
+
charging_periods = []
|
|
136
|
+
hash['charging_periods'].each do |structure|
|
|
137
|
+
charging_periods << (ChargingPeriod.from_hash(structure) if structure)
|
|
138
|
+
end
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
charging_periods = SKIP unless hash.key?('charging_periods')
|
|
142
|
+
tariffs = Tariffs.from_hash(hash['tariffs']) if hash['tariffs']
|
|
143
|
+
|
|
144
|
+
# Create a new hash for additional properties, removing known properties.
|
|
145
|
+
new_hash = hash.reject { |k, _| names.value?(k) }
|
|
146
|
+
|
|
147
|
+
additional_properties = APIHelper.get_additional_properties(
|
|
148
|
+
new_hash, proc { |value| value }
|
|
149
|
+
)
|
|
150
|
+
|
|
151
|
+
# Create object from extracted values.
|
|
152
|
+
ChargingSession.new(id: id,
|
|
153
|
+
vin: vin,
|
|
154
|
+
model: model,
|
|
155
|
+
start_date_time: start_date_time,
|
|
156
|
+
stop_date_time: stop_date_time,
|
|
157
|
+
total_energy: total_energy,
|
|
158
|
+
total_time: total_time,
|
|
159
|
+
total_cost: total_cost,
|
|
160
|
+
location: location,
|
|
161
|
+
charging_periods: charging_periods,
|
|
162
|
+
tariffs: tariffs,
|
|
163
|
+
additional_properties: additional_properties)
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
# Provides a human-readable string representation of the object.
|
|
167
|
+
def to_s
|
|
168
|
+
class_name = self.class.name.split('::').last
|
|
169
|
+
"<#{class_name} id: #{@id}, vin: #{@vin}, model: #{@model}, start_date_time:"\
|
|
170
|
+
" #{@start_date_time}, stop_date_time: #{@stop_date_time}, total_energy: #{@total_energy},"\
|
|
171
|
+
" total_time: #{@total_time}, total_cost: #{@total_cost}, location: #{@location},"\
|
|
172
|
+
" charging_periods: #{@charging_periods}, tariffs: #{@tariffs}, additional_properties:"\
|
|
173
|
+
" #{@additional_properties}>"
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
177
|
+
def inspect
|
|
178
|
+
class_name = self.class.name.split('::').last
|
|
179
|
+
"<#{class_name} id: #{@id.inspect}, vin: #{@vin.inspect}, model: #{@model.inspect},"\
|
|
180
|
+
" start_date_time: #{@start_date_time.inspect}, stop_date_time: #{@stop_date_time.inspect},"\
|
|
181
|
+
" total_energy: #{@total_energy.inspect}, total_time: #{@total_time.inspect}, total_cost:"\
|
|
182
|
+
" #{@total_cost.inspect}, location: #{@location.inspect}, charging_periods:"\
|
|
183
|
+
" #{@charging_periods.inspect}, tariffs: #{@tariffs.inspect}, additional_properties:"\
|
|
184
|
+
" #{@additional_properties}>"
|
|
185
|
+
end
|
|
186
|
+
end
|
|
187
|
+
end
|
|
@@ -0,0 +1,116 @@
|
|
|
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
|
+
# ChargingSessionsData Model.
|
|
8
|
+
class ChargingSessionsData < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# TODO: Write general description for this method
|
|
13
|
+
# @return [Array[ChargingSession]]
|
|
14
|
+
attr_accessor :data
|
|
15
|
+
|
|
16
|
+
# TODO: Write general description for this method
|
|
17
|
+
# @return [Integer]
|
|
18
|
+
attr_accessor :status_code
|
|
19
|
+
|
|
20
|
+
# TODO: Write general description for this method
|
|
21
|
+
# @return [String]
|
|
22
|
+
attr_accessor :status_message
|
|
23
|
+
|
|
24
|
+
# TODO: Write general description for this method
|
|
25
|
+
# @return [Hash[String, String]]
|
|
26
|
+
attr_accessor :timestamp
|
|
27
|
+
|
|
28
|
+
# A mapping from model property names to API property names.
|
|
29
|
+
def self.names
|
|
30
|
+
@_hash = {} if @_hash.nil?
|
|
31
|
+
@_hash['data'] = 'data'
|
|
32
|
+
@_hash['status_code'] = 'status_code'
|
|
33
|
+
@_hash['status_message'] = 'status_message'
|
|
34
|
+
@_hash['timestamp'] = 'timestamp'
|
|
35
|
+
@_hash
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# An array for optional fields
|
|
39
|
+
def self.optionals
|
|
40
|
+
%w[
|
|
41
|
+
data
|
|
42
|
+
status_code
|
|
43
|
+
status_message
|
|
44
|
+
timestamp
|
|
45
|
+
]
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# An array for nullable fields
|
|
49
|
+
def self.nullables
|
|
50
|
+
[]
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def initialize(data: SKIP, status_code: SKIP, status_message: SKIP,
|
|
54
|
+
timestamp: SKIP, additional_properties: nil)
|
|
55
|
+
# Add additional model properties to the instance
|
|
56
|
+
additional_properties = {} if additional_properties.nil?
|
|
57
|
+
|
|
58
|
+
@data = data unless data == SKIP
|
|
59
|
+
@status_code = status_code unless status_code == SKIP
|
|
60
|
+
@status_message = status_message unless status_message == SKIP
|
|
61
|
+
@timestamp = timestamp unless timestamp == SKIP
|
|
62
|
+
@additional_properties = additional_properties
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# Creates an instance of the object from a hash.
|
|
66
|
+
def self.from_hash(hash)
|
|
67
|
+
return nil unless hash
|
|
68
|
+
|
|
69
|
+
# Extract variables from the hash.
|
|
70
|
+
# Parameter is an array, so we need to iterate through it
|
|
71
|
+
data = nil
|
|
72
|
+
unless hash['data'].nil?
|
|
73
|
+
data = []
|
|
74
|
+
hash['data'].each do |structure|
|
|
75
|
+
data << (ChargingSession.from_hash(structure) if structure)
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
data = SKIP unless hash.key?('data')
|
|
80
|
+
status_code = hash.key?('status_code') ? hash['status_code'] : SKIP
|
|
81
|
+
status_message =
|
|
82
|
+
hash.key?('status_message') ? hash['status_message'] : SKIP
|
|
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
|
+
ChargingSessionsData.new(data: data,
|
|
94
|
+
status_code: status_code,
|
|
95
|
+
status_message: status_message,
|
|
96
|
+
timestamp: timestamp,
|
|
97
|
+
additional_properties: additional_properties)
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
# Provides a human-readable string representation of the object.
|
|
101
|
+
def to_s
|
|
102
|
+
class_name = self.class.name.split('::').last
|
|
103
|
+
"<#{class_name} data: #{@data}, status_code: #{@status_code}, status_message:"\
|
|
104
|
+
" #{@status_message}, timestamp: #{@timestamp}, additional_properties:"\
|
|
105
|
+
" #{@additional_properties}>"
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
109
|
+
def inspect
|
|
110
|
+
class_name = self.class.name.split('::').last
|
|
111
|
+
"<#{class_name} data: #{@data.inspect}, status_code: #{@status_code.inspect},"\
|
|
112
|
+
" status_message: #{@status_message.inspect}, timestamp: #{@timestamp.inspect},"\
|
|
113
|
+
" additional_properties: #{@additional_properties}>"
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
end
|