Class: Vapi::RegexOption
- Inherits:
-
Object
- Object
- Vapi::RegexOption
- Defined in:
- lib/vapi_server_sdk/types/regex_option.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#enabled ⇒ Boolean
readonly
This is whether to enable the option.
-
#type ⇒ Vapi::RegexOptionType
readonly
This is the type of the regex option.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::RegexOption
Deserialize a JSON object to an instance of RegexOption.
-
.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.
Instance Method Summary collapse
- #initialize(type:, enabled:, additional_properties: nil) ⇒ Vapi::RegexOption constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of RegexOption to a JSON object.
Constructor Details
#initialize(type:, enabled:, additional_properties: nil) ⇒ Vapi::RegexOption
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_properties ⇒ OpenStruct (readonly)
Returns 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 |
#enabled ⇒ Boolean (readonly)
Returns 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 |
#type ⇒ Vapi::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.
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
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.
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
59 60 61 |
# File 'lib/vapi_server_sdk/types/regex_option.rb', line 59 def to_json(*_args) @_field_set&.to_json end |