Class: Ittybit::AutomationResponse
- Inherits:
-
Object
- Object
- Ittybit::AutomationResponse
- Defined in:
- lib/ittybit/types/automation_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
- #description ⇒ String readonly
- #id ⇒ String readonly
- #name ⇒ String readonly
- #status ⇒ Ittybit::AutomationResponseStatus readonly
- #trigger ⇒ Ittybit::AutomationResponseTrigger readonly
- #updated ⇒ DateTime readonly
- #workflow ⇒ Array<Ittybit::AutomationResponseWorkflowItem> readonly
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Ittybit::AutomationResponse
Deserialize a JSON object to an instance of AutomationResponse.
-
.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:, trigger:, workflow:, status:, created:, updated:, name: OMIT, description: OMIT, additional_properties: nil) ⇒ Ittybit::AutomationResponse constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of AutomationResponse to a JSON object.
Constructor Details
#initialize(id:, trigger:, workflow:, status:, created:, updated:, name: OMIT, description: OMIT, additional_properties: nil) ⇒ Ittybit::AutomationResponse
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/ittybit/types/automation_response.rb', line 46 def initialize(id:, trigger:, workflow:, status:, created:, updated:, name: OMIT, description: OMIT, additional_properties: nil) @id = id @name = name if name != OMIT @description = description if description != OMIT @trigger = trigger @workflow = workflow @status = status @created = created @updated = updated @additional_properties = additional_properties @_field_set = { "id": id, "name": name, "description": description, "trigger": trigger, "workflow": workflow, "status": status, "created": created, "updated": updated }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
29 30 31 |
# File 'lib/ittybit/types/automation_response.rb', line 29 def additional_properties @additional_properties end |
#created ⇒ DateTime (readonly)
25 26 27 |
# File 'lib/ittybit/types/automation_response.rb', line 25 def created @created end |
#description ⇒ String (readonly)
17 18 19 |
# File 'lib/ittybit/types/automation_response.rb', line 17 def description @description end |
#id ⇒ String (readonly)
13 14 15 |
# File 'lib/ittybit/types/automation_response.rb', line 13 def id @id end |
#name ⇒ String (readonly)
15 16 17 |
# File 'lib/ittybit/types/automation_response.rb', line 15 def name @name end |
#status ⇒ Ittybit::AutomationResponseStatus (readonly)
23 24 25 |
# File 'lib/ittybit/types/automation_response.rb', line 23 def status @status end |
#trigger ⇒ Ittybit::AutomationResponseTrigger (readonly)
19 20 21 |
# File 'lib/ittybit/types/automation_response.rb', line 19 def trigger @trigger end |
#updated ⇒ DateTime (readonly)
27 28 29 |
# File 'lib/ittybit/types/automation_response.rb', line 27 def updated @updated end |
#workflow ⇒ Array<Ittybit::AutomationResponseWorkflowItem> (readonly)
21 22 23 |
# File 'lib/ittybit/types/automation_response.rb', line 21 def workflow @workflow end |
Class Method Details
.from_json(json_object:) ⇒ Ittybit::AutomationResponse
Deserialize a JSON object to an instance of AutomationResponse
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/types/automation_response.rb', line 75 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) id = parsed_json["id"] name = parsed_json["name"] description = parsed_json["description"] if parsed_json["trigger"].nil? trigger = nil else trigger = parsed_json["trigger"].to_json trigger = Ittybit::AutomationResponseTrigger.from_json(json_object: trigger) end workflow = parsed_json["workflow"]&.map do |item| item = item.to_json Ittybit::AutomationResponseWorkflowItem.from_json(json_object: item) end status = parsed_json["status"] created = (DateTime.parse(parsed_json["created"]) unless parsed_json["created"].nil?) updated = (DateTime.parse(parsed_json["updated"]) unless parsed_json["updated"].nil?) new( id: id, name: name, description: description, trigger: trigger, workflow: workflow, status: status, created: created, updated: updated, 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.
120 121 122 123 124 125 126 127 128 129 |
# File 'lib/ittybit/types/automation_response.rb', line 120 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.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.") Ittybit::AutomationResponseTrigger.validate_raw(obj: obj.trigger) obj.workflow.is_a?(Array) != false || raise("Passed value for field obj.workflow is not the expected type, validation failed.") obj.status.is_a?(Ittybit::AutomationResponseStatus) != false || raise("Passed value for field obj.status 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.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of AutomationResponse to a JSON object
110 111 112 |
# File 'lib/ittybit/types/automation_response.rb', line 110 def to_json(*_args) @_field_set&.to_json end |