Class: Ittybit::Tasks::TasksGetResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/ittybit/tasks/types/tasks_get_response.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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::Tasks::TasksGetResponse



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
105
# File 'lib/ittybit/tasks/types/tasks_get_response.rb', line 68

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

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)



44
45
46
# File 'lib/ittybit/tasks/types/tasks_get_response.rb', line 44

def additional_properties
  @additional_properties
end

#createdDateTime (readonly)



34
35
36
# File 'lib/ittybit/tasks/types/tasks_get_response.rb', line 34

def created
  @created
end

#created_byString (readonly)



32
33
34
# File 'lib/ittybit/tasks/types/tasks_get_response.rb', line 32

def created_by
  @created_by
end

#errorString (readonly)



30
31
32
# File 'lib/ittybit/tasks/types/tasks_get_response.rb', line 30

def error
  @error
end

#idString (readonly)



14
15
16
# File 'lib/ittybit/tasks/types/tasks_get_response.rb', line 14

def id
  @id
end

#inputHash{String => Object} (readonly)



20
21
22
# File 'lib/ittybit/tasks/types/tasks_get_response.rb', line 20

def input
  @input
end

#kindIttybit::Tasks::TasksGetResponseKind (readonly)



18
19
20
# File 'lib/ittybit/tasks/types/tasks_get_response.rb', line 18

def kind
  @kind
end

#objectString (readonly)



16
17
18
# File 'lib/ittybit/tasks/types/tasks_get_response.rb', line 16

def object
  @object
end

#optionsHash{String => Object} (readonly)



22
23
24
# File 'lib/ittybit/tasks/types/tasks_get_response.rb', line 22

def options
  @options
end

#outputHash{String => Object} (readonly)



24
25
26
# File 'lib/ittybit/tasks/types/tasks_get_response.rb', line 24

def output
  @output
end

#parent_idString (readonly)



38
39
40
# File 'lib/ittybit/tasks/types/tasks_get_response.rb', line 38

def parent_id
  @parent_id
end

#progressInteger (readonly)



28
29
30
# File 'lib/ittybit/tasks/types/tasks_get_response.rb', line 28

def progress
  @progress
end

#resultsIttybit::Tasks::TasksGetResponseResults (readonly)



42
43
44
# File 'lib/ittybit/tasks/types/tasks_get_response.rb', line 42

def results
  @results
end

#statusIttybit::Tasks::TasksGetResponseStatus (readonly)



26
27
28
# File 'lib/ittybit/tasks/types/tasks_get_response.rb', line 26

def status
  @status
end

#updatedDateTime (readonly)



36
37
38
# File 'lib/ittybit/tasks/types/tasks_get_response.rb', line 36

def updated
  @updated
end

#workflowArray<Object> (readonly)



40
41
42
# File 'lib/ittybit/tasks/types/tasks_get_response.rb', line 40

def workflow
  @workflow
end

Class Method Details

.from_json(json_object:) ⇒ Ittybit::Tasks::TasksGetResponse

Deserialize a JSON object to an instance of TasksGetResponse



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
152
# File 'lib/ittybit/tasks/types/tasks_get_response.rb', line 111

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::Tasks::TasksGetResponseResults.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

.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.


167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
# File 'lib/ittybit/tasks/types/tasks_get_response.rb', line 167

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::Tasks::TasksGetResponseKind) != 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::Tasks::TasksGetResponseStatus) != 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::Tasks::TasksGetResponseResults.validate_raw(obj: obj.results)
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of TasksGetResponse to a JSON object



157
158
159
# File 'lib/ittybit/tasks/types/tasks_get_response.rb', line 157

def to_json(*_args)
  @_field_set&.to_json
end