Class: Samsara::Types::HosLogsResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/samsara_api/types/hos_logs_response.rb

Overview

HOS logs and pagination info.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data:, pagination:, additional_properties: nil) ⇒ Samsara::Types::HosLogsResponse

Parameters:



27
28
29
30
31
32
# File 'lib/samsara_api/types/hos_logs_response.rb', line 27

def initialize(data:, pagination:, additional_properties: nil)
  @data = data
  @pagination = pagination
  @additional_properties = additional_properties
  @_field_set = { "data": data, "pagination": pagination }
end

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



16
17
18
# File 'lib/samsara_api/types/hos_logs_response.rb', line 16

def additional_properties
  @additional_properties
end

#dataSamsara::Types::HOS_LOGS_FOR_DRIVERS (readonly)



12
13
14
# File 'lib/samsara_api/types/hos_logs_response.rb', line 12

def data
  @data
end

#paginationSamsara::Types::PaginationResponse (readonly)



14
15
16
# File 'lib/samsara_api/types/hos_logs_response.rb', line 14

def pagination
  @pagination
end

Class Method Details

.from_json(json_object:) ⇒ Samsara::Types::HosLogsResponse

Parameters:

  • json_object (String)

Returns:



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/samsara_api/types/hos_logs_response.rb', line 37

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  data = parsed_json["data"]&.map do | item |
  item = item.to_json
  Samsara::Types::HosLogsForDriver.from_json(json_object: item)
end
  unless parsed_json["pagination"].nil?
    pagination = parsed_json["pagination"].to_json
    pagination = Samsara::Types::PaginationResponse.from_json(json_object: pagination)
  else
    pagination = nil
  end
  new(
    data: data,
    pagination: pagination,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


68
69
70
71
# File 'lib/samsara_api/types/hos_logs_response.rb', line 68

def self.validate_raw(obj:)
  obj.data.is_a?(Array) != false || raise("Passed value for field obj.data is not the expected type, validation failed.")
  Samsara::Types::PaginationResponse.validate_raw(obj: obj.pagination)
end

Instance Method Details

#to_jsonString

Returns:

  • (String)


59
60
61
# File 'lib/samsara_api/types/hos_logs_response.rb', line 59

def to_json
  @_field_set&.to_json
end