Class: ThreeScale::API::Client
- Inherits:
-
Object
- Object
- ThreeScale::API::Client
- Defined in:
- lib/3scale/api/client.rb
Instance Attribute Summary collapse
-
#http_client ⇒ Object
readonly
Returns the value of attribute http_client.
Instance Method Summary collapse
-
#accept_application(account_id, application_id) ⇒ Hash
Application Application.
- #activate_user(account_id, user_id) ⇒ Hash
- #application_plan_as_default(service_id, application_plan_id) ⇒ Hash
- #approve_account(account_id) ⇒ Hash
- #backend(id) ⇒ Hash
- #backend_mapping_rule(backend_id, mapping_rule_id) ⇒ Hash
- #backend_method(backend_id, metric_id, method_id) ⇒ Hash
- #backend_metric(backend_id, metric_id) ⇒ Hash
- #backend_usage(product_id, id) ⇒ Hash
- #create_activedocs(attributes) ⇒ Hash
-
#create_application(account_id, attributes = {}, plan_id:, **rest) ⇒ Hash
An Application.
- #create_application_key(account_id, application_id, key) ⇒ Hash
- #create_application_plan(service_id, attributes) ⇒ Hash
- #create_application_plan_feature(application_plan_id, id) ⇒ Hash
- #create_application_plan_limit(application_plan_id, metric_id, attributes) ⇒ Hash
- #create_backend(attributes) ⇒ Hash
- #create_backend_mapping_rule(backend_id, attrs) ⇒ Hash
- #create_backend_method(backend_id, metric_id, attrs) ⇒ Hash
- #create_backend_metric(id, attrs) ⇒ Hash
- #create_backend_usage(product_id, attrs) ⇒ Hash
- #create_mapping_rule(service_id, attributes) ⇒ Array<Hash>
- #create_method(service_id, metric_id, attributes) ⇒ Hash
- #create_metric(service_id, attributes) ⇒ Hash
- #create_policy_registry(attributes) ⇒ Hash
- #create_pricingrule(application_plan_id, metric_id, attributes) ⇒ Array<Hash>
- #create_service(attributes) ⇒ Hash
- #create_service_feature(id, attributes) ⇒ Hash
- #create_user(account_id:, email:, username:, password:, **rest) ⇒ Hash
-
#customize_application_plan(account_id, application_id) ⇒ Hash
A Plan.
- #delete_account(id) ⇒ Bool
- #delete_activedocs(id) ⇒ Hash
- #delete_application(account_id, id) ⇒ Bool
- #delete_application_plan(service_id, application_plan_id) ⇒ Bool
-
#delete_application_plan_customization(account_id, application_id) ⇒ Hash
A Plan.
- #delete_application_plan_feature(application_plan_id, id) ⇒ Boolean
- #delete_application_plan_limit(application_plan_id, metric_id, limit_id) ⇒ Object
- #delete_application_plan_pricingrule(application_plan_id, metric_id, id) ⇒ Bool
- #delete_backend(id) ⇒ Object
- #delete_backend_mapping_rule(backend_id, mapping_rule_id) ⇒ Object
- #delete_backend_method(backend_id, metric_id, method_id) ⇒ Object
- #delete_backend_metric(backend_id, metric_id) ⇒ Object
- #delete_backend_usage(product_id, id) ⇒ Object
- #delete_mapping_rule(service_id, id) ⇒ Array<Hash>
- #delete_method(service_id, parent_id, id) ⇒ Bool
- #delete_metric(service_id, metric_id) ⇒ Bool
- #delete_policy_registry(id) ⇒ Object
- #delete_service(id) ⇒ Object
- #delete_service_feature(service_id, id) ⇒ Boolean
- #find_account(criteria) ⇒ Hash
- #find_application(id: nil, user_key: nil, application_id: nil, service_id: nil) ⇒ Hash
-
#initialize(http_client) ⇒ Client
constructor
A new instance of Client.
- #list_account_applications(account_id) ⇒ Array<Hash>
- #list_accounts ⇒ Array<Hash>
- #list_activedocs ⇒ Array<Hash>
- #list_application_keys(account_id, application_id) ⇒ Array<Hash>
- #list_application_plan_limits(application_plan_id) ⇒ Array<Hash>
-
#list_application_plans ⇒ Array<Hash]
Array<Hash].
- #list_applications(service_id: nil, plan_id: nil) ⇒ Array<Hash>
- #list_applications_by_account(account_id) ⇒ Array<Hash>
- #list_backend_mapping_rules(backend_id) ⇒ List
- #list_backend_methods(backend_id, metric_id) ⇒ List
- #list_backend_metrics(id) ⇒ List
- #list_backend_usages(product_id) ⇒ List
- #list_backends(params = nil) ⇒ List
- #list_features_per_application_plan(application_plan_id) ⇒ Array<Hash>
- #list_mapping_rules(service_id) ⇒ Array<Hash>
- #list_methods(service_id, metric_id) ⇒ Array<Hash>
- #list_metric_limits(application_plan_id, metric_id) ⇒ Hash
- #list_metrics(service_id) ⇒ Array<Hash>
- #list_policy_registry ⇒ Array<Hash>
- #list_pricingrules_per_application_plan(application_plan_id) ⇒ Array<Hash>
- #list_pricingrules_per_metric(application_plan_id, metric_id) ⇒ Array<Hash>
- #list_service_application_plans(service_id) ⇒ Array<Hash>
- #list_service_features(id) ⇒ Array<Hash>
- #list_services(params = nil) ⇒ Array<Hash>
- #list_users(account_id, state: nil, role: nil) ⇒ Array<Hash>
- #promote_proxy_config(service_id, environment, version, to) ⇒ Hash
- #proxy_config_latest(service_id, environment = 'sandbox') ⇒ Hash
- #proxy_config_list(service_id, environment = 'sandbox') ⇒ Hash
- #proxy_deploy(service_id) ⇒ Hash
-
#resume_application(account_id, application_id) ⇒ Hash
Application Application.
- #show_account(id) ⇒ Hash
- #show_application(id) ⇒ Hash
- #show_application_plan(service_id, id) ⇒ Hash
- #show_mapping_rule(service_id, id) ⇒ Array<Hash>
- #show_method(service_id, parent_id, id) ⇒ Hash
- #show_metric(service_id, id) ⇒ Hash
- #show_oidc(service_id) ⇒ Array<Hash>
- #show_policies(id) ⇒ Array
- #show_policy_registry(id) ⇒ Hash
- #show_provider ⇒ Hash
- #show_proxy(service_id) ⇒ Hash
- #show_proxy_config(service_id, environment, version) ⇒ Hash
- #show_service(id) ⇒ Hash
- #show_service_feature(service_id, id) ⇒ Hash
-
#signup(attributes = {}, name:, username:, **rest) ⇒ Hash
An Account.
-
#suspend_application(account_id, application_id) ⇒ Hash
Application Application.
- #update_activedocs(id, attributes) ⇒ Hash
-
#update_application(account_id, id, attrs) ⇒ Hash
An Application.
- #update_application_plan(service_id, id, attributes) ⇒ Hash
- #update_application_plan_limit(application_plan_id, metric_id, limit_id, attributes) ⇒ Hash
- #update_backend(id, attributes) ⇒ Hash
- #update_backend_mapping_rule(backend_id, mapping_rule_id, attributes) ⇒ Hash
- #update_backend_method(backend_id, metric_id, method_id, attributes) ⇒ Hash
- #update_backend_metric(backend_id, metric_id, attributes) ⇒ Hash
- #update_backend_usage(product_id, id, attrs) ⇒ Hash
- #update_mapping_rule(service_id, id, attributes) ⇒ Array<Hash>
- #update_method(service_id, parent_id, id, attributes) ⇒ Hash
- #update_metric(service_id, metric_id, attributes) ⇒ Hash
- #update_oidc(service_id, attributes) ⇒ Hash
- #update_policies(id, policies_config) ⇒ Array
- #update_policy_registry(id, attributes) ⇒ Hash
- #update_proxy(service_id, attributes) ⇒ Hash
- #update_service(service_id, attributes) ⇒ Hash
- #update_service_feature(service_id, id, attributes) ⇒ Hash
Constructor Details
#initialize(http_client) ⇒ Client
Returns a new instance of Client.
11 12 13 |
# File 'lib/3scale/api/client.rb', line 11 def initialize(http_client) @http_client = http_client end |
Instance Attribute Details
#http_client ⇒ Object (readonly)
Returns the value of attribute http_client.
7 8 9 |
# File 'lib/3scale/api/client.rb', line 7 def http_client @http_client end |
Instance Method Details
#accept_application(account_id, application_id) ⇒ Hash
Returns application Application.
780 781 782 783 |
# File 'lib/3scale/api/client.rb', line 780 def accept_application(account_id, application_id) response = http_client.put("/admin/api/accounts/#{account_id}/applications/#{application_id}/accept") extract(entity: 'application', from: response) end |
#activate_user(account_id, user_id) ⇒ Hash
729 730 731 732 |
# File 'lib/3scale/api/client.rb', line 729 def activate_user(account_id, user_id) response = http_client.put("/admin/api/accounts/#{account_id}/users/#{user_id}/activate") extract(entity: 'user', from: response) end |
#application_plan_as_default(service_id, application_plan_id) ⇒ Hash
443 444 445 446 |
# File 'lib/3scale/api/client.rb', line 443 def application_plan_as_default(service_id, application_plan_id) response = http_client.put("/admin/api/services/#{service_id}/application_plans/#{application_plan_id}/default") extract(entity: 'application_plan', from: response) end |
#approve_account(account_id) ⇒ Hash
737 738 739 740 |
# File 'lib/3scale/api/client.rb', line 737 def approve_account(account_id) response = http_client.put("/admin/api/accounts/#{account_id}/approve") extract(entity: 'account', from: response) end |
#backend(id) ⇒ Hash
874 875 876 877 |
# File 'lib/3scale/api/client.rb', line 874 def backend(id) response = http_client.get("/admin/api/backend_apis/#{id}") extract(entity: 'backend_api', from: response) end |
#backend_mapping_rule(backend_id, mapping_rule_id) ⇒ Hash
1013 1014 1015 1016 |
# File 'lib/3scale/api/client.rb', line 1013 def backend_mapping_rule(backend_id, mapping_rule_id) response = http_client.get("/admin/api/backend_apis/#{backend_id}/mapping_rules/#{mapping_rule_id}") extract(entity: 'mapping_rule', from: response) end |
#backend_method(backend_id, metric_id, method_id) ⇒ Hash
966 967 968 969 |
# File 'lib/3scale/api/client.rb', line 966 def backend_method(backend_id, metric_id, method_id) response = http_client.get("/admin/api/backend_apis/#{backend_id}/metrics/#{metric_id}/methods/#{method_id}") extract(entity: 'method', from: response) end |
#backend_metric(backend_id, metric_id) ⇒ Hash
917 918 919 920 |
# File 'lib/3scale/api/client.rb', line 917 def backend_metric(backend_id, metric_id) response = http_client.get("/admin/api/backend_apis/#{backend_id}/metrics/#{metric_id}") extract(entity: 'metric', from: response) end |
#backend_usage(product_id, id) ⇒ Hash
1059 1060 1061 1062 |
# File 'lib/3scale/api/client.rb', line 1059 def backend_usage(product_id, id) response = http_client.get("/admin/api/services/#{product_id}/backend_usages/#{id}") extract(entity: 'backend_usage', from: response) end |
#create_activedocs(attributes) ⇒ Hash
565 566 567 568 |
# File 'lib/3scale/api/client.rb', line 565 def create_activedocs(attributes) response = http_client.post('/admin/api/active_docs', body: attributes) extract(entity: 'api_doc', from: response) end |
#create_application(account_id, attributes = {}, plan_id:, **rest) ⇒ Hash
Returns an Application.
87 88 89 90 91 |
# File 'lib/3scale/api/client.rb', line 87 def create_application(account_id, attributes = {}, plan_id:, **rest) body = { plan_id: plan_id }.merge(attributes).merge(rest) response = http_client.post("/admin/api/accounts/#{account_id}/applications", body: body) extract(entity: 'application', from: response) end |
#create_application_key(account_id, application_id, key) ⇒ Hash
771 772 773 774 |
# File 'lib/3scale/api/client.rb', line 771 def create_application_key(account_id, application_id, key) response = http_client.post("/admin/api/accounts/#{account_id}/applications/#{application_id}/keys", body: {key: key}) extract(entity: 'application', from: response) end |
#create_application_plan(service_id, attributes) ⇒ Hash
404 405 406 407 408 |
# File 'lib/3scale/api/client.rb', line 404 def create_application_plan(service_id, attributes) response = http_client.post("/admin/api/services/#{service_id}/application_plans", body: { application_plan: attributes }) extract(entity: 'application_plan', from: response) end |
#create_application_plan_feature(application_plan_id, id) ⇒ Hash
639 640 641 642 643 |
# File 'lib/3scale/api/client.rb', line 639 def create_application_plan_feature(application_plan_id, id) response = http_client.post("/admin/api/application_plans/#{application_plan_id}/features", body: { feature_id: id }) extract(entity: 'feature', from: response) end |
#create_application_plan_limit(application_plan_id, metric_id, attributes) ⇒ Hash
462 463 464 465 466 |
# File 'lib/3scale/api/client.rb', line 462 def create_application_plan_limit(application_plan_id, metric_id, attributes) response = http_client.post("/admin/api/application_plans/#{application_plan_id}/metrics/#{metric_id}/limits", body: { usage_limit: attributes }) extract(entity: 'limit', from: response) end |
#create_backend(attributes) ⇒ Hash
859 860 861 862 |
# File 'lib/3scale/api/client.rb', line 859 def create_backend(attributes) response = http_client.post('/admin/api/backend_apis', body: attributes) extract(entity: 'backend_api', from: response) end |
#create_backend_mapping_rule(backend_id, attrs) ⇒ Hash
995 996 997 998 999 |
# File 'lib/3scale/api/client.rb', line 995 def create_backend_mapping_rule(backend_id, attrs) response = http_client.post("/admin/api/backend_apis/#{backend_id}/mapping_rules", body: attrs) extract(entity: 'mapping_rule', from: response) end |
#create_backend_method(backend_id, metric_id, attrs) ⇒ Hash
946 947 948 949 950 |
# File 'lib/3scale/api/client.rb', line 946 def create_backend_method(backend_id, metric_id, attrs) response = http_client.post("/admin/api/backend_apis/#{backend_id}/metrics/#{metric_id}/methods", body: attrs) extract(entity: 'method', from: response) end |
#create_backend_metric(id, attrs) ⇒ Hash
900 901 902 903 |
# File 'lib/3scale/api/client.rb', line 900 def create_backend_metric(id, attrs) response = http_client.post("/admin/api/backend_apis/#{id}/metrics", body: attrs) extract(entity: 'metric', from: response) end |
#create_backend_usage(product_id, attrs) ⇒ Hash
1041 1042 1043 1044 1045 |
# File 'lib/3scale/api/client.rb', line 1041 def create_backend_usage(product_id, attrs) response = http_client.post("/admin/api/services/#{product_id}/backend_usages", body: attrs) extract(entity: 'backend_usage', from: response) end |
#create_mapping_rule(service_id, attributes) ⇒ Array<Hash>
248 249 250 251 252 |
# File 'lib/3scale/api/client.rb', line 248 def create_mapping_rule(service_id, attributes) response = http_client.post("/admin/api/services/#{service_id}/proxy/mapping_rules", body: { mapping_rule: attributes }) extract(entity: 'mapping_rule', from: response) end |
#create_method(service_id, metric_id, attributes) ⇒ Hash
365 366 367 368 369 |
# File 'lib/3scale/api/client.rb', line 365 def create_method(service_id, metric_id, attributes) response = http_client.post("/admin/api/services/#{service_id}/metrics/#{metric_id}/methods", body: { metric: attributes }) extract(entity: 'method', from: response) end |
#create_metric(service_id, attributes) ⇒ Hash
300 301 302 303 |
# File 'lib/3scale/api/client.rb', line 300 def create_metric(service_id, attributes) response = http_client.post("/admin/api/services/#{service_id}/metrics", body: { metric: attributes }) extract(entity: 'metric', from: response) end |
#create_policy_registry(attributes) ⇒ Hash
813 814 815 816 |
# File 'lib/3scale/api/client.rb', line 813 def create_policy_registry(attributes) response = http_client.post('/admin/api/registry/policies', body: attributes) extract(entity: 'policy', from: response) end |
#create_pricingrule(application_plan_id, metric_id, attributes) ⇒ Array<Hash>
540 541 542 543 |
# File 'lib/3scale/api/client.rb', line 540 def create_pricingrule(application_plan_id, metric_id, attributes) response = http_client.post("/admin/api/application_plans/#{application_plan_id}/metrics/#{metric_id}/pricing_rules", body: attributes) extract(entity: 'pricing_rule', from: response) end |
#create_service(attributes) ⇒ Hash
142 143 144 145 |
# File 'lib/3scale/api/client.rb', line 142 def create_service(attributes) response = http_client.post('/admin/api/services', body: { service: attributes }) extract(entity: 'service', from: response) end |
#create_service_feature(id, attributes) ⇒ Hash
666 667 668 669 670 |
# File 'lib/3scale/api/client.rb', line 666 def create_service_feature(id, attributes) response = http_client.post("/admin/api/services/#{id}/features", body: { feature: attributes }) extract(entity: 'feature', from: response) end |
#create_user(account_id:, email:, username:, password:, **rest) ⇒ Hash
719 720 721 722 723 |
# File 'lib/3scale/api/client.rb', line 719 def create_user(account_id:, email:, username:, password:, **rest) body = { email: email, username: username, password: password }.merge(rest) response = http_client.post("/admin/api/accounts/#{account_id}/users", body: body) extract(entity: 'user', from: response) end |
#customize_application_plan(account_id, application_id) ⇒ Hash
Returns a Plan.
107 108 109 110 |
# File 'lib/3scale/api/client.rb', line 107 def customize_application_plan(account_id, application_id) response = http_client.put("/admin/api/accounts/#{account_id}/applications/#{application_id}/customize_plan") extract(entity: 'application_plan', from: response) end |
#delete_account(id) ⇒ Bool
596 597 598 599 |
# File 'lib/3scale/api/client.rb', line 596 def delete_account(id) http_client.delete("/admin/api/accounts/#{id}") true end |
#delete_activedocs(id) ⇒ Hash
581 582 583 584 |
# File 'lib/3scale/api/client.rb', line 581 def delete_activedocs(id) http_client.delete("/admin/api/active_docs/#{id}") true end |
#delete_application(account_id, id) ⇒ Bool
605 606 607 608 |
# File 'lib/3scale/api/client.rb', line 605 def delete_application(account_id, id) http_client.delete("/admin/api/accounts/#{account_id}/applications/#{id}") true end |
#delete_application_plan(service_id, application_plan_id) ⇒ Bool
434 435 436 437 |
# File 'lib/3scale/api/client.rb', line 434 def delete_application_plan(service_id, application_plan_id) http_client.delete("/admin/api/services/#{service_id}/application_plans/#{application_plan_id}") true end |
#delete_application_plan_customization(account_id, application_id) ⇒ Hash
Returns a Plan.
116 117 118 119 |
# File 'lib/3scale/api/client.rb', line 116 def delete_application_plan_customization(account_id, application_id) response = http_client.put("/admin/api/accounts/#{account_id}/applications/#{application_id}/decustomize_plan") extract(entity: 'application_plan', from: response) end |
#delete_application_plan_feature(application_plan_id, id) ⇒ Boolean
649 650 651 652 |
# File 'lib/3scale/api/client.rb', line 649 def delete_application_plan_feature(application_plan_id, id) http_client.delete("/admin/api/application_plans/#{application_plan_id}/features/#{id}") true end |
#delete_application_plan_limit(application_plan_id, metric_id, limit_id) ⇒ Object
483 484 485 486 |
# File 'lib/3scale/api/client.rb', line 483 def delete_application_plan_limit(application_plan_id, metric_id, limit_id) http_client.delete("/admin/api/application_plans/#{application_plan_id}/metrics/#{metric_id}/limits/#{limit_id}") true end |
#delete_application_plan_pricingrule(application_plan_id, metric_id, id) ⇒ Bool
550 551 552 553 |
# File 'lib/3scale/api/client.rb', line 550 def delete_application_plan_pricingrule(application_plan_id, metric_id, id) http_client.delete("/admin/api/application_plans/#{application_plan_id}/metrics/#{metric_id}/pricing_rules/#{id}") true end |
#delete_backend(id) ⇒ Object
866 867 868 869 |
# File 'lib/3scale/api/client.rb', line 866 def delete_backend(id) http_client.delete("/admin/api/backend_apis/#{id}") true end |
#delete_backend_mapping_rule(backend_id, mapping_rule_id) ⇒ Object
1004 1005 1006 1007 |
# File 'lib/3scale/api/client.rb', line 1004 def delete_backend_mapping_rule(backend_id, mapping_rule_id) http_client.delete("/admin/api/backend_apis/#{backend_id}/mapping_rules/#{mapping_rule_id}") true end |
#delete_backend_method(backend_id, metric_id, method_id) ⇒ Object
956 957 958 959 |
# File 'lib/3scale/api/client.rb', line 956 def delete_backend_method(backend_id, metric_id, method_id) http_client.delete("/admin/api/backend_apis/#{backend_id}/metrics/#{metric_id}/methods/#{method_id}") true end |
#delete_backend_metric(backend_id, metric_id) ⇒ Object
908 909 910 911 |
# File 'lib/3scale/api/client.rb', line 908 def delete_backend_metric(backend_id, metric_id) http_client.delete("/admin/api/backend_apis/#{backend_id}/metrics/#{metric_id}") true end |
#delete_backend_usage(product_id, id) ⇒ Object
1050 1051 1052 1053 |
# File 'lib/3scale/api/client.rb', line 1050 def delete_backend_usage(product_id, id) http_client.delete("/admin/api/services/#{product_id}/backend_usages/#{id}") true end |
#delete_mapping_rule(service_id, id) ⇒ Array<Hash>
258 259 260 261 |
# File 'lib/3scale/api/client.rb', line 258 def delete_mapping_rule(service_id, id) http_client.delete("/admin/api/services/#{service_id}/proxy/mapping_rules/#{id}") true end |
#delete_method(service_id, parent_id, id) ⇒ Bool
376 377 378 379 |
# File 'lib/3scale/api/client.rb', line 376 def delete_method(service_id, parent_id, id) http_client.delete("/admin/api/services/#{service_id}/metrics/#{parent_id}/methods/#{id}") true end |
#delete_metric(service_id, metric_id) ⇒ Bool
323 324 325 326 |
# File 'lib/3scale/api/client.rb', line 323 def delete_metric(service_id, metric_id) http_client.delete("/admin/api/services/#{service_id}/metrics/#{metric_id}") true end |
#delete_policy_registry(id) ⇒ Object
837 838 839 840 |
# File 'lib/3scale/api/client.rb', line 837 def delete_policy_registry(id) http_client.delete("/admin/api/registry/policies/#{id}") true end |
#delete_service(id) ⇒ Object
32 33 34 35 |
# File 'lib/3scale/api/client.rb', line 32 def delete_service(id) http_client.delete("/admin/api/services/#{id}") true end |
#delete_service_feature(service_id, id) ⇒ Boolean
696 697 698 699 |
# File 'lib/3scale/api/client.rb', line 696 def delete_service_feature(service_id, id) http_client.delete("/admin/api/services/#{service_id}/features/#{id}") true end |
#find_account(criteria) ⇒ Hash
491 492 493 494 |
# File 'lib/3scale/api/client.rb', line 491 def find_account(criteria) response = http_client.get('/admin/api/accounts/find', params: criteria) extract(entity: 'account', from: response) end |
#find_application(id: nil, user_key: nil, application_id: nil, service_id: nil) ⇒ Hash
67 68 69 70 71 72 73 74 75 76 |
# File 'lib/3scale/api/client.rb', line 67 def find_application(id: nil, user_key: nil, application_id: nil, service_id: nil) params = { application_id: id, user_key: user_key, app_id: application_id, service_id: service_id, }.compact response = http_client.get('/admin/api/applications/find', params: params) extract(entity: 'application', from: response) end |
#list_account_applications(account_id) ⇒ Array<Hash>
745 746 747 748 |
# File 'lib/3scale/api/client.rb', line 745 def list_account_applications(account_id) response = http_client.get("/admin/api/accounts/#{account_id}/applications") extract(collection: 'applications', entity: 'application', from: response) end |
#list_accounts ⇒ Array<Hash>
588 589 590 591 |
# File 'lib/3scale/api/client.rb', line 588 def list_accounts response = http_client.get('/admin/api/accounts') extract(collection: 'accounts', entity: 'account', from: response) end |
#list_activedocs ⇒ Array<Hash>
557 558 559 560 |
# File 'lib/3scale/api/client.rb', line 557 def list_activedocs response = http_client.get('/admin/api/active_docs') extract(collection: 'api_docs', entity: 'api_doc', from: response) end |
#list_application_keys(account_id, application_id) ⇒ Array<Hash>
761 762 763 764 |
# File 'lib/3scale/api/client.rb', line 761 def list_application_keys(account_id, application_id) response = http_client.get("/admin/api/accounts/#{account_id}/applications/#{application_id}/keys") extract(collection: 'keys', entity: 'key', from: response) end |
#list_application_plan_limits(application_plan_id) ⇒ Array<Hash>
451 452 453 454 455 |
# File 'lib/3scale/api/client.rb', line 451 def list_application_plan_limits(application_plan_id) response = http_client.get("/admin/api/application_plans/#{application_plan_id}/limits") extract(collection: 'limits', entity: 'limit', from: response) end |
#list_application_plans ⇒ Array<Hash]
Returns Array<Hash].
752 753 754 755 |
# File 'lib/3scale/api/client.rb', line 752 def list_application_plans response = http_client.get("/admin/api/application_plans") extract(collection: 'plans', entity: 'application_plan', from: response) end |
#list_applications(service_id: nil, plan_id: nil) ⇒ Array<Hash>
41 42 43 44 45 |
# File 'lib/3scale/api/client.rb', line 41 def list_applications(service_id: nil, plan_id: nil) params = { service_id: service_id, plan_id: plan_id }.compact response = http_client.get('/admin/api/applications', params: params) extract(collection: 'applications', entity: 'application', from: response) end |
#list_applications_by_account(account_id) ⇒ Array<Hash>
50 51 52 53 |
# File 'lib/3scale/api/client.rb', line 50 def list_applications_by_account(account_id) response = http_client.get("/admin/api/accounts/#{account_id}/applications") extract(collection: 'applications', entity: 'application', from: response) end |
#list_backend_mapping_rules(backend_id) ⇒ List
986 987 988 989 |
# File 'lib/3scale/api/client.rb', line 986 def list_backend_mapping_rules(backend_id) response = http_client.get("/admin/api/backend_apis/#{backend_id}/mapping_rules") extract(collection: 'mapping_rules', entity: 'mapping_rule', from: response) end |
#list_backend_methods(backend_id, metric_id) ⇒ List
936 937 938 939 |
# File 'lib/3scale/api/client.rb', line 936 def list_backend_methods(backend_id, metric_id) response = http_client.get("/admin/api/backend_apis/#{backend_id}/metrics/#{metric_id}/methods") extract(collection: 'methods', entity: 'method', from: response) end |
#list_backend_metrics(id) ⇒ List
891 892 893 894 |
# File 'lib/3scale/api/client.rb', line 891 def list_backend_metrics(id) response = http_client.get("/admin/api/backend_apis/#{id}/metrics") extract(collection: 'metrics', entity: 'metric', from: response) end |
#list_backend_usages(product_id) ⇒ List
1032 1033 1034 1035 |
# File 'lib/3scale/api/client.rb', line 1032 def list_backend_usages(product_id) response = http_client.get("/admin/api/services/#{product_id}/backend_usages") extract(entity: 'backend_usage', from: response) end |
#list_backends(params = nil) ⇒ List
851 852 853 854 |
# File 'lib/3scale/api/client.rb', line 851 def list_backends(params = nil) response = http_client.get('/admin/api/backend_apis', params: params) extract(collection: 'backend_apis', entity: 'backend_api', from: response) end |
#list_features_per_application_plan(application_plan_id) ⇒ Array<Hash>
630 631 632 633 |
# File 'lib/3scale/api/client.rb', line 630 def list_features_per_application_plan(application_plan_id) response = http_client.get("/admin/api/application_plans/#{application_plan_id}/features") extract(collection: 'features', entity: 'feature', from: response) end |
#list_mapping_rules(service_id) ⇒ Array<Hash>
226 227 228 229 |
# File 'lib/3scale/api/client.rb', line 226 def list_mapping_rules(service_id) response = http_client.get("/admin/api/services/#{service_id}/proxy/mapping_rules") extract(entity: 'mapping_rule', collection: 'mapping_rules', from: response) end |
#list_methods(service_id, metric_id) ⇒ Array<Hash>
354 355 356 357 |
# File 'lib/3scale/api/client.rb', line 354 def list_methods(service_id, metric_id) response = http_client.get("/admin/api/services/#{service_id}/metrics/#{metric_id}/methods") extract(collection: 'methods', entity: 'method', from: response) end |
#list_metric_limits(application_plan_id, metric_id) ⇒ Hash
385 386 387 388 |
# File 'lib/3scale/api/client.rb', line 385 def list_metric_limits(application_plan_id, metric_id) response = http_client.get("/admin/api/application_plans/#{application_plan_id}/metrics/#{metric_id}/limits") extract(collection: 'limits', entity: 'limit', from: response) end |
#list_metrics(service_id) ⇒ Array<Hash>
290 291 292 293 |
# File 'lib/3scale/api/client.rb', line 290 def list_metrics(service_id) response = http_client.get("/admin/api/services/#{service_id}/metrics") extract(collection: 'metrics', entity: 'metric', from: response) end |
#list_policy_registry ⇒ Array<Hash>
805 806 807 808 |
# File 'lib/3scale/api/client.rb', line 805 def list_policy_registry response = http_client.get('/admin/api/registry/policies') extract(collection: 'policies', entity: 'policy', from: response) end |
#list_pricingrules_per_application_plan(application_plan_id) ⇒ Array<Hash>
532 533 534 535 |
# File 'lib/3scale/api/client.rb', line 532 def list_pricingrules_per_application_plan(application_plan_id) response = http_client.get("/admin/api/application_plans/#{application_plan_id}/pricing_rules") extract(collection: 'pricing_rules', entity: 'pricing_rule', from: response) end |
#list_pricingrules_per_metric(application_plan_id, metric_id) ⇒ Array<Hash>
524 525 526 527 |
# File 'lib/3scale/api/client.rb', line 524 def list_pricingrules_per_metric(application_plan_id, metric_id) response = http_client.get("/admin/api/application_plans/#{application_plan_id}/metrics/#{metric_id}/pricing_rules") extract(collection: 'pricing_rules', entity: 'pricing_rule', from: response) end |
#list_service_application_plans(service_id) ⇒ Array<Hash>
393 394 395 396 397 |
# File 'lib/3scale/api/client.rb', line 393 def list_service_application_plans(service_id) response = http_client.get("/admin/api/services/#{service_id}/application_plans") extract(collection: 'plans', entity: 'application_plan', from: response) end |
#list_service_features(id) ⇒ Array<Hash>
657 658 659 660 |
# File 'lib/3scale/api/client.rb', line 657 def list_service_features(id) response = http_client.get("/admin/api/services/#{id}/features") extract(collection: 'features', entity: 'feature', from: response) end |
#list_services(params = nil) ⇒ Array<Hash>
25 26 27 28 |
# File 'lib/3scale/api/client.rb', line 25 def list_services(params = nil) response = http_client.get('/admin/api/services', params: params) extract(collection: 'services', entity: 'service', from: response) end |
#list_users(account_id, state: nil, role: nil) ⇒ Array<Hash>
706 707 708 709 710 |
# File 'lib/3scale/api/client.rb', line 706 def list_users(account_id, state: nil, role: nil) params = { state: state, role: role }.reject { |_, value| value.nil? } response = http_client.get("/admin/api/accounts/#{account_id}/users", params: params) extract(collection: 'users', entity: 'user', from: response) end |
#promote_proxy_config(service_id, environment, version, to) ⇒ Hash
199 200 201 202 203 |
# File 'lib/3scale/api/client.rb', line 199 def promote_proxy_config(service_id, environment, version, to) response = http_client.post("/admin/api/services/#{service_id}/proxy/configs/#{environment}/#{version}/promote", body: { to: to }) extract(entity: 'proxy_config', from: response) end |
#proxy_config_latest(service_id, environment = 'sandbox') ⇒ Hash
178 179 180 181 |
# File 'lib/3scale/api/client.rb', line 178 def proxy_config_latest(service_id, environment = 'sandbox') response = http_client.get("/admin/api/services/#{service_id}/proxy/configs/#{environment}/latest") extract(entity: 'proxy_config', from: response) end |
#proxy_config_list(service_id, environment = 'sandbox') ⇒ Hash
169 170 171 172 |
# File 'lib/3scale/api/client.rb', line 169 def proxy_config_list(service_id, environment = 'sandbox') response = http_client.get("/admin/api/services/#{service_id}/proxy/configs/#{environment}") extract(collection: 'proxy_configs', entity: 'proxy_config', from: response) end |
#proxy_deploy(service_id) ⇒ Hash
217 218 219 220 221 |
# File 'lib/3scale/api/client.rb', line 217 def proxy_deploy(service_id) response = http_client.post("/admin/api/services/#{service_id}/proxy/deploy", body: nil) extract(entity: 'proxy', from: response) end |
#resume_application(account_id, application_id) ⇒ Hash
Returns application Application.
798 799 800 801 |
# File 'lib/3scale/api/client.rb', line 798 def resume_application(account_id, application_id) response = http_client.put("/admin/api/accounts/#{account_id}/applications/#{application_id}/resume") extract(entity: 'application', from: response) end |
#show_account(id) ⇒ Hash
499 500 501 502 |
# File 'lib/3scale/api/client.rb', line 499 def show_account(id) response = http_client.get("/admin/api/accounts/#{id}") extract(entity: 'account', from: response) end |
#show_application(id) ⇒ Hash
58 59 60 |
# File 'lib/3scale/api/client.rb', line 58 def show_application(id) find_application(id: id) end |
#show_application_plan(service_id, id) ⇒ Hash
414 415 416 417 |
# File 'lib/3scale/api/client.rb', line 414 def show_application_plan(service_id, id) response = http_client.get("/admin/api/services/#{service_id}/application_plans/#{id}") extract(entity: 'application_plan', from: response) end |
#show_mapping_rule(service_id, id) ⇒ Array<Hash>
235 236 237 238 |
# File 'lib/3scale/api/client.rb', line 235 def show_mapping_rule(service_id, id) response = http_client.get("/admin/api/services/#{service_id}/proxy/mapping_rules/#{id}") extract(entity: 'mapping_rule', from: response) end |
#show_method(service_id, parent_id, id) ⇒ Hash
333 334 335 336 |
# File 'lib/3scale/api/client.rb', line 333 def show_method(service_id, parent_id, id) response = http_client.get("/admin/api/services/#{service_id}/metrics/#{parent_id}/methods/#{id}") extract(entity: 'method', from: response) end |
#show_metric(service_id, id) ⇒ Hash
282 283 284 285 |
# File 'lib/3scale/api/client.rb', line 282 def show_metric(service_id, id) response = http_client.get("/admin/api/services/#{service_id}/metrics/#{id}") extract(entity: 'metric', from: response) end |
#show_oidc(service_id) ⇒ Array<Hash>
613 614 615 616 |
# File 'lib/3scale/api/client.rb', line 613 def show_oidc(service_id) response = http_client.get("/admin/api/services/#{service_id}/proxy/oidc_configuration") extract(entity: 'oidc_configuration', from: response) end |
#show_policies(id) ⇒ Array
507 508 509 510 |
# File 'lib/3scale/api/client.rb', line 507 def show_policies(id) response = http_client.get("/admin/api/services/#{id}/proxy/policies") extract(entity: 'policies_config', from: response) end |
#show_policy_registry(id) ⇒ Hash
821 822 823 824 |
# File 'lib/3scale/api/client.rb', line 821 def show_policy_registry(id) response = http_client.get("/admin/api/registry/policies/#{id}") extract(entity: 'policy', from: response) end |
#show_provider ⇒ Hash
844 845 846 847 |
# File 'lib/3scale/api/client.rb', line 844 def show_provider response = http_client.get('/admin/api/provider') extract(entity: 'account', from: response) end |
#show_proxy(service_id) ⇒ Hash
160 161 162 163 |
# File 'lib/3scale/api/client.rb', line 160 def show_proxy(service_id) response = http_client.get("/admin/api/services/#{service_id}/proxy") extract(entity: 'proxy', from: response) end |
#show_proxy_config(service_id, environment, version) ⇒ Hash
188 189 190 191 |
# File 'lib/3scale/api/client.rb', line 188 def show_proxy_config(service_id, environment, version) response = http_client.get("/admin/api/services/#{service_id}/proxy/configs/#{environment}/#{version}") extract(entity: 'proxy_config', from: response) end |
#show_service(id) ⇒ Hash
18 19 20 21 |
# File 'lib/3scale/api/client.rb', line 18 def show_service(id) response = http_client.get("/admin/api/services/#{id}") extract(entity: 'service', from: response) end |
#show_service_feature(service_id, id) ⇒ Hash
676 677 678 679 |
# File 'lib/3scale/api/client.rb', line 676 def show_service_feature(service_id, id) response = http_client.get("/admin/api/services/#{service_id}/features/#{id}") extract(entity: 'feature', from: response) end |
#signup(attributes = {}, name:, username:, **rest) ⇒ Hash
Returns an Account.
131 132 133 134 135 136 |
# File 'lib/3scale/api/client.rb', line 131 def signup(attributes = {}, name:, username:, **rest) body = { org_name: name, username: username }.merge(attributes).merge(rest) response = http_client.post('/admin/api/signup', body: body) extract(entity: 'account', from: response) end |
#suspend_application(account_id, application_id) ⇒ Hash
Returns application Application.
789 790 791 792 |
# File 'lib/3scale/api/client.rb', line 789 def suspend_application(account_id, application_id) response = http_client.put("/admin/api/accounts/#{account_id}/applications/#{application_id}/suspend") extract(entity: 'application', from: response) end |
#update_activedocs(id, attributes) ⇒ Hash
574 575 576 577 |
# File 'lib/3scale/api/client.rb', line 574 def update_activedocs(id, attributes) response = http_client.put("/admin/api/active_docs/#{id}", body: attributes) extract(entity: 'api_doc', from: response) end |
#update_application(account_id, id, attrs) ⇒ Hash
Returns an Application.
98 99 100 101 |
# File 'lib/3scale/api/client.rb', line 98 def update_application(account_id, id, attrs) response = http_client.put("/admin/api/accounts/#{account_id}/applications/#{id}", body: attrs) extract(entity: 'application', from: response) end |
#update_application_plan(service_id, id, attributes) ⇒ Hash
424 425 426 427 428 |
# File 'lib/3scale/api/client.rb', line 424 def update_application_plan(service_id, id, attributes) response = http_client.patch("/admin/api/services/#{service_id}/application_plans/#{id}", body: { application_plan: attributes }) extract(entity: 'application_plan', from: response) end |
#update_application_plan_limit(application_plan_id, metric_id, limit_id, attributes) ⇒ Hash
474 475 476 477 478 |
# File 'lib/3scale/api/client.rb', line 474 def update_application_plan_limit(application_plan_id, metric_id, limit_id, attributes) response = http_client.put("/admin/api/application_plans/#{application_plan_id}/metrics/#{metric_id}/limits/#{limit_id}", body: { usage_limit: attributes }) extract(entity: 'limit', from: response) end |
#update_backend(id, attributes) ⇒ Hash
883 884 885 886 |
# File 'lib/3scale/api/client.rb', line 883 def update_backend(id, attributes) response = http_client.put("/admin/api/backend_apis/#{id}", body: attributes) extract(entity: 'backend_api', from: response) end |
#update_backend_mapping_rule(backend_id, mapping_rule_id, attributes) ⇒ Hash
1023 1024 1025 1026 1027 |
# File 'lib/3scale/api/client.rb', line 1023 def update_backend_mapping_rule(backend_id, mapping_rule_id, attributes) response = http_client.put("/admin/api/backend_apis/#{backend_id}/mapping_rules/#{mapping_rule_id}", body: attributes) extract(entity: 'mapping_rule', from: response) end |
#update_backend_method(backend_id, metric_id, method_id, attributes) ⇒ Hash
977 978 979 980 981 |
# File 'lib/3scale/api/client.rb', line 977 def update_backend_method(backend_id, metric_id, method_id, attributes) response = http_client.put("/admin/api/backend_apis/#{backend_id}/metrics/#{metric_id}/methods/#{method_id}", body: attributes) extract(entity: 'method', from: response) end |
#update_backend_metric(backend_id, metric_id, attributes) ⇒ Hash
927 928 929 930 |
# File 'lib/3scale/api/client.rb', line 927 def update_backend_metric(backend_id, metric_id, attributes) response = http_client.put("/admin/api/backend_apis/#{backend_id}/metrics/#{metric_id}", body: attributes) extract(entity: 'metric', from: response) end |
#update_backend_usage(product_id, id, attrs) ⇒ Hash
1069 1070 1071 1072 1073 |
# File 'lib/3scale/api/client.rb', line 1069 def update_backend_usage(product_id, id, attrs) response = http_client.put("/admin/api/services/#{product_id}/backend_usages/#{id}", body: attrs) extract(entity: 'backend_usage', from: response) end |
#update_mapping_rule(service_id, id, attributes) ⇒ Array<Hash>
272 273 274 275 276 |
# File 'lib/3scale/api/client.rb', line 272 def update_mapping_rule(service_id, id, attributes) response = http_client.patch("/admin/api/services/#{service_id}/mapping_rules/#{id}", body: { mapping_rule: attributes }) extract(entity: 'mapping_rule', from: response) end |
#update_method(service_id, parent_id, id, attributes) ⇒ Hash
344 345 346 347 348 |
# File 'lib/3scale/api/client.rb', line 344 def update_method(service_id, parent_id, id, attributes) response = http_client.put("/admin/api/services/#{service_id}/metrics/#{parent_id}/methods/#{id}", body: { metric: attributes }) extract(entity: 'method', from: response) end |
#update_metric(service_id, metric_id, attributes) ⇒ Hash
313 314 315 316 317 |
# File 'lib/3scale/api/client.rb', line 313 def update_metric(service_id, metric_id, attributes) response = http_client.put("/admin/api/services/#{service_id}/metrics/#{metric_id}", body: { metric: attributes }) extract(entity: 'metric', from: response) end |
#update_oidc(service_id, attributes) ⇒ Hash
621 622 623 624 625 |
# File 'lib/3scale/api/client.rb', line 621 def update_oidc(service_id, attributes) response = http_client.patch("/admin/api/services/#{service_id}/proxy/oidc_configuration", body: { oidc_configuration: attributes }) extract(entity: 'oidc_configuration', from: response) end |
#update_policies(id, policies_config) ⇒ Array
515 516 517 518 |
# File 'lib/3scale/api/client.rb', line 515 def update_policies(id, policies_config) response = http_client.put("/admin/api/services/#{id}/proxy/policies", body: policies_config) extract(entity: 'policies_config', from: response) end |
#update_policy_registry(id, attributes) ⇒ Hash
830 831 832 833 |
# File 'lib/3scale/api/client.rb', line 830 def update_policy_registry(id, attributes) response = http_client.put("/admin/api/registry/policies/#{id}", body: attributes) extract(entity: 'policy', from: response) end |
#update_proxy(service_id, attributes) ⇒ Hash
208 209 210 211 212 |
# File 'lib/3scale/api/client.rb', line 208 def update_proxy(service_id, attributes) response = http_client.patch("/admin/api/services/#{service_id}/proxy", body: { proxy: attributes }) extract(entity: 'proxy', from: response) end |
#update_service(service_id, attributes) ⇒ Hash
152 153 154 155 |
# File 'lib/3scale/api/client.rb', line 152 def update_service(service_id, attributes) response = http_client.put("/admin/api/services/#{service_id}", body: { service: attributes }) extract(entity: 'service', from: response) end |
#update_service_feature(service_id, id, attributes) ⇒ Hash
686 687 688 689 690 |
# File 'lib/3scale/api/client.rb', line 686 def update_service_feature(service_id, id, attributes) response = http_client.put("/admin/api/services/#{service_id}/features/#{id}", body: { feature: attributes }) extract(entity: 'feature', from: response) end |