Class: Samsara::Types::HosLogsForDriver
- Inherits:
-
Object
- Object
- Samsara::Types::HosLogsForDriver
- Defined in:
- lib/samsara_api/types/hos_logs_for_driver.rb
Overview
List of HOS logs for a driver.
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #driver ⇒ Samsara::Types::DriverTinyResponse readonly
- #hos_logs ⇒ Samsara::Types::HOS_LOGS_LIST readonly
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(driver: OMIT, hos_logs: OMIT, additional_properties: nil) ⇒ Samsara::Types::HosLogsForDriver constructor
- #to_json ⇒ String
Constructor Details
#initialize(driver: OMIT, hos_logs: OMIT, additional_properties: nil) ⇒ Samsara::Types::HosLogsForDriver
27 28 29 30 31 32 33 34 |
# File 'lib/samsara_api/types/hos_logs_for_driver.rb', line 27 def initialize(driver: OMIT, hos_logs: OMIT, additional_properties: nil) @driver = driver if driver != OMIT @hos_logs = hos_logs if hos_logs != OMIT @additional_properties = additional_properties @_field_set = { "driver": driver, "hosLogs": hos_logs }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
16 17 18 |
# File 'lib/samsara_api/types/hos_logs_for_driver.rb', line 16 def additional_properties @additional_properties end |
#driver ⇒ Samsara::Types::DriverTinyResponse (readonly)
12 13 14 |
# File 'lib/samsara_api/types/hos_logs_for_driver.rb', line 12 def driver @driver end |
#hos_logs ⇒ Samsara::Types::HOS_LOGS_LIST (readonly)
14 15 16 |
# File 'lib/samsara_api/types/hos_logs_for_driver.rb', line 14 def hos_logs @hos_logs end |
Class Method Details
.from_json(json_object:) ⇒ Samsara::Types::HosLogsForDriver
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/samsara_api/types/hos_logs_for_driver.rb', line 39 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) unless parsed_json["driver"].nil? driver = parsed_json["driver"].to_json driver = Samsara::Types::DriverTinyResponse.from_json(json_object: driver) else driver = nil end hos_logs = parsed_json["hosLogs"]&.map do | item | item = item.to_json Samsara::Types::HosLogEntry.from_json(json_object: item) end new( driver: driver, hos_logs: hos_logs, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
70 71 72 73 |
# File 'lib/samsara_api/types/hos_logs_for_driver.rb', line 70 def self.validate_raw(obj:) obj.driver.nil? || Samsara::Types::DriverTinyResponse.validate_raw(obj: obj.driver) obj.hos_logs&.is_a?(Array) != false || raise("Passed value for field obj.hos_logs is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
61 62 63 |
# File 'lib/samsara_api/types/hos_logs_for_driver.rb', line 61 def to_json @_field_set&.to_json end |