Class: Vapi::GlobalNodePlan

Inherits:
Object
  • Object
show all
Defined in:
lib/vapi_server_sdk/types/global_node_plan.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(enabled: OMIT, enter_condition: OMIT, additional_properties: nil) ⇒ Vapi::GlobalNodePlan



30
31
32
33
34
35
36
37
# File 'lib/vapi_server_sdk/types/global_node_plan.rb', line 30

def initialize(enabled: OMIT, enter_condition: OMIT, additional_properties: nil)
  @enabled = enabled if enabled != OMIT
  @enter_condition = enter_condition if enter_condition != OMIT
  @additional_properties = additional_properties
  @_field_set = { "enabled": enabled, "enterCondition": enter_condition }.reject do |_k, v|
    v == OMIT
  end
end

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)



16
17
18
# File 'lib/vapi_server_sdk/types/global_node_plan.rb', line 16

def additional_properties
  @additional_properties
end

#enabledBoolean (readonly)



10
11
12
# File 'lib/vapi_server_sdk/types/global_node_plan.rb', line 10

def enabled
  @enabled
end

#enter_conditionString (readonly)



14
15
16
# File 'lib/vapi_server_sdk/types/global_node_plan.rb', line 14

def enter_condition
  @enter_condition
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::GlobalNodePlan

Deserialize a JSON object to an instance of GlobalNodePlan



43
44
45
46
47
48
49
50
51
52
53
# File 'lib/vapi_server_sdk/types/global_node_plan.rb', line 43

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  enabled = parsed_json["enabled"]
  enter_condition = parsed_json["enterCondition"]
  new(
    enabled: enabled,
    enter_condition: enter_condition,
    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.


68
69
70
71
# File 'lib/vapi_server_sdk/types/global_node_plan.rb', line 68

def self.validate_raw(obj:)
  obj.enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.enabled is not the expected type, validation failed.")
  obj.enter_condition&.is_a?(String) != false || raise("Passed value for field obj.enter_condition is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of GlobalNodePlan to a JSON object



58
59
60
# File 'lib/vapi_server_sdk/types/global_node_plan.rb', line 58

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