Class: Samsara::Types::IdlingReportEventResponseBody
- Inherits:
-
Object
- Object
- Samsara::Types::IdlingReportEventResponseBody
- Defined in:
- lib/samsara_api/types/idling_report_event_response_body.rb
Overview
A summary of the idling event.
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #address ⇒ Samsara::Types::IdlingReportEventAddressResponseBody readonly
-
#duration_ms ⇒ Long
readonly
The duration of this idling event in milliseconds.
-
#end_time ⇒ String
readonly
The end time of this idling event in RFC 3339 format.
-
#fuel_consumption_ml ⇒ Float
readonly
The amount of fuel consumed in milliliters during this idling event.
-
#is_pto_active ⇒ Boolean
readonly
Whether or not power take-off was active during this idling event.
-
#start_time ⇒ String
readonly
The start time of this idling event in RFC 3339 format.
- #vehicle ⇒ Samsara::Types::GoaVehicleTinyResponseResponseBody readonly
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(address:, duration_ms:, end_time:, fuel_consumption_ml:, is_pto_active:, start_time:, vehicle:, additional_properties: nil) ⇒ Samsara::Types::IdlingReportEventResponseBody constructor
- #to_json ⇒ String
Constructor Details
#initialize(address:, duration_ms:, end_time:, fuel_consumption_ml:, is_pto_active:, start_time:, vehicle:, additional_properties: nil) ⇒ Samsara::Types::IdlingReportEventResponseBody
42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/samsara_api/types/idling_report_event_response_body.rb', line 42 def initialize(address:, duration_ms:, end_time:, fuel_consumption_ml:, is_pto_active:, start_time:, vehicle:, additional_properties: nil) @address = address @duration_ms = duration_ms @end_time = end_time @fuel_consumption_ml = fuel_consumption_ml @is_pto_active = is_pto_active @start_time = start_time @vehicle = vehicle @additional_properties = additional_properties @_field_set = { "address": address, "durationMs": duration_ms, "endTime": end_time, "fuelConsumptionMl": fuel_consumption_ml, "isPtoActive": is_pto_active, "startTime": start_time, "vehicle": vehicle } end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
26 27 28 |
# File 'lib/samsara_api/types/idling_report_event_response_body.rb', line 26 def additional_properties @additional_properties end |
#address ⇒ Samsara::Types::IdlingReportEventAddressResponseBody (readonly)
12 13 14 |
# File 'lib/samsara_api/types/idling_report_event_response_body.rb', line 12 def address @address end |
#duration_ms ⇒ Long (readonly)
Returns The duration of this idling event in milliseconds.
14 15 16 |
# File 'lib/samsara_api/types/idling_report_event_response_body.rb', line 14 def duration_ms @duration_ms end |
#end_time ⇒ String (readonly)
Returns The end time of this idling event in RFC 3339 format.
16 17 18 |
# File 'lib/samsara_api/types/idling_report_event_response_body.rb', line 16 def end_time @end_time end |
#fuel_consumption_ml ⇒ Float (readonly)
Returns The amount of fuel consumed in milliliters during this idling event.
18 19 20 |
# File 'lib/samsara_api/types/idling_report_event_response_body.rb', line 18 def fuel_consumption_ml @fuel_consumption_ml end |
#is_pto_active ⇒ Boolean (readonly)
Returns Whether or not power take-off was active during this idling event.
20 21 22 |
# File 'lib/samsara_api/types/idling_report_event_response_body.rb', line 20 def is_pto_active @is_pto_active end |
#start_time ⇒ String (readonly)
Returns The start time of this idling event in RFC 3339 format.
22 23 24 |
# File 'lib/samsara_api/types/idling_report_event_response_body.rb', line 22 def start_time @start_time end |
#vehicle ⇒ Samsara::Types::GoaVehicleTinyResponseResponseBody (readonly)
24 25 26 |
# File 'lib/samsara_api/types/idling_report_event_response_body.rb', line 24 def vehicle @vehicle end |
Class Method Details
.from_json(json_object:) ⇒ Samsara::Types::IdlingReportEventResponseBody
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/samsara_api/types/idling_report_event_response_body.rb', line 57 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) unless parsed_json["address"].nil? address = parsed_json["address"].to_json address = Samsara::Types::IdlingReportEventAddressResponseBody.from_json(json_object: address) else address = nil end duration_ms = parsed_json["durationMs"] end_time = parsed_json["endTime"] fuel_consumption_ml = parsed_json["fuelConsumptionMl"] is_pto_active = parsed_json["isPtoActive"] start_time = parsed_json["startTime"] unless parsed_json["vehicle"].nil? vehicle = parsed_json["vehicle"].to_json vehicle = Samsara::Types::GoaVehicleTinyResponseResponseBody.from_json(json_object: vehicle) else vehicle = nil end new( address: address, duration_ms: duration_ms, end_time: end_time, fuel_consumption_ml: fuel_consumption_ml, is_pto_active: is_pto_active, start_time: start_time, vehicle: vehicle, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
100 101 102 103 104 105 106 107 108 |
# File 'lib/samsara_api/types/idling_report_event_response_body.rb', line 100 def self.validate_raw(obj:) Samsara::Types::IdlingReportEventAddressResponseBody.validate_raw(obj: obj.address) obj.duration_ms.is_a?(Long) != false || raise("Passed value for field obj.duration_ms is not the expected type, validation failed.") obj.end_time.is_a?(String) != false || raise("Passed value for field obj.end_time is not the expected type, validation failed.") obj.fuel_consumption_ml.is_a?(Float) != false || raise("Passed value for field obj.fuel_consumption_ml is not the expected type, validation failed.") obj.is_pto_active.is_a?(Boolean) != false || raise("Passed value for field obj.is_pto_active is not the expected type, validation failed.") obj.start_time.is_a?(String) != false || raise("Passed value for field obj.start_time is not the expected type, validation failed.") Samsara::Types::GoaVehicleTinyResponseResponseBody.validate_raw(obj: obj.vehicle) end |
Instance Method Details
#to_json ⇒ String
91 92 93 |
# File 'lib/samsara_api/types/idling_report_event_response_body.rb', line 91 def to_json @_field_set&.to_json end |