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.
-
#backoff_plan ⇒ Vapi::BackoffPlan
readonly
This is the backoff plan if the request fails.
-
#headers ⇒ Hash{String => Object}
readonly
These are the headers to include in the request.
-
#timeout_seconds ⇒ Float
readonly
This is the timeout in seconds for the request.
-
#url ⇒ String
readonly
This is where the request will be sent.
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(timeout_seconds: OMIT, url: OMIT, headers: OMIT, backoff_plan: OMIT, additional_properties: nil) ⇒ Vapi::Server constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of Server to a JSON object.
Constructor Details
#initialize(timeout_seconds: OMIT, url: OMIT, headers: OMIT, backoff_plan: OMIT, additional_properties: nil) ⇒ Vapi::Server
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/vapi_server_sdk/types/server.rb', line 39 def initialize(timeout_seconds: OMIT, url: OMIT, headers: OMIT, backoff_plan: OMIT, additional_properties: nil) @timeout_seconds = timeout_seconds if timeout_seconds != OMIT @url = url if url != OMIT @headers = headers if headers != OMIT @backoff_plan = backoff_plan if backoff_plan != OMIT @additional_properties = additional_properties @_field_set = { "timeoutSeconds": timeout_seconds, "url": url, "headers": headers, "backoffPlan": backoff_plan }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
22 23 24 |
# File 'lib/vapi_server_sdk/types/server.rb', line 22 def additional_properties @additional_properties end |
#backoff_plan ⇒ Vapi::BackoffPlan (readonly)
Returns This is the backoff plan if the request fails. Defaults to undefined (the request will not be retried). @default undefined (the request will not be retried).
20 21 22 |
# File 'lib/vapi_server_sdk/types/server.rb', line 20 def backoff_plan @backoff_plan end |
#headers ⇒ Hash{String => Object} (readonly)
Returns These are the headers to include in the request. Each key-value pair represents a header name and its value.
16 17 18 |
# File 'lib/vapi_server_sdk/types/server.rb', line 16 def headers @headers end |
#timeout_seconds ⇒ Float (readonly)
Returns This is the timeout in seconds for the request. 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 This is where the request will be sent.
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
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/vapi_server_sdk/types/server.rb', line 59 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"] headers = parsed_json["headers"] if parsed_json["backoffPlan"].nil? backoff_plan = nil else backoff_plan = parsed_json["backoffPlan"].to_json backoff_plan = Vapi::BackoffPlan.from_json(json_object: backoff_plan) end new( timeout_seconds: timeout_seconds, url: url, headers: headers, backoff_plan: backoff_plan, 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.
93 94 95 96 97 98 |
# File 'lib/vapi_server_sdk/types/server.rb', line 93 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.headers&.is_a?(Hash) != false || raise("Passed value for field obj.headers is not the expected type, validation failed.") obj.backoff_plan.nil? || Vapi::BackoffPlan.validate_raw(obj: obj.backoff_plan) end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of Server to a JSON object
83 84 85 |
# File 'lib/vapi_server_sdk/types/server.rb', line 83 def to_json(*_args) @_field_set&.to_json end |