Class: Vapi::Eval::Client
- Inherits:
-
Object
- Object
- Vapi::Eval::Client
- Defined in:
- lib/vapi/eval/client.rb
Instance Method Summary collapse
- #eval_controller_create(request_options: {}, **params) ⇒ Vapi::Types::Eval
- #eval_controller_get(request_options: {}, **params) ⇒ Vapi::Types::Eval
- #eval_controller_get_paginated(request_options: {}, **params) ⇒ Vapi::Types::EvalPaginatedResponse
- #eval_controller_get_run(request_options: {}, **params) ⇒ Vapi::Types::EvalRun
- #eval_controller_get_runs_paginated(request_options: {}, **params) ⇒ Vapi::Types::EvalRunPaginatedResponse
- #eval_controller_remove(request_options: {}, **params) ⇒ Vapi::Types::Eval
- #eval_controller_remove_run(request_options: {}, **params) ⇒ Vapi::Types::EvalRun
- #eval_controller_run(request_options: {}, **params) ⇒ Hash[String, Object]
- #eval_controller_update(request_options: {}, **params) ⇒ Vapi::Types::Eval
- #initialize(client:) ⇒ void constructor
Constructor Details
#initialize(client:) ⇒ void
9 10 11 |
# File 'lib/vapi/eval/client.rb', line 9 def initialize(client:) @client = client end |
Instance Method Details
#eval_controller_create(request_options: {}, **params) ⇒ Vapi::Types::Eval
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/vapi/eval/client.rb', line 82 def eval_controller_create(request_options: {}, **params) params = Vapi::Internal::Types::Utils.normalize_keys(params) request = Vapi::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "eval", body: Vapi::Types::CreateEvalDto.new(params).to_h, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Vapi::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Vapi::Types::Eval.load(response.body) else error_class = Vapi::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#eval_controller_get(request_options: {}, **params) ⇒ Vapi::Types::Eval
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
# File 'lib/vapi/eval/client.rb', line 115 def eval_controller_get(request_options: {}, **params) params = Vapi::Internal::Types::Utils.normalize_keys(params) request = Vapi::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "eval/#{URI.encode_uri_component(params[:id].to_s)}", request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Vapi::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Vapi::Types::Eval.load(response.body) else error_class = Vapi::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#eval_controller_get_paginated(request_options: {}, **params) ⇒ Vapi::Types::EvalPaginatedResponse
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/vapi/eval/client.rb', line 34 def eval_controller_get_paginated(request_options: {}, **params) params = Vapi::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[id page sort_order limit created_at_gt created_at_lt created_at_ge created_at_le updated_at_gt updated_at_lt updated_at_ge updated_at_le] query_params = {} query_params["id"] = params[:id] if params.key?(:id) query_params["page"] = params[:page] if params.key?(:page) query_params["sortOrder"] = params[:sort_order] if params.key?(:sort_order) query_params["limit"] = params[:limit] if params.key?(:limit) query_params["createdAtGt"] = params[:created_at_gt] if params.key?(:created_at_gt) query_params["createdAtLt"] = params[:created_at_lt] if params.key?(:created_at_lt) query_params["createdAtGe"] = params[:created_at_ge] if params.key?(:created_at_ge) query_params["createdAtLe"] = params[:created_at_le] if params.key?(:created_at_le) query_params["updatedAtGt"] = params[:updated_at_gt] if params.key?(:updated_at_gt) query_params["updatedAtLt"] = params[:updated_at_lt] if params.key?(:updated_at_lt) query_params["updatedAtGe"] = params[:updated_at_ge] if params.key?(:updated_at_ge) query_params["updatedAtLe"] = params[:updated_at_le] if params.key?(:updated_at_le) params.except(*query_param_names) request = Vapi::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "eval", query: query_params, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Vapi::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Vapi::Types::EvalPaginatedResponse.load(response.body) else error_class = Vapi::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#eval_controller_get_run(request_options: {}, **params) ⇒ Vapi::Types::EvalRun
216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 |
# File 'lib/vapi/eval/client.rb', line 216 def eval_controller_get_run(request_options: {}, **params) params = Vapi::Internal::Types::Utils.normalize_keys(params) request = Vapi::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "eval/run/#{URI.encode_uri_component(params[:id].to_s)}", request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Vapi::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Vapi::Types::EvalRun.load(response.body) else error_class = Vapi::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#eval_controller_get_runs_paginated(request_options: {}, **params) ⇒ Vapi::Types::EvalRunPaginatedResponse
291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 |
# File 'lib/vapi/eval/client.rb', line 291 def eval_controller_get_runs_paginated(request_options: {}, **params) params = Vapi::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[id page sort_order limit created_at_gt created_at_lt created_at_ge created_at_le updated_at_gt updated_at_lt updated_at_ge updated_at_le] query_params = {} query_params["id"] = params[:id] if params.key?(:id) query_params["page"] = params[:page] if params.key?(:page) query_params["sortOrder"] = params[:sort_order] if params.key?(:sort_order) query_params["limit"] = params[:limit] if params.key?(:limit) query_params["createdAtGt"] = params[:created_at_gt] if params.key?(:created_at_gt) query_params["createdAtLt"] = params[:created_at_lt] if params.key?(:created_at_lt) query_params["createdAtGe"] = params[:created_at_ge] if params.key?(:created_at_ge) query_params["createdAtLe"] = params[:created_at_le] if params.key?(:created_at_le) query_params["updatedAtGt"] = params[:updated_at_gt] if params.key?(:updated_at_gt) query_params["updatedAtLt"] = params[:updated_at_lt] if params.key?(:updated_at_lt) query_params["updatedAtGe"] = params[:updated_at_ge] if params.key?(:updated_at_ge) query_params["updatedAtLe"] = params[:updated_at_le] if params.key?(:updated_at_le) params.except(*query_param_names) request = Vapi::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "eval/run", query: query_params, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Vapi::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Vapi::Types::EvalRunPaginatedResponse.load(response.body) else error_class = Vapi::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#eval_controller_remove(request_options: {}, **params) ⇒ Vapi::Types::Eval
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
# File 'lib/vapi/eval/client.rb', line 147 def eval_controller_remove(request_options: {}, **params) params = Vapi::Internal::Types::Utils.normalize_keys(params) request = Vapi::Internal::JSON::Request.new( base_url: [:base_url], method: "DELETE", path: "eval/#{URI.encode_uri_component(params[:id].to_s)}", request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Vapi::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Vapi::Types::Eval.load(response.body) else error_class = Vapi::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#eval_controller_remove_run(request_options: {}, **params) ⇒ Vapi::Types::EvalRun
248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 |
# File 'lib/vapi/eval/client.rb', line 248 def eval_controller_remove_run(request_options: {}, **params) params = Vapi::Internal::Types::Utils.normalize_keys(params) request = Vapi::Internal::JSON::Request.new( base_url: [:base_url], method: "DELETE", path: "eval/run/#{URI.encode_uri_component(params[:id].to_s)}", request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Vapi::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Vapi::Types::EvalRun.load(response.body) else error_class = Vapi::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#eval_controller_run(request_options: {}, **params) ⇒ Hash[String, Object]
339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 |
# File 'lib/vapi/eval/client.rb', line 339 def eval_controller_run(request_options: {}, **params) params = Vapi::Internal::Types::Utils.normalize_keys(params) request = Vapi::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "eval/run", body: Vapi::Eval::Types::CreateEvalRunDto.new(params).to_h, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Vapi::Errors::TimeoutError end code = response.code.to_i return if code.between?(200, 299) error_class = Vapi::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end |
#eval_controller_update(request_options: {}, **params) ⇒ Vapi::Types::Eval
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 |
# File 'lib/vapi/eval/client.rb', line 179 def eval_controller_update(request_options: {}, **params) params = Vapi::Internal::Types::Utils.normalize_keys(params) request_data = Vapi::Eval::Types::UpdateEvalDto.new(params).to_h non_body_param_names = ["id"] body = request_data.except(*non_body_param_names) request = Vapi::Internal::JSON::Request.new( base_url: [:base_url], method: "PATCH", path: "eval/#{URI.encode_uri_component(params[:id].to_s)}", body: body, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Vapi::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Vapi::Types::Eval.load(response.body) else error_class = Vapi::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |