Class: Vapi::BlockCompleteMessage
- Inherits:
-
Object
- Object
- Vapi::BlockCompleteMessage
- Defined in:
- lib/vapi_server_sdk/types/block_complete_message.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#conditions ⇒ Array<Vapi::BlockCompleteMessageConditionsItem>
readonly
This is an optional array of conditions that must be met for this message to be triggered.
-
#content ⇒ String
readonly
This is the content that the assistant will say when this message is triggered.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::BlockCompleteMessage
Deserialize a JSON object to an instance of BlockCompleteMessage.
-
.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(content:, conditions: OMIT, additional_properties: nil) ⇒ Vapi::BlockCompleteMessage constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of BlockCompleteMessage to a JSON object.
Constructor Details
#initialize(content:, conditions: OMIT, additional_properties: nil) ⇒ Vapi::BlockCompleteMessage
27 28 29 30 31 32 33 34 |
# File 'lib/vapi_server_sdk/types/block_complete_message.rb', line 27 def initialize(content:, conditions: OMIT, additional_properties: nil) @conditions = conditions if conditions != OMIT @content = content @additional_properties = additional_properties @_field_set = { "conditions": conditions, "content": content }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
15 16 17 |
# File 'lib/vapi_server_sdk/types/block_complete_message.rb', line 15 def additional_properties @additional_properties end |
#conditions ⇒ Array<Vapi::BlockCompleteMessageConditionsItem> (readonly)
Returns This is an optional array of conditions that must be met for this message to be triggered.
11 12 13 |
# File 'lib/vapi_server_sdk/types/block_complete_message.rb', line 11 def conditions @conditions end |
#content ⇒ String (readonly)
Returns This is the content that the assistant will say when this message is triggered.
13 14 15 |
# File 'lib/vapi_server_sdk/types/block_complete_message.rb', line 13 def content @content end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::BlockCompleteMessage
Deserialize a JSON object to an instance of BlockCompleteMessage
40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/vapi_server_sdk/types/block_complete_message.rb', line 40 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) conditions = parsed_json["conditions"]&.map do |item| item = item.to_json Vapi::BlockCompleteMessageConditionsItem.from_json(json_object: item) end content = parsed_json["content"] new( conditions: conditions, content: content, 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/block_complete_message.rb', line 68 def self.validate_raw(obj:) obj.conditions&.is_a?(Array) != false || raise("Passed value for field obj.conditions is not the expected type, validation failed.") obj.content.is_a?(String) != false || raise("Passed value for field obj.content is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of BlockCompleteMessage to a JSON object
58 59 60 |
# File 'lib/vapi_server_sdk/types/block_complete_message.rb', line 58 def to_json(*_args) @_field_set&.to_json end |