Class: Ittybit::TaskResponse
- Inherits:
-
Object
- Object
- Ittybit::TaskResponse
- Defined in:
- lib/ittybit/types/task_response.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #created ⇒ DateTime readonly
- #created_by ⇒ String readonly
- #error ⇒ String readonly
- #id ⇒ String readonly
- #input ⇒ Hash{String => Object} readonly
- #kind ⇒ Ittybit::TaskResponseKind readonly
- #object ⇒ String readonly
- #options ⇒ Hash{String => Object} readonly
- #output ⇒ Hash{String => Object} readonly
- #parent_id ⇒ String readonly
- #progress ⇒ Integer readonly
- #results ⇒ Ittybit::TaskResponseResults readonly
- #status ⇒ Ittybit::TaskResponseStatus readonly
- #updated ⇒ DateTime readonly
- #workflow ⇒ Array<Object> readonly
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Ittybit::TaskResponse
Deserialize a JSON object to an instance of TaskResponse.
-
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object’s property definitions.
Instance Method Summary collapse
- #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) ⇒ Ittybit::TaskResponse constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of TaskResponse to a JSON object.
Constructor Details
#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) ⇒ Ittybit::TaskResponse
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/ittybit/types/task_response.rb', line 67 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 = if != 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": , "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 |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
43 44 45 |
# File 'lib/ittybit/types/task_response.rb', line 43 def additional_properties @additional_properties end |
#created ⇒ DateTime (readonly)
33 34 35 |
# File 'lib/ittybit/types/task_response.rb', line 33 def created @created end |
#created_by ⇒ String (readonly)
31 32 33 |
# File 'lib/ittybit/types/task_response.rb', line 31 def created_by @created_by end |
#error ⇒ String (readonly)
29 30 31 |
# File 'lib/ittybit/types/task_response.rb', line 29 def error @error end |
#id ⇒ String (readonly)
13 14 15 |
# File 'lib/ittybit/types/task_response.rb', line 13 def id @id end |
#input ⇒ Hash{String => Object} (readonly)
19 20 21 |
# File 'lib/ittybit/types/task_response.rb', line 19 def input @input end |
#kind ⇒ Ittybit::TaskResponseKind (readonly)
17 18 19 |
# File 'lib/ittybit/types/task_response.rb', line 17 def kind @kind end |
#object ⇒ String (readonly)
15 16 17 |
# File 'lib/ittybit/types/task_response.rb', line 15 def object @object end |
#options ⇒ Hash{String => Object} (readonly)
21 22 23 |
# File 'lib/ittybit/types/task_response.rb', line 21 def @options end |
#output ⇒ Hash{String => Object} (readonly)
23 24 25 |
# File 'lib/ittybit/types/task_response.rb', line 23 def output @output end |
#parent_id ⇒ String (readonly)
37 38 39 |
# File 'lib/ittybit/types/task_response.rb', line 37 def parent_id @parent_id end |
#progress ⇒ Integer (readonly)
27 28 29 |
# File 'lib/ittybit/types/task_response.rb', line 27 def progress @progress end |
#results ⇒ Ittybit::TaskResponseResults (readonly)
41 42 43 |
# File 'lib/ittybit/types/task_response.rb', line 41 def results @results end |
#status ⇒ Ittybit::TaskResponseStatus (readonly)
25 26 27 |
# File 'lib/ittybit/types/task_response.rb', line 25 def status @status end |
#updated ⇒ DateTime (readonly)
35 36 37 |
# File 'lib/ittybit/types/task_response.rb', line 35 def updated @updated end |
#workflow ⇒ Array<Object> (readonly)
39 40 41 |
# File 'lib/ittybit/types/task_response.rb', line 39 def workflow @workflow end |
Class Method Details
.from_json(json_object:) ⇒ Ittybit::TaskResponse
Deserialize a JSON object to an instance of TaskResponse
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
# File 'lib/ittybit/types/task_response.rb', line 110 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"] = 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::TaskResponseResults.from_json(json_object: results) end new( id: id, object: object, kind: kind, input: input, 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 |
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given
hash and check each fields type against the current object's property
definitions.
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 |
# File 'lib/ittybit/types/task_response.rb', line 166 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?(Ittybit::TaskResponseKind) != 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.&.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::TaskResponseStatus) != 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::TaskResponseResults.validate_raw(obj: obj.results) end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of TaskResponse to a JSON object
156 157 158 |
# File 'lib/ittybit/types/task_response.rb', line 156 def to_json(*_args) @_field_set&.to_json end |