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
512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 |
# File 'lib/schematic/features/client.rb', line 512 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
544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 |
# File 'lib/schematic/features/client.rb', line 544 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
576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 |
# File 'lib/schematic/features/client.rb', line 576 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
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 285 286 287 288 |
# File 'lib/schematic/features/client.rb', line 253 def count_features(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[boolean_require_event feature_type ids managed_by 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["managed_by"] = params[:managed_by] if params.key?(:managed_by) 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
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 640 641 642 643 |
# File 'lib/schematic/features/client.rb', line 613 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
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/schematic/features/client.rb', line 78 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
345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 |
# File 'lib/schematic/features/client.rb', line 345 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
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 |
# File 'lib/schematic/features/client.rb', line 180 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
443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 |
# File 'lib/schematic/features/client.rb', line 443 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
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/schematic/features/client.rb', line 111 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
378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 |
# File 'lib/schematic/features/client.rb', line 378 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
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 66 67 |
# File 'lib/schematic/features/client.rb', line 32 def list_features(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[boolean_require_event feature_type ids managed_by 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["managed_by"] = params[:managed_by] if params.key?(:managed_by) 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
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 331 332 333 334 |
# File 'lib/schematic/features/client.rb', line 304 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
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 |
# File 'lib/schematic/features/client.rb', line 143 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
410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 |
# File 'lib/schematic/features/client.rb', line 410 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
475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 |
# File 'lib/schematic/features/client.rb', line 475 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
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 |
# File 'lib/schematic/features/client.rb', line 211 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 |