Class: Ittybit::TaskSummary

Inherits:
Object
  • Object
show all
Defined in:
lib/ittybit/types/task_summary.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:, progress: OMIT, error: OMIT, created_by: OMIT, parent_id: OMIT, additional_properties: nil) ⇒ Ittybit::TaskSummary

Parameters:

  • id (String)
  • object (String)
  • kind (Ittybit::TaskSummaryKind)
  • status (Ittybit::TaskSummaryStatus)
  • progress (Integer) (defaults to: OMIT)
  • error (String) (defaults to: OMIT)
  • created_by (String) (defaults to: OMIT)
  • created (DateTime)
  • updated (DateTime)
  • parent_id (String) (defaults to: OMIT)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



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_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    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

#createdDateTime (readonly)

Returns:

  • (DateTime)


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

def created
  @created
end

#created_byString (readonly)

Returns:

  • (String)


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

def created_by
  @created_by
end

#errorString (readonly)

Returns:

  • (String)


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

def error
  @error
end

#idString (readonly)

Returns:

  • (String)


12
13
14
# File 'lib/ittybit/types/task_summary.rb', line 12

def id
  @id
end

#kindIttybit::TaskSummaryKind (readonly)



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

def kind
  @kind
end

#objectString (readonly)

Returns:

  • (String)


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

def object
  @object
end

#parent_idString (readonly)

Returns:

  • (String)


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

def parent_id
  @parent_id
end

#progressInteger (readonly)

Returns:

  • (Integer)


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

def progress
  @progress
end

#statusIttybit::TaskSummaryStatus (readonly)



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

def status
  @status
end

#updatedDateTime (readonly)

Returns:

  • (DateTime)


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

Parameters:

  • json_object (String)

Returns:



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.

Parameters:

  • obj (Object)

Returns:

  • (Void)


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

Returns:

  • (String)


115
116
117
# File 'lib/ittybit/types/task_summary.rb', line 115

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