Class: Samsara::Types::TachographActivity
- Inherits:
-
Object
- Object
- Samsara::Types::TachographActivity
- Defined in:
- lib/samsara_api/types/tachograph_activity.rb
Overview
Tachograph activity
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#end_time ⇒ String
readonly
End time of state in RFC 3339 format.
-
#is_manual_entry ⇒ Object
readonly
this is ‘true`, the state cannot be “UNKNOWN”.
-
#start_time ⇒ String
readonly
Start time of state in RFC 3339 format.
-
#state ⇒ Object
readonly
‘DRIVING`, `UNKNOWN`.
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(end_time: OMIT, is_manual_entry: OMIT, start_time: OMIT, state: OMIT, additional_properties: nil) ⇒ Samsara::Types::TachographActivity constructor
- #to_json ⇒ String
Constructor Details
#initialize(end_time: OMIT, is_manual_entry: OMIT, start_time: OMIT, state: OMIT, additional_properties: nil) ⇒ Samsara::Types::TachographActivity
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/samsara_api/types/tachograph_activity.rb', line 36 def initialize(end_time: OMIT, is_manual_entry: OMIT, start_time: OMIT, state: OMIT, additional_properties: nil) @end_time = end_time if end_time != OMIT @is_manual_entry = is_manual_entry if is_manual_entry != OMIT @start_time = start_time if start_time != OMIT @state = state if state != OMIT @additional_properties = additional_properties @_field_set = { "endTime": end_time, "isManualEntry": is_manual_entry, "startTime": start_time, "state": state }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
21 22 23 |
# File 'lib/samsara_api/types/tachograph_activity.rb', line 21 def additional_properties @additional_properties end |
#end_time ⇒ String (readonly)
Returns End time of state in RFC 3339 format.
11 12 13 |
# File 'lib/samsara_api/types/tachograph_activity.rb', line 11 def end_time @end_time end |
#is_manual_entry ⇒ Object (readonly)
this is ‘true`, the state cannot be “UNKNOWN”
14 15 16 |
# File 'lib/samsara_api/types/tachograph_activity.rb', line 14 def is_manual_entry @is_manual_entry end |
#start_time ⇒ String (readonly)
Returns Start time of state in RFC 3339 format.
16 17 18 |
# File 'lib/samsara_api/types/tachograph_activity.rb', line 16 def start_time @start_time end |
#state ⇒ Object (readonly)
‘DRIVING`, `UNKNOWN`.
19 20 21 |
# File 'lib/samsara_api/types/tachograph_activity.rb', line 19 def state @state end |
Class Method Details
.from_json(json_object:) ⇒ Samsara::Types::TachographActivity
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/samsara_api/types/tachograph_activity.rb', line 50 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) end_time = parsed_json["endTime"] is_manual_entry = parsed_json["isManualEntry"] start_time = parsed_json["startTime"] state = parsed_json["state"] new( end_time: end_time, is_manual_entry: is_manual_entry, start_time: start_time, state: state, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
77 78 79 80 81 82 |
# File 'lib/samsara_api/types/tachograph_activity.rb', line 77 def self.validate_raw(obj:) obj.end_time&.is_a?(String) != false || raise("Passed value for field obj.end_time is not the expected type, validation failed.") obj.is_manual_entry&.is_a?(Boolean) != false || raise("Passed value for field obj.is_manual_entry 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.") obj.state&.is_a?(Samsara::Types::TachographActivityState) != false || raise("Passed value for field obj.state is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
68 69 70 |
# File 'lib/samsara_api/types/tachograph_activity.rb', line 68 def to_json @_field_set&.to_json end |