Class: Schematic::Features::Client
- Inherits:
-
Object
- Object
- Schematic::Features::Client
- Defined in:
- lib/schematic/features/client.rb
Instance Method Summary collapse
- #check_flag(request_options: {}, **params) ⇒ Schematic::Features::Types::CheckFlagResponse
- #check_flags(request_options: {}, **params) ⇒ Schematic::Features::Types::CheckFlagsResponse
- #check_flags_bulk(request_options: {}, **params) ⇒ Schematic::Features::Types::CheckFlagsBulkResponse
- #count_features(request_options: {}, **params) ⇒ Schematic::Features::Types::CountFeaturesResponse
- #count_flags(request_options: {}, **params) ⇒ Schematic::Features::Types::CountFlagsResponse
- #create_feature(request_options: {}, **params) ⇒ Schematic::Features::Types::CreateFeatureResponse
- #create_flag(request_options: {}, **params) ⇒ Schematic::Features::Types::CreateFlagResponse
- #delete_feature(request_options: {}, **params) ⇒ Schematic::Features::Types::DeleteFeatureResponse
- #delete_flag(request_options: {}, **params) ⇒ Schematic::Features::Types::DeleteFlagResponse
- #get_feature(request_options: {}, **params) ⇒ Schematic::Features::Types::GetFeatureResponse
- #get_flag(request_options: {}, **params) ⇒ Schematic::Features::Types::GetFlagResponse
- #initialize(client:) ⇒ void constructor
- #list_features(request_options: {}, **params) ⇒ Schematic::Features::Types::ListFeaturesResponse
- #list_flags(request_options: {}, **params) ⇒ Schematic::Features::Types::ListFlagsResponse
- #update_feature(request_options: {}, **params) ⇒ Schematic::Features::Types::UpdateFeatureResponse
- #update_flag(request_options: {}, **params) ⇒ Schematic::Features::Types::UpdateFlagResponse
- #update_flag_rules(request_options: {}, **params) ⇒ Schematic::Features::Types::UpdateFlagRulesResponse
- #upsert_feature_for_billing_product(request_options: {}, **params) ⇒ Schematic::Features::Types::UpsertFeatureForBillingProductResponse
Constructor Details
#initialize(client:) ⇒ void
9 10 11 |
# File 'lib/schematic/features/client.rb', line 9 def initialize(client:) @client = client end |
Instance Method Details
#check_flag(request_options: {}, **params) ⇒ Schematic::Features::Types::CheckFlagResponse
508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 |
# File 'lib/schematic/features/client.rb', line 508 def check_flag(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "flags/#{URI.encode_uri_component(params[:key].to_s)}/check", body: Schematic::Types::CheckFlagRequestBody.new(params).to_h, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Schematic::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Schematic::Features::Types::CheckFlagResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#check_flags(request_options: {}, **params) ⇒ Schematic::Features::Types::CheckFlagsResponse
540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 |
# File 'lib/schematic/features/client.rb', line 540 def check_flags(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "flags/check", body: Schematic::Types::CheckFlagRequestBody.new(params).to_h, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Schematic::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Schematic::Features::Types::CheckFlagsResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#check_flags_bulk(request_options: {}, **params) ⇒ Schematic::Features::Types::CheckFlagsBulkResponse
572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 |
# File 'lib/schematic/features/client.rb', line 572 def check_flags_bulk(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "flags/check-bulk", body: Schematic::Features::Types::CheckFlagsBulkRequestBody.new(params).to_h, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Schematic::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Schematic::Features::Types::CheckFlagsBulkResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#count_features(request_options: {}, **params) ⇒ Schematic::Features::Types::CountFeaturesResponse
250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 |
# File 'lib/schematic/features/client.rb', line 250 def count_features(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[boolean_require_event feature_type ids plan_version_id q without_company_override_for without_plan_entitlement_for limit offset] query_params = {} query_params["boolean_require_event"] = params[:boolean_require_event] if params.key?(:boolean_require_event) query_params["feature_type"] = params[:feature_type] if params.key?(:feature_type) query_params["ids"] = params[:ids] if params.key?(:ids) query_params["plan_version_id"] = params[:plan_version_id] if params.key?(:plan_version_id) query_params["q"] = params[:q] if params.key?(:q) query_params["without_company_override_for"] = params[:without_company_override_for] if params.key?(:without_company_override_for) query_params["without_plan_entitlement_for"] = params[:without_plan_entitlement_for] if params.key?(:without_plan_entitlement_for) query_params["limit"] = params[:limit] if params.key?(:limit) query_params["offset"] = params[:offset] if params.key?(:offset) params.except(*query_param_names) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "features/count", query: query_params, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Schematic::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Schematic::Features::Types::CountFeaturesResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#count_flags(request_options: {}, **params) ⇒ Schematic::Features::Types::CountFlagsResponse
609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 |
# File 'lib/schematic/features/client.rb', line 609 def count_flags(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[feature_id ids q limit offset] query_params = {} query_params["feature_id"] = params[:feature_id] if params.key?(:feature_id) query_params["ids"] = params[:ids] if params.key?(:ids) query_params["q"] = params[:q] if params.key?(:q) query_params["limit"] = params[:limit] if params.key?(:limit) query_params["offset"] = params[:offset] if params.key?(:offset) params.except(*query_param_names) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "flags/count", query: query_params, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Schematic::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Schematic::Features::Types::CountFlagsResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#create_feature(request_options: {}, **params) ⇒ Schematic::Features::Types::CreateFeatureResponse
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/schematic/features/client.rb', line 76 def create_feature(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "features", body: Schematic::Features::Types::CreateFeatureRequestBody.new(params).to_h, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Schematic::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Schematic::Features::Types::CreateFeatureResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#create_flag(request_options: {}, **params) ⇒ Schematic::Features::Types::CreateFlagResponse
341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 |
# File 'lib/schematic/features/client.rb', line 341 def create_flag(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "flags", body: Schematic::Types::CreateFlagRequestBody.new(params).to_h, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Schematic::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Schematic::Features::Types::CreateFlagResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#delete_feature(request_options: {}, **params) ⇒ Schematic::Features::Types::DeleteFeatureResponse
178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 |
# File 'lib/schematic/features/client.rb', line 178 def delete_feature(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "DELETE", path: "features/#{URI.encode_uri_component(params[:feature_id].to_s)}", request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Schematic::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Schematic::Features::Types::DeleteFeatureResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#delete_flag(request_options: {}, **params) ⇒ Schematic::Features::Types::DeleteFlagResponse
439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 |
# File 'lib/schematic/features/client.rb', line 439 def delete_flag(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "DELETE", path: "flags/#{URI.encode_uri_component(params[:flag_id].to_s)}", request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Schematic::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Schematic::Features::Types::DeleteFlagResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#get_feature(request_options: {}, **params) ⇒ Schematic::Features::Types::GetFeatureResponse
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/schematic/features/client.rb', line 109 def get_feature(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "features/#{URI.encode_uri_component(params[:feature_id].to_s)}", request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Schematic::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Schematic::Features::Types::GetFeatureResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#get_flag(request_options: {}, **params) ⇒ Schematic::Features::Types::GetFlagResponse
374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 |
# File 'lib/schematic/features/client.rb', line 374 def get_flag(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "flags/#{URI.encode_uri_component(params[:flag_id].to_s)}", request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Schematic::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Schematic::Features::Types::GetFlagResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#list_features(request_options: {}, **params) ⇒ Schematic::Features::Types::ListFeaturesResponse
31 32 33 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 |
# File 'lib/schematic/features/client.rb', line 31 def list_features(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[boolean_require_event feature_type ids plan_version_id q without_company_override_for without_plan_entitlement_for limit offset] query_params = {} query_params["boolean_require_event"] = params[:boolean_require_event] if params.key?(:boolean_require_event) query_params["feature_type"] = params[:feature_type] if params.key?(:feature_type) query_params["ids"] = params[:ids] if params.key?(:ids) query_params["plan_version_id"] = params[:plan_version_id] if params.key?(:plan_version_id) query_params["q"] = params[:q] if params.key?(:q) query_params["without_company_override_for"] = params[:without_company_override_for] if params.key?(:without_company_override_for) query_params["without_plan_entitlement_for"] = params[:without_plan_entitlement_for] if params.key?(:without_plan_entitlement_for) query_params["limit"] = params[:limit] if params.key?(:limit) query_params["offset"] = params[:offset] if params.key?(:offset) params.except(*query_param_names) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "features", query: query_params, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Schematic::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Schematic::Features::Types::ListFeaturesResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#list_flags(request_options: {}, **params) ⇒ Schematic::Features::Types::ListFlagsResponse
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 329 330 |
# File 'lib/schematic/features/client.rb', line 300 def list_flags(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[feature_id ids q limit offset] query_params = {} query_params["feature_id"] = params[:feature_id] if params.key?(:feature_id) query_params["ids"] = params[:ids] if params.key?(:ids) query_params["q"] = params[:q] if params.key?(:q) query_params["limit"] = params[:limit] if params.key?(:limit) query_params["offset"] = params[:offset] if params.key?(:offset) params.except(*query_param_names) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "flags", query: query_params, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Schematic::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Schematic::Features::Types::ListFlagsResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#update_feature(request_options: {}, **params) ⇒ Schematic::Features::Types::UpdateFeatureResponse
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 |
# File 'lib/schematic/features/client.rb', line 141 def update_feature(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) request_data = Schematic::Features::Types::UpdateFeatureRequestBody.new(params).to_h non_body_param_names = ["feature_id"] body = request_data.except(*non_body_param_names) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "PUT", path: "features/#{URI.encode_uri_component(params[:feature_id].to_s)}", body: body, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Schematic::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Schematic::Features::Types::UpdateFeatureResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#update_flag(request_options: {}, **params) ⇒ Schematic::Features::Types::UpdateFlagResponse
406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 |
# File 'lib/schematic/features/client.rb', line 406 def update_flag(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "PUT", path: "flags/#{URI.encode_uri_component(params[:flag_id].to_s)}", body: Schematic::Types::CreateFlagRequestBody.new(params).to_h, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Schematic::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Schematic::Features::Types::UpdateFlagResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#update_flag_rules(request_options: {}, **params) ⇒ Schematic::Features::Types::UpdateFlagRulesResponse
471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 |
# File 'lib/schematic/features/client.rb', line 471 def update_flag_rules(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) request_data = Schematic::Features::Types::UpdateFlagRulesRequestBody.new(params).to_h non_body_param_names = ["flag_id"] body = request_data.except(*non_body_param_names) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "PUT", path: "flags/#{URI.encode_uri_component(params[:flag_id].to_s)}/rules", body: body, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Schematic::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Schematic::Features::Types::UpdateFlagRulesResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#upsert_feature_for_billing_product(request_options: {}, **params) ⇒ Schematic::Features::Types::UpsertFeatureForBillingProductResponse
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 |
# File 'lib/schematic/features/client.rb', line 209 def upsert_feature_for_billing_product(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "features/billing-linked", body: Schematic::Features::Types::CreateBillingLinkedFeatureRequestBody.new(params).to_h, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Schematic::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Schematic::Features::Types::UpsertFeatureForBillingProductResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |