Class: Vapi::DeveloperMessage
- Inherits:
-
Object
- Object
- Vapi::DeveloperMessage
- Defined in:
- lib/vapi_server_sdk/types/developer_message.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#content ⇒ String
readonly
This is the content of the developer message.
-
#name ⇒ String
readonly
This is an optional name for the participant.
-
#role ⇒ String
readonly
This is the role of the message author.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::DeveloperMessage
Deserialize a JSON object to an instance of DeveloperMessage.
-
.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(role:, content:, name: OMIT, additional_properties: nil) ⇒ Vapi::DeveloperMessage constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of DeveloperMessage to a JSON object.
Constructor Details
#initialize(role:, content:, name: OMIT, additional_properties: nil) ⇒ Vapi::DeveloperMessage
27 28 29 30 31 32 33 34 35 |
# File 'lib/vapi_server_sdk/types/developer_message.rb', line 27 def initialize(role:, content:, name: OMIT, additional_properties: nil) @role = role @content = content @name = name if name != OMIT @additional_properties = additional_properties @_field_set = { "role": role, "content": content, "name": name }.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/developer_message.rb', line 15 def additional_properties @additional_properties end |
#content ⇒ String (readonly)
Returns This is the content of the developer message.
11 12 13 |
# File 'lib/vapi_server_sdk/types/developer_message.rb', line 11 def content @content end |
#name ⇒ String (readonly)
Returns This is an optional name for the participant.
13 14 15 |
# File 'lib/vapi_server_sdk/types/developer_message.rb', line 13 def name @name end |
#role ⇒ String (readonly)
Returns This is the role of the message author.
9 10 11 |
# File 'lib/vapi_server_sdk/types/developer_message.rb', line 9 def role @role end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::DeveloperMessage
Deserialize a JSON object to an instance of DeveloperMessage
41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/vapi_server_sdk/types/developer_message.rb', line 41 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) role = parsed_json["role"] content = parsed_json["content"] name = parsed_json["name"] new( role: role, content: content, name: name, 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 72 |
# File 'lib/vapi_server_sdk/types/developer_message.rb', line 68 def self.validate_raw(obj:) obj.role.is_a?(String) != false || raise("Passed value for field obj.role 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.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of DeveloperMessage to a JSON object
58 59 60 |
# File 'lib/vapi_server_sdk/types/developer_message.rb', line 58 def to_json(*_args) @_field_set&.to_json end |