Class: Samsara::Types::WorkOrderItemObjectRequestBody
- Inherits:
-
Object
- Object
- Samsara::Types::WorkOrderItemObjectRequestBody
- Defined in:
- lib/samsara_api/types/work_order_item_object_request_body.rb
Overview
Work Order Related Item object.
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#id ⇒ String
readonly
ID of the item.
-
#type ⇒ Object
readonly
‘ITEM_TYPE_UNSPECIFIED`, `MAINTENANCE_PREDICTION_EVENT`, `SCHEDULED_MAINTENANCE`.
Class Method Summary collapse
- .from_json(json_object:) ⇒ Samsara::Types::WorkOrderItemObjectRequestBody
- .validate_raw(obj:) ⇒ Void
Instance Method Summary collapse
- #initialize(id:, type:, additional_properties: nil) ⇒ Samsara::Types::WorkOrderItemObjectRequestBody constructor
- #to_json ⇒ String
Constructor Details
#initialize(id:, type:, additional_properties: nil) ⇒ Samsara::Types::WorkOrderItemObjectRequestBody
28 29 30 31 32 33 |
# File 'lib/samsara_api/types/work_order_item_object_request_body.rb', line 28 def initialize(id:, type:, additional_properties: nil) @id = id @type = type @additional_properties = additional_properties @_field_set = { "id": id, "type": type } 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/work_order_item_object_request_body.rb', line 16 def additional_properties @additional_properties end |
#id ⇒ String (readonly)
Returns ID of the item.
11 12 13 |
# File 'lib/samsara_api/types/work_order_item_object_request_body.rb', line 11 def id @id end |
#type ⇒ Object (readonly)
‘ITEM_TYPE_UNSPECIFIED`, `MAINTENANCE_PREDICTION_EVENT`, `SCHEDULED_MAINTENANCE`
14 15 16 |
# File 'lib/samsara_api/types/work_order_item_object_request_body.rb', line 14 def type @type end |
Class Method Details
.from_json(json_object:) ⇒ Samsara::Types::WorkOrderItemObjectRequestBody
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/samsara_api/types/work_order_item_object_request_body.rb', line 38 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) id = parsed_json["id"] type = parsed_json["type"] new( id: id, type: type, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
61 62 63 64 |
# File 'lib/samsara_api/types/work_order_item_object_request_body.rb', line 61 def self.validate_raw(obj:) obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.") obj.type.is_a?(Samsara::Types::WorkOrderItemObjectRequestBodyType) != false || raise("Passed value for field obj.type is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
52 53 54 |
# File 'lib/samsara_api/types/work_order_item_object_request_body.rb', line 52 def to_json @_field_set&.to_json end |