Class: Ittybit::Automations::AutomationsGetResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/ittybit/automations/types/automations_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:, trigger:, workflow:, status:, created:, updated:, name: OMIT, description: OMIT, additional_properties: nil) ⇒ Ittybit::Automations::AutomationsGetResponse

Parameters:



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/ittybit/automations/types/automations_get_response.rb', line 47

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

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



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

def additional_properties
  @additional_properties
end

#createdDateTime (readonly)

Returns:

  • (DateTime)


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

def created
  @created
end

#descriptionString (readonly)

Returns:

  • (String)


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

def description
  @description
end

#idString (readonly)

Returns:

  • (String)


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

def id
  @id
end

#nameString (readonly)

Returns:

  • (String)


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

def name
  @name
end

#statusIttybit::Automations::AutomationsGetResponseStatus (readonly)



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

def status
  @status
end

#triggerIttybit::Automations::AutomationsGetResponseTrigger (readonly)



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

def trigger
  @trigger
end

#updatedDateTime (readonly)

Returns:

  • (DateTime)


28
29
30
# File 'lib/ittybit/automations/types/automations_get_response.rb', line 28

def updated
  @updated
end

#workflowArray<Ittybit::Automations::AutomationsGetResponseWorkflowItem> (readonly)



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

def workflow
  @workflow
end

Class Method Details

.from_json(json_object:) ⇒ Ittybit::Automations::AutomationsGetResponse

Deserialize a JSON object to an instance of AutomationsGetResponse

Parameters:

  • json_object (String)

Returns:



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
106
# File 'lib/ittybit/automations/types/automations_get_response.rb', line 76

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::Automations::AutomationsGetResponseTrigger.from_json(json_object: trigger)
  end
  workflow = parsed_json["workflow"]&.map do |item|
    item = item.to_json
    Ittybit::Automations::AutomationsGetResponseWorkflowItem.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.

Parameters:

  • obj (Object)

Returns:

  • (Void)


121
122
123
124
125
126
127
128
129
130
# File 'lib/ittybit/automations/types/automations_get_response.rb', line 121

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::Automations::AutomationsGetResponseTrigger.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::Automations::AutomationsGetResponseStatus) != 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 AutomationsGetResponse to a JSON object

Returns:

  • (String)


111
112
113
# File 'lib/ittybit/automations/types/automations_get_response.rb', line 111

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