Class: Vapi::RegexOption

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type:, enabled:, additional_properties: nil) ⇒ Vapi::RegexOption

Parameters:

  • type (Vapi::RegexOptionType)

    This is the type of the regex option. Options are:

    • ‘ignore-case`: Ignores the case of the text being matched.

    • ‘whole-word`: Matches whole words only.

    • ‘multi-line`: Matches across multiple lines.

  • enabled (Boolean)

    This is whether to enable the option. @default false

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



33
34
35
36
37
38
# File 'lib/vapi_server_sdk/types/regex_option.rb', line 33

def initialize(type:, enabled:, additional_properties: nil)
  @type = type
  @enabled = enabled
  @additional_properties = additional_properties
  @_field_set = { "type": type, "enabled": enabled }
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/vapi_server_sdk/types/regex_option.rb', line 18

def additional_properties
  @additional_properties
end

#enabledBoolean (readonly)

Returns This is whether to enable the option. @default false.

Returns:

  • (Boolean)

    This is whether to enable the option. @default false



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

def enabled
  @enabled
end

#typeVapi::RegexOptionType (readonly)

Returns This is the type of the regex option. Options are:

  • ‘ignore-case`: Ignores the case of the text being matched.

  • ‘whole-word`: Matches whole words only.

  • ‘multi-line`: Matches across multiple lines.

Returns:

  • (Vapi::RegexOptionType)

    This is the type of the regex option. Options are:

    • ‘ignore-case`: Ignores the case of the text being matched.

    • ‘whole-word`: Matches whole words only.

    • ‘multi-line`: Matches across multiple lines.



13
14
15
# File 'lib/vapi_server_sdk/types/regex_option.rb', line 13

def type
  @type
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::RegexOption

Deserialize a JSON object to an instance of RegexOption

Parameters:

  • json_object (String)

Returns:



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

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


69
70
71
72
# File 'lib/vapi_server_sdk/types/regex_option.rb', line 69

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

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of RegexOption to a JSON object

Returns:

  • (String)


59
60
61
# File 'lib/vapi_server_sdk/types/regex_option.rb', line 59

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