Class: Samsara::Types::ServiceTaskDefinitionObjectResponseBody
- Inherits:
-
Object
- Object
- Samsara::Types::ServiceTaskDefinitionObjectResponseBody
- Defined in:
- lib/samsara_api/types/service_task_definition_object_response_body.rb
Overview
A service task definition object.
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#category ⇒ String
readonly
The category of the service task.
-
#description ⇒ String
readonly
A description of the service task.
-
#estimated_labor_time_minutes ⇒ Integer
readonly
Estimated time in minutes to complete the task.
- #estimated_parts_cost ⇒ Samsara::Types::WorkOrderMoneyObjectResponseBody readonly
-
#id ⇒ String
readonly
The unique id of the service task definition.
-
#name ⇒ String
readonly
The name of the service task.
-
#subcategory ⇒ String
readonly
The subcategory of the service task.
Class Method Summary collapse
- .from_json(json_object:) ⇒ Samsara::Types::ServiceTaskDefinitionObjectResponseBody
- .validate_raw(obj:) ⇒ Void
Instance Method Summary collapse
- #initialize(category: OMIT, description: OMIT, estimated_labor_time_minutes: OMIT, estimated_parts_cost: OMIT, id:, name:, subcategory: OMIT, additional_properties: nil) ⇒ Samsara::Types::ServiceTaskDefinitionObjectResponseBody constructor
- #to_json ⇒ String
Constructor Details
#initialize(category: OMIT, description: OMIT, estimated_labor_time_minutes: OMIT, estimated_parts_cost: OMIT, id:, name:, subcategory: OMIT, additional_properties: nil) ⇒ Samsara::Types::ServiceTaskDefinitionObjectResponseBody
41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/samsara_api/types/service_task_definition_object_response_body.rb', line 41 def initialize(category: OMIT, description: OMIT, estimated_labor_time_minutes: OMIT, estimated_parts_cost: OMIT, id:, name:, subcategory: OMIT, additional_properties: nil) @category = category if category != OMIT @description = description if description != OMIT @estimated_labor_time_minutes = estimated_labor_time_minutes if estimated_labor_time_minutes != OMIT @estimated_parts_cost = estimated_parts_cost if estimated_parts_cost != OMIT @id = id @name = name @subcategory = subcategory if subcategory != OMIT @additional_properties = additional_properties @_field_set = { "category": category, "description": description, "estimatedLaborTimeMinutes": estimated_labor_time_minutes, "estimatedPartsCost": estimated_parts_cost, "id": id, "name": name, "subcategory": subcategory }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
25 26 27 |
# File 'lib/samsara_api/types/service_task_definition_object_response_body.rb', line 25 def additional_properties @additional_properties end |
#category ⇒ String (readonly)
11 12 13 |
# File 'lib/samsara_api/types/service_task_definition_object_response_body.rb', line 11 def category @category end |
#description ⇒ String (readonly)
13 14 15 |
# File 'lib/samsara_api/types/service_task_definition_object_response_body.rb', line 13 def description @description end |
#estimated_labor_time_minutes ⇒ Integer (readonly)
15 16 17 |
# File 'lib/samsara_api/types/service_task_definition_object_response_body.rb', line 15 def estimated_labor_time_minutes @estimated_labor_time_minutes end |
#estimated_parts_cost ⇒ Samsara::Types::WorkOrderMoneyObjectResponseBody (readonly)
17 18 19 |
# File 'lib/samsara_api/types/service_task_definition_object_response_body.rb', line 17 def estimated_parts_cost @estimated_parts_cost end |
#id ⇒ String (readonly)
19 20 21 |
# File 'lib/samsara_api/types/service_task_definition_object_response_body.rb', line 19 def id @id end |
#name ⇒ String (readonly)
21 22 23 |
# File 'lib/samsara_api/types/service_task_definition_object_response_body.rb', line 21 def name @name end |
#subcategory ⇒ String (readonly)
23 24 25 |
# File 'lib/samsara_api/types/service_task_definition_object_response_body.rb', line 23 def subcategory @subcategory end |
Class Method Details
.from_json(json_object:) ⇒ Samsara::Types::ServiceTaskDefinitionObjectResponseBody
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/samsara_api/types/service_task_definition_object_response_body.rb', line 59 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) category = parsed_json["category"] description = parsed_json["description"] estimated_labor_time_minutes = parsed_json["estimatedLaborTimeMinutes"] unless parsed_json["estimatedPartsCost"].nil? estimated_parts_cost = parsed_json["estimatedPartsCost"].to_json estimated_parts_cost = Samsara::Types::WorkOrderMoneyObjectResponseBody.from_json(json_object: estimated_parts_cost) else estimated_parts_cost = nil end id = parsed_json["id"] name = parsed_json["name"] subcategory = parsed_json["subcategory"] new( category: category, description: description, estimated_labor_time_minutes: estimated_labor_time_minutes, estimated_parts_cost: estimated_parts_cost, id: id, name: name, subcategory: subcategory, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
98 99 100 101 102 103 104 105 106 |
# File 'lib/samsara_api/types/service_task_definition_object_response_body.rb', line 98 def self.validate_raw(obj:) obj.category&.is_a?(String) != false || raise("Passed value for field obj.category is not the expected type, validation failed.") obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.") obj.estimated_labor_time_minutes&.is_a?(Integer) != false || raise("Passed value for field obj.estimated_labor_time_minutes is not the expected type, validation failed.") obj.estimated_parts_cost.nil? || Samsara::Types::WorkOrderMoneyObjectResponseBody.validate_raw(obj: obj.estimated_parts_cost) obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.") obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") obj.subcategory&.is_a?(String) != false || raise("Passed value for field obj.subcategory is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
89 90 91 |
# File 'lib/samsara_api/types/service_task_definition_object_response_body.rb', line 89 def to_json @_field_set&.to_json end |