Class: Ittybit::TaskSummary
- Inherits:
-
Object
- Object
- Ittybit::TaskSummary
- Defined in:
- lib/ittybit/types/task_summary.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
- #kind ⇒ Ittybit::TaskSummaryKind readonly
- #object ⇒ String readonly
- #parent_id ⇒ String readonly
- #progress ⇒ Integer readonly
- #status ⇒ Ittybit::TaskSummaryStatus readonly
- #updated ⇒ DateTime readonly
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Ittybit::TaskSummary
Deserialize a JSON object to an instance of TaskSummary.
-
.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:, progress: OMIT, error: OMIT, created_by: OMIT, parent_id: OMIT, additional_properties: nil) ⇒ Ittybit::TaskSummary constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of TaskSummary to a JSON object.
Constructor Details
#initialize(id:, object:, kind:, status:, created:, updated:, progress: OMIT, error: OMIT, created_by: OMIT, parent_id: OMIT, additional_properties: nil) ⇒ Ittybit::TaskSummary
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/ittybit/types/task_summary.rb', line 51 def initialize(id:, object:, kind:, status:, created:, updated:, progress: OMIT, error: OMIT, created_by: OMIT, parent_id: OMIT, additional_properties: nil) @id = id @object = object @kind = kind @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 @additional_properties = additional_properties @_field_set = { "id": id, "object": object, "kind": kind, "status": status, "progress": progress, "error": error, "created_by": created_by, "created": created, "updated": updated, "parent_id": parent_id }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
32 33 34 |
# File 'lib/ittybit/types/task_summary.rb', line 32 def additional_properties @additional_properties end |
#created ⇒ DateTime (readonly)
26 27 28 |
# File 'lib/ittybit/types/task_summary.rb', line 26 def created @created end |
#created_by ⇒ String (readonly)
24 25 26 |
# File 'lib/ittybit/types/task_summary.rb', line 24 def created_by @created_by end |
#error ⇒ String (readonly)
22 23 24 |
# File 'lib/ittybit/types/task_summary.rb', line 22 def error @error end |
#id ⇒ String (readonly)
12 13 14 |
# File 'lib/ittybit/types/task_summary.rb', line 12 def id @id end |
#kind ⇒ Ittybit::TaskSummaryKind (readonly)
16 17 18 |
# File 'lib/ittybit/types/task_summary.rb', line 16 def kind @kind end |
#object ⇒ String (readonly)
14 15 16 |
# File 'lib/ittybit/types/task_summary.rb', line 14 def object @object end |
#parent_id ⇒ String (readonly)
30 31 32 |
# File 'lib/ittybit/types/task_summary.rb', line 30 def parent_id @parent_id end |
#progress ⇒ Integer (readonly)
20 21 22 |
# File 'lib/ittybit/types/task_summary.rb', line 20 def progress @progress end |
#status ⇒ Ittybit::TaskSummaryStatus (readonly)
18 19 20 |
# File 'lib/ittybit/types/task_summary.rb', line 18 def status @status end |
#updated ⇒ DateTime (readonly)
28 29 30 |
# File 'lib/ittybit/types/task_summary.rb', line 28 def updated @updated end |
Class Method Details
.from_json(json_object:) ⇒ Ittybit::TaskSummary
Deserialize a JSON object to an instance of TaskSummary
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/ittybit/types/task_summary.rb', line 84 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"] 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"] new( id: id, object: object, kind: kind, status: status, progress: progress, error: error, created_by: created_by, created: created, updated: updated, parent_id: parent_id, 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.
125 126 127 128 129 130 131 132 133 134 135 136 |
# File 'lib/ittybit/types/task_summary.rb', line 125 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::TaskSummaryKind) != false || raise("Passed value for field obj.kind is not the expected type, validation failed.") obj.status.is_a?(Ittybit::TaskSummaryStatus) != 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.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of TaskSummary to a JSON object
115 116 117 |
# File 'lib/ittybit/types/task_summary.rb', line 115 def to_json(*_args) @_field_set&.to_json end |