Class: Vapi::Server
- Inherits:
-
Object
- Object
- Vapi::Server
- Defined in:
- lib/vapi_server_sdk/types/server.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#secret ⇒ String
readonly
This is the secret you can set that Vapi will send with every request to your server.
-
#timeout_seconds ⇒ Float
readonly
This is the timeout in seconds for the request to your server.
-
#url ⇒ String
readonly
API endpoint to send requests to.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::Server
Deserialize a JSON object to an instance of Server.
-
.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(url:, timeout_seconds: OMIT, secret: OMIT, additional_properties: nil) ⇒ Vapi::Server constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of Server to a JSON object.
Constructor Details
#initialize(url:, timeout_seconds: OMIT, secret: OMIT, additional_properties: nil) ⇒ Vapi::Server
35 36 37 38 39 40 41 42 43 |
# File 'lib/vapi_server_sdk/types/server.rb', line 35 def initialize(url:, timeout_seconds: OMIT, secret: OMIT, additional_properties: nil) @timeout_seconds = timeout_seconds if timeout_seconds != OMIT @url = url @secret = secret if secret != OMIT @additional_properties = additional_properties @_field_set = { "timeoutSeconds": timeout_seconds, "url": url, "secret": secret }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
19 20 21 |
# File 'lib/vapi_server_sdk/types/server.rb', line 19 def additional_properties @additional_properties end |
#secret ⇒ String (readonly)
Returns This is the secret you can set that Vapi will send with every request to your server. Will be sent as a header called x-vapi-secret. Same precedence logic as server.
17 18 19 |
# File 'lib/vapi_server_sdk/types/server.rb', line 17 def secret @secret end |
#timeout_seconds ⇒ Float (readonly)
Returns This is the timeout in seconds for the request to your server. Defaults to 20 seconds. @default 20.
11 12 13 |
# File 'lib/vapi_server_sdk/types/server.rb', line 11 def timeout_seconds @timeout_seconds end |
#url ⇒ String (readonly)
Returns API endpoint to send requests to.
13 14 15 |
# File 'lib/vapi_server_sdk/types/server.rb', line 13 def url @url end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::Server
Deserialize a JSON object to an instance of Server
49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/vapi_server_sdk/types/server.rb', line 49 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) timeout_seconds = parsed_json["timeoutSeconds"] url = parsed_json["url"] secret = parsed_json["secret"] new( timeout_seconds: timeout_seconds, url: url, secret: secret, 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.
76 77 78 79 80 |
# File 'lib/vapi_server_sdk/types/server.rb', line 76 def self.validate_raw(obj:) obj.timeout_seconds&.is_a?(Float) != false || raise("Passed value for field obj.timeout_seconds is not the expected type, validation failed.") obj.url.is_a?(String) != false || raise("Passed value for field obj.url is not the expected type, validation failed.") obj.secret&.is_a?(String) != false || raise("Passed value for field obj.secret is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of Server to a JSON object
66 67 68 |
# File 'lib/vapi_server_sdk/types/server.rb', line 66 def to_json(*_args) @_field_set&.to_json end |