Class: Ittybit::Automations::AutomationsCreateRequestWorkflowItem

Inherits:
Object
  • Object
show all
Defined in:
lib/ittybit/automations/types/automations_create_request_workflow_item.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(kind:, ref: OMIT, next_: OMIT, additional_properties: nil) ⇒ Ittybit::Automations::AutomationsCreateRequestWorkflowItem

Parameters:



30
31
32
33
34
35
36
37
38
# File 'lib/ittybit/automations/types/automations_create_request_workflow_item.rb', line 30

def initialize(kind:, ref: OMIT, next_: OMIT, additional_properties: nil)
  @kind = kind
  @ref = ref if ref != OMIT
  @next_ = next_ if next_ != OMIT
  @additional_properties = additional_properties
  @_field_set = { "kind": kind, "ref": ref, "next": next_ }.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



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

def additional_properties
  @additional_properties
end

#kindIttybit::Automations::AutomationsCreateRequestWorkflowItemKind (readonly)



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

def kind
  @kind
end

#next_Array<Ittybit::Automations::AutomationsCreateRequestWorkflowItemNextItem> (readonly)



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

def next_
  @next_
end

#refString (readonly)

Returns:

  • (String)


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

def ref
  @ref
end

Class Method Details

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

Deserialize a JSON object to an instance of AutomationsCreateRequestWorkflowItem

Parameters:

  • json_object (String)

Returns:



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/ittybit/automations/types/automations_create_request_workflow_item.rb', line 44

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  kind = parsed_json["kind"]
  ref = parsed_json["ref"]
  next_ = parsed_json["next"]&.map do |item|
    item = item.to_json
    Ittybit::Automations::AutomationsCreateRequestWorkflowItemNextItem.from_json(json_object: item)
  end
  new(
    kind: kind,
    ref: ref,
    next_: next_,
    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)


74
75
76
77
78
# File 'lib/ittybit/automations/types/automations_create_request_workflow_item.rb', line 74

def self.validate_raw(obj:)
  obj.kind.is_a?(Ittybit::Automations::AutomationsCreateRequestWorkflowItemKind) != false || raise("Passed value for field obj.kind is not the expected type, validation failed.")
  obj.ref&.is_a?(String) != false || raise("Passed value for field obj.ref is not the expected type, validation failed.")
  obj.next_&.is_a?(Array) != false || raise("Passed value for field obj.next_ is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of AutomationsCreateRequestWorkflowItem to a JSON object

Returns:

  • (String)


64
65
66
# File 'lib/ittybit/automations/types/automations_create_request_workflow_item.rb', line 64

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