Class: Samsara::Types::IftaVehicleReportDataObjectResponseBody

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

Overview

Dictionary containing summarized vehicle report data.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(month: OMIT, quarter: OMIT, troubleshooting: OMIT, vehicle_reports:, year:, additional_properties: nil) ⇒ Samsara::Types::IftaVehicleReportDataObjectResponseBody

Parameters:

  • month (String) (defaults to: OMIT)

    The specified month duration for this IFTA report.

  • quarter (String) (defaults to: OMIT)

    The specified quarter duration for this IFTA report.

  • troubleshooting (Samsara::Types::IftaReportTroubleshootingObjectResponseBody) (defaults to: OMIT)
  • vehicle_reports (Array<Samsara::Types::IftaVehicleReportObjectResponseBody>)

    List of summarized vehicle reports.

  • year (Long)

    The specified year for this IFTA report.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



36
37
38
39
40
41
42
43
44
45
46
# File 'lib/samsara_api/types/ifta_vehicle_report_data_object_response_body.rb', line 36

def initialize(month: OMIT, quarter: OMIT, troubleshooting: OMIT, vehicle_reports:, year:, additional_properties: nil)
  @month = month if month != OMIT
  @quarter = quarter if quarter != OMIT
  @troubleshooting = troubleshooting if troubleshooting != OMIT
  @vehicle_reports = vehicle_reports
  @year = year
  @additional_properties = additional_properties
  @_field_set = { "month": month, "quarter": quarter, "troubleshooting": troubleshooting, "vehicleReports": vehicle_reports, "year": year }.reject do | _k, v |
  v == OMIT
end
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



22
23
24
# File 'lib/samsara_api/types/ifta_vehicle_report_data_object_response_body.rb', line 22

def additional_properties
  @additional_properties
end

#monthString (readonly)

Returns The specified month duration for this IFTA report.

Returns:

  • (String)

    The specified month duration for this IFTA report.



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

def month
  @month
end

#quarterString (readonly)

Returns The specified quarter duration for this IFTA report.

Returns:

  • (String)

    The specified quarter duration for this IFTA report.



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

def quarter
  @quarter
end

#troubleshootingSamsara::Types::IftaReportTroubleshootingObjectResponseBody (readonly)



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

def troubleshooting
  @troubleshooting
end

#vehicle_reportsArray<Samsara::Types::IftaVehicleReportObjectResponseBody> (readonly)

Returns List of summarized vehicle reports.

Returns:



18
19
20
# File 'lib/samsara_api/types/ifta_vehicle_report_data_object_response_body.rb', line 18

def vehicle_reports
  @vehicle_reports
end

#yearLong (readonly)

Returns The specified year for this IFTA report.

Returns:

  • (Long)

    The specified year for this IFTA report.



20
21
22
# File 'lib/samsara_api/types/ifta_vehicle_report_data_object_response_body.rb', line 20

def year
  @year
end

Class Method Details

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

Parameters:

  • json_object (String)

Returns:



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/samsara_api/types/ifta_vehicle_report_data_object_response_body.rb', line 52

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  month = parsed_json["month"]
  quarter = parsed_json["quarter"]
  unless parsed_json["troubleshooting"].nil?
    troubleshooting = parsed_json["troubleshooting"].to_json
    troubleshooting = Samsara::Types::IftaReportTroubleshootingObjectResponseBody.from_json(json_object: troubleshooting)
  else
    troubleshooting = nil
  end
  vehicle_reports = parsed_json["vehicleReports"]&.map do | item |
  item = item.to_json
  Samsara::Types::IftaVehicleReportObjectResponseBody.from_json(json_object: item)
end
  year = parsed_json["year"]
  new(
    month: month,
    quarter: quarter,
    troubleshooting: troubleshooting,
    vehicle_reports: vehicle_reports,
    year: year,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


90
91
92
93
94
95
96
# File 'lib/samsara_api/types/ifta_vehicle_report_data_object_response_body.rb', line 90

def self.validate_raw(obj:)
  obj.month&.is_a?(String) != false || raise("Passed value for field obj.month is not the expected type, validation failed.")
  obj.quarter&.is_a?(String) != false || raise("Passed value for field obj.quarter is not the expected type, validation failed.")
  obj.troubleshooting.nil? || Samsara::Types::IftaReportTroubleshootingObjectResponseBody.validate_raw(obj: obj.troubleshooting)
  obj.vehicle_reports.is_a?(Array) != false || raise("Passed value for field obj.vehicle_reports is not the expected type, validation failed.")
  obj.year.is_a?(Long) != false || raise("Passed value for field obj.year is not the expected type, validation failed.")
end

Instance Method Details

#to_jsonString

Returns:

  • (String)


81
82
83
# File 'lib/samsara_api/types/ifta_vehicle_report_data_object_response_body.rb', line 81

def to_json
  @_field_set&.to_json
end