class Ittybit::Task
def self.from_json(json_object:)
-
(Ittybit::Task)
-
Parameters:
-
json_object
(String
) --
def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) id = parsed_json["id"] object = parsed_json["object"] kind = parsed_json["kind"] input = parsed_json["input"] options = parsed_json["options"] output = parsed_json["output"] status = parsed_json["status"] progress = parsed_json["progress"] error = parsed_json["error"] created_by = parsed_json["created_by"] created = (DateTime.parse(parsed_json["created"]) unless parsed_json["created"].nil?) updated = (DateTime.parse(parsed_json["updated"]) unless parsed_json["updated"].nil?) parent_id = parsed_json["parent_id"] workflow = parsed_json["workflow"] if parsed_json["results"].nil? results = nil else results = parsed_json["results"].to_json results = Ittybit::TaskResults.from_json(json_object: results) end new( id: id, object: object, kind: kind, input: input, options: options, output: output, status: status, progress: progress, error: error, created_by: created_by, created: created, updated: updated, parent_id: parent_id, workflow: workflow, results: results, additional_properties: struct ) end
def self.validate_raw(obj:)
-
(Void)
-
Parameters:
-
obj
(Object
) --
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.object.is_a?(String) != false || raise("Passed value for field obj.object is not the expected type, validation failed.") obj.kind.is_a?(Object) != false || raise("Passed value for field obj.kind is not the expected type, validation failed.") obj.input&.is_a?(Hash) != false || raise("Passed value for field obj.input is not the expected type, validation failed.") obj.options&.is_a?(Hash) != false || raise("Passed value for field obj.options is not the expected type, validation failed.") obj.output&.is_a?(Hash) != false || raise("Passed value for field obj.output is not the expected type, validation failed.") obj.status.is_a?(Ittybit::TaskStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.") obj.progress&.is_a?(Integer) != false || raise("Passed value for field obj.progress is not the expected type, validation failed.") obj.error&.is_a?(String) != false || raise("Passed value for field obj.error is not the expected type, validation failed.") obj.created_by&.is_a?(String) != false || raise("Passed value for field obj.created_by is not the expected type, validation failed.") obj.created.is_a?(DateTime) != false || raise("Passed value for field obj.created is not the expected type, validation failed.") obj.updated.is_a?(DateTime) != false || raise("Passed value for field obj.updated is not the expected type, validation failed.") obj.parent_id&.is_a?(String) != false || raise("Passed value for field obj.parent_id is not the expected type, validation failed.") obj.workflow&.is_a?(Array) != false || raise("Passed value for field obj.workflow is not the expected type, validation failed.") obj.results.nil? || Ittybit::TaskResults.validate_raw(obj: obj.results) end
def initialize(id:, object:, kind:, status:, created:, updated:, input: OMIT, options: OMIT, output: OMIT, progress: OMIT, error: OMIT,
-
(Ittybit::Task)
-
Parameters:
-
additional_properties
(OpenStruct
) -- Additional properties unmapped to the current class definition -
results
(Ittybit::TaskResults
) -- -
workflow
(Array
) -- -
parent_id
(String
) -- -
updated
(DateTime
) -- -
created
(DateTime
) -- -
created_by
(String
) -- -
error
(String
) -- -
progress
(Integer
) -- -
status
(Ittybit::TaskStatus
) -- -
output
(Hash{String => Object}
) -- -
options
(Hash{String => Object}
) -- -
input
(Hash{String => Object}
) -- -
kind
(Ittybit::TASK_KIND
) -- -
object
(String
) -- -
id
(String
) --
def initialize(id:, object:, kind:, status:, created:, updated:, input: OMIT, options: OMIT, output: OMIT, progress: OMIT, error: OMIT, created_by: OMIT, parent_id: OMIT, workflow: OMIT, results: OMIT, additional_properties: nil) @id = id @object = object @kind = kind @input = input if input != OMIT @options = options if options != OMIT @output = output if output != OMIT @status = status @progress = progress if progress != OMIT @error = error if error != OMIT @created_by = created_by if created_by != OMIT @created = created @updated = updated @parent_id = parent_id if parent_id != OMIT @workflow = workflow if workflow != OMIT @results = results if results != OMIT @additional_properties = additional_properties @_field_set = { "id": id, "object": object, "kind": kind, "input": input, "options": options, "output": output, "status": status, "progress": progress, "error": error, "created_by": created_by, "created": created, "updated": updated, "parent_id": parent_id, "workflow": workflow, "results": results }.reject do |_k, v| v == OMIT end end
def to_json(*_args)
-
(String)
-
def to_json(*_args) @_field_set&.to_json end