Class: Samsara::Types::IftaVehicleReportDataObjectResponseBody
- Inherits:
-
Object
- Object
- Samsara::Types::IftaVehicleReportDataObjectResponseBody
- 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
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#month ⇒ String
readonly
The specified month duration for this IFTA report.
-
#quarter ⇒ String
readonly
The specified quarter duration for this IFTA report.
- #troubleshooting ⇒ Samsara::Types::IftaReportTroubleshootingObjectResponseBody readonly
-
#vehicle_reports ⇒ Array<Samsara::Types::IftaVehicleReportObjectResponseBody>
readonly
List of summarized vehicle reports.
-
#year ⇒ Long
readonly
The specified year for this IFTA report.
Class Method Summary collapse
- .from_json(json_object:) ⇒ Samsara::Types::IftaVehicleReportDataObjectResponseBody
- .validate_raw(obj:) ⇒ Void
Instance Method Summary collapse
- #initialize(month: OMIT, quarter: OMIT, troubleshooting: OMIT, vehicle_reports:, year:, additional_properties: nil) ⇒ Samsara::Types::IftaVehicleReportDataObjectResponseBody constructor
- #to_json ⇒ String
Constructor Details
#initialize(month: OMIT, quarter: OMIT, troubleshooting: OMIT, vehicle_reports:, year:, additional_properties: nil) ⇒ Samsara::Types::IftaVehicleReportDataObjectResponseBody
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_properties ⇒ OpenStruct (readonly)
Returns 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 |
#month ⇒ String (readonly)
Returns 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 |
#quarter ⇒ String (readonly)
Returns 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 |
#troubleshooting ⇒ Samsara::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_reports ⇒ Array<Samsara::Types::IftaVehicleReportObjectResponseBody> (readonly)
Returns List of summarized vehicle reports.
18 19 20 |
# File 'lib/samsara_api/types/ifta_vehicle_report_data_object_response_body.rb', line 18 def vehicle_reports @vehicle_reports end |
#year ⇒ Long (readonly)
Returns 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
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
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_json ⇒ 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 |