Class: Vapi::ToolTemplateSetup

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(title:, description: OMIT, video_url: OMIT, docs_url: OMIT, additional_properties: nil) ⇒ Vapi::ToolTemplateSetup

Parameters:

  • title (String)
  • description (String) (defaults to: OMIT)
  • video_url (String) (defaults to: OMIT)
  • docs_url (String) (defaults to: OMIT)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/vapi_server_sdk/types/tool_template_setup.rb', line 30

def initialize(title:, description: OMIT, video_url: OMIT, docs_url: OMIT, additional_properties: nil)
  @title = title
  @description = description if description != OMIT
  @video_url = video_url if video_url != OMIT
  @docs_url = docs_url if docs_url != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "title": title,
    "description": description,
    "videoUrl": video_url,
    "docsUrl": docs_url
  }.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



17
18
19
# File 'lib/vapi_server_sdk/types/tool_template_setup.rb', line 17

def additional_properties
  @additional_properties
end

#descriptionString (readonly)

Returns:

  • (String)


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

def description
  @description
end

#docs_urlString (readonly)

Returns:

  • (String)


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

def docs_url
  @docs_url
end

#titleString (readonly)

Returns:

  • (String)


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

def title
  @title
end

#video_urlString (readonly)

Returns:

  • (String)


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

def video_url
  @video_url
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::ToolTemplateSetup

Deserialize a JSON object to an instance of ToolTemplateSetup

Parameters:

  • json_object (String)

Returns:



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/vapi_server_sdk/types/tool_template_setup.rb', line 50

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  title = parsed_json["title"]
  description = parsed_json["description"]
  video_url = parsed_json["videoUrl"]
  docs_url = parsed_json["docsUrl"]
  new(
    title: title,
    description: description,
    video_url: video_url,
    docs_url: docs_url,
    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)


79
80
81
82
83
84
# File 'lib/vapi_server_sdk/types/tool_template_setup.rb', line 79

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

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of ToolTemplateSetup to a JSON object

Returns:

  • (String)


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

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