class Ittybit::Automation

def self.from_json(json_object:)

Returns:
  • (Ittybit::Automation) -

Parameters:
  • json_object (String) --
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::AutomationTrigger.from_json(json_object: trigger)
  end
  workflow = parsed_json["workflow"]&.map do |item|
    item = item.to_json
    Ittybit::WorkflowTaskStep.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

def self.validate_raw(obj:)

Returns:
  • (Void) -

Parameters:
  • obj (Object) --
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::AutomationTrigger.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::AutomationStatus) != 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

def initialize(id:, name:, trigger:, workflow:, status:, created:, updated:, description: OMIT,

Returns:
  • (Ittybit::Automation) -

Parameters:
  • additional_properties (OpenStruct) -- Additional properties unmapped to the current class definition
  • updated (DateTime) --
  • created (DateTime) --
  • status (Ittybit::AutomationStatus) --
  • workflow (Array) --
  • trigger (Ittybit::AutomationTrigger) --
  • description (String) --
  • name (String) --
  • id (String) --
def initialize(id:, name:, trigger:, workflow:, status:, created:, updated:, description: OMIT,
               additional_properties: nil)
  @id = id
  @name = name
  @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

def to_json(*_args)

Returns:
  • (String) -
def to_json(*_args)
  @_field_set&.to_json
end