Class: Vapi::ToolTemplateMetadata

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(collection_type: OMIT, collection_id: OMIT, collection_name: OMIT, additional_properties: nil) ⇒ Vapi::ToolTemplateMetadata

Parameters:

  • collection_type (String) (defaults to: OMIT)
  • collection_id (String) (defaults to: OMIT)
  • collection_name (String) (defaults to: OMIT)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/vapi_server_sdk/types/tool_template_metadata.rb', line 27

def initialize(collection_type: OMIT, collection_id: OMIT, collection_name: OMIT, additional_properties: nil)
  @collection_type = collection_type if collection_type != OMIT
  @collection_id = collection_id if collection_id != OMIT
  @collection_name = collection_name if collection_name != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "collectionType": collection_type,
    "collectionId": collection_id,
    "collectionName": collection_name
  }.reject do |_k, v|
    v == OMIT
  end
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



15
16
17
# File 'lib/vapi_server_sdk/types/tool_template_metadata.rb', line 15

def additional_properties
  @additional_properties
end

#collection_idString (readonly)

Returns:

  • (String)


11
12
13
# File 'lib/vapi_server_sdk/types/tool_template_metadata.rb', line 11

def collection_id
  @collection_id
end

#collection_nameString (readonly)

Returns:

  • (String)


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

def collection_name
  @collection_name
end

#collection_typeString (readonly)

Returns:

  • (String)


9
10
11
# File 'lib/vapi_server_sdk/types/tool_template_metadata.rb', line 9

def collection_type
  @collection_type
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::ToolTemplateMetadata

Deserialize a JSON object to an instance of ToolTemplateMetadata

Parameters:

  • json_object (String)

Returns:



45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/vapi_server_sdk/types/tool_template_metadata.rb', line 45

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  collection_type = parsed_json["collectionType"]
  collection_id = parsed_json["collectionId"]
  collection_name = parsed_json["collectionName"]
  new(
    collection_type: collection_type,
    collection_id: collection_id,
    collection_name: collection_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.

Parameters:

  • obj (Object)

Returns:

  • (Void)


72
73
74
75
76
# File 'lib/vapi_server_sdk/types/tool_template_metadata.rb', line 72

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

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of ToolTemplateMetadata to a JSON object

Returns:

  • (String)


62
63
64
# File 'lib/vapi_server_sdk/types/tool_template_metadata.rb', line 62

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