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
621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 |
# File 'lib/schematic/features/client.rb', line 621 def check_flag(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) path_param_names = %i[key] body_params = params.except(*path_param_names) 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(body_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
659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 |
# File 'lib/schematic/features/client.rb', line 659 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
694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 |
# File 'lib/schematic/features/client.rb', line 694 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
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 335 336 337 |
# File 'lib/schematic/features/client.rb', line 304 def count_features(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) 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) 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
740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 |
# File 'lib/schematic/features/client.rb', line 740 def count_flags(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) 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) 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
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/schematic/features/client.rb', line 97 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
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 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
208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 |
# File 'lib/schematic/features/client.rb', line 208 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
527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 |
# File 'lib/schematic/features/client.rb', line 527 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
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 |
# File 'lib/schematic/features/client.rb', line 133 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
446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 |
# File 'lib/schematic/features/client.rb', line 446 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
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 72 73 74 75 76 77 78 79 |
# File 'lib/schematic/features/client.rb', line 46 def list_features(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) 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) 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
362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 |
# File 'lib/schematic/features/client.rb', line 362 def list_flags(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) 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) 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
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 |
# File 'lib/schematic/features/client.rb', line 168 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 = %w[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
488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 |
# File 'lib/schematic/features/client.rb', line 488 def update_flag(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) path_param_names = %i[flag_id] body_params = params.except(*path_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)}", body: Schematic::Types::CreateFlagRequestBody.new(body_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
581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 |
# File 'lib/schematic/features/client.rb', line 581 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 = %w[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
248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 |
# File 'lib/schematic/features/client.rb', line 248 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 |