Class: ThreeScale::API::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/3scale/api/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(http_client) ⇒ Client

Returns a new instance of Client.

Parameters:



11
12
13
# File 'lib/3scale/api/client.rb', line 11

def initialize(http_client)
  @http_client = http_client
end

Instance Attribute Details

#http_clientObject (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.

Parameters:

  • account_id (String)

    Account ID

  • application_id (String)

    Application ID

Returns:

  • (Hash)

    application Application



780
781
782
783
# File 'lib/3scale/api/client.rb', line 780

def accept_application(, application_id)
  response = http_client.put("/admin/api/accounts/#{}/applications/#{application_id}/accept")
  extract(entity: 'application', from: response)
end

#activate_user(account_id, user_id) ⇒ Hash

Parameters:

  • account_id (String)

    Account ID

  • user_id (String)

    User ID

Returns:

  • (Hash)


729
730
731
732
# File 'lib/3scale/api/client.rb', line 729

def activate_user(, user_id)
  response = http_client.put("/admin/api/accounts/#{}/users/#{user_id}/activate")
  extract(entity: 'user', from: response)
end

#application_plan_as_default(service_id, application_plan_id) ⇒ Hash

Parameters:

  • service_id (Fixnum)

    Service ID

  • application_plan_id (Fixnum)

    Application Plan ID

Returns:

  • (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

Parameters:

  • account_id (String)

    Account ID

Returns:

  • (Hash)


737
738
739
740
# File 'lib/3scale/api/client.rb', line 737

def ()
  response = http_client.put("/admin/api/accounts/#{}/approve")
  extract(entity: 'account', from: response)
end

#backend(id) ⇒ Hash

Parameters:

  • id (Fixnum)

    Backend ID

Returns:

  • (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

Parameters:

  • backend_id (Fixnum)

    Backend ID

  • mapping_rule_id (Fixnum)

    MappingRule ID

Returns:

  • (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

Parameters:

  • backend_id (Fixnum)

    Backend ID

  • metric_id (Fixnum)

    Backend Metric ID

  • method_id (Fixnum)

    Backend Method ID

Returns:

  • (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

Parameters:

  • backend_id (Fixnum)

    Backend ID

  • metric_id (Fixnum)

    Backend Metric ID

Returns:

  • (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

Parameters:

  • product_id (Fixnum)

    Product ID

  • id (Fixnum)

    Backend Usage ID

Returns:

  • (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

Parameters:

  • attributes (Hash)

    ActiveDocs attributes

Returns:

  • (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.

Parameters:

  • plan_id (Fixnum)

    Application Plan ID

  • attributes (Hash) (defaults to: {})

    Application Attributes

Options Hash (attributes):

  • :name (String)

    Application Name

  • :description (String)

    Application Description

  • :user_key (String)

    Application User Key

  • :application_id (String)

    Application App ID

  • :application_key (String)

    Application App Key(s)

Returns:

  • (Hash)

    an Application



87
88
89
90
91
# File 'lib/3scale/api/client.rb', line 87

def create_application(, attributes = {}, plan_id:, **rest)
  body = { plan_id: plan_id }.merge(attributes).merge(rest)
  response = http_client.post("/admin/api/accounts/#{}/applications", body: body)
  extract(entity: 'application', from: response)
end

#create_application_key(account_id, application_id, key) ⇒ Hash

Parameters:

  • account_id (String)

    Account ID

  • application_id (String)

    Application ID

  • key (String)

    Key

Returns:

  • (Hash)


771
772
773
774
# File 'lib/3scale/api/client.rb', line 771

def create_application_key(, application_id, key)
  response = http_client.post("/admin/api/accounts/#{}/applications/#{application_id}/keys", body: {key: key})
  extract(entity: 'application', from: response)
end

#create_application_plan(service_id, attributes) ⇒ Hash

Parameters:

  • service_id (Fixnum)

    Service ID

  • attributes (Hash)

    Metric Attributes

Options Hash (attributes):

  • :name (String)

    Application Plan Name

Returns:

  • (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

Parameters:

  • application_plan_id (Fixnum)

    Application Plan ID

  • id (Fixnum)

    Feature ID

Returns:

  • (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

Parameters:

  • application_plan_id (Fixnum)

    Application Plan ID

  • metric_id (Fixnum)

    Metric ID

  • attributes (Hash)

    Limit Attributes

Returns:

  • (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

Parameters:

  • attributes (Hash)

    Backend attributes

Returns:

  • (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

Parameters:

  • backend_id (Fixnum)

    Backend ID

  • attrs (Hash)

    Metric attributes

Returns:

  • (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

Parameters:

  • backend_id (Fixnum)

    Backend ID

  • metric_id (Fixnum)

    Backend Metric ID

  • attributes (Hash)

    Metric attributes

Returns:

  • (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

Parameters:

  • id (Fixnum)

    Backend ID

  • attributes (Hash)

    Metric attributes

Returns:

  • (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

Parameters:

  • product_id (Fixnum)

    Product ID

  • attrs (Hash)

    Backend Usage attributes

Returns:

  • (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>

Parameters:

  • service_id (Fixnum)

    Service ID

  • attributes (Hash)

    Mapping Rule Attributes

Options Hash (attributes):

  • :http_method (String)

    HTTP Method

  • :pattern (String)

    Pattern

  • :delta (Fixnum)

    Increase the metric by delta.

  • :metric_id (Fixnum)

    Metric ID

Returns:

  • (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

Parameters:

  • service_id (Fixnum)

    Service ID

  • metric_id (Fixnum)

    Metric ID

  • attributes (Hash)

    Metric Attributes

Options Hash (attributes):

  • :name (String)

    Method Name

Returns:

  • (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

Parameters:

  • service_id (Fixnum)

    Service ID

  • attributes (Hash)

    Metric Attributes

Options Hash (attributes):

  • :name (String)

    Metric Name

Returns:

  • (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

Parameters:

  • attributes (Hash)

    Policy Registry Attributes

Returns:

  • (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>

Parameters:

  • application_plan_id (Fixnum)

    Application Plan ID

Returns:

  • (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

Parameters:

  • attributes (Hash)

    Service Attributes

Options Hash (attributes):

  • :name (String)

    Service Name

Returns:

  • (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

Parameters:

  • id (Fixnum)

    Service ID

  • attributes (Hash)

    Feature Attributes

Returns:

  • (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

Parameters:

  • account_id (String)

    Account ID

  • email (String)

    User email

  • username (String)

    User Username

  • password (String)

    User password

  • attributes (Hash)

    User Attributes

Returns:

  • (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/#{}/users", body: body)
  extract(entity: 'user', from: response)
end

#customize_application_plan(account_id, application_id) ⇒ Hash

Returns a Plan.

Parameters:

  • account_id (Fixnum)

    Account ID

  • application_id (Fixnum)

    Application ID

Returns:

  • (Hash)

    a Plan



107
108
109
110
# File 'lib/3scale/api/client.rb', line 107

def customize_application_plan(, application_id)
  response = http_client.put("/admin/api/accounts/#{}/applications/#{application_id}/customize_plan")
  extract(entity: 'application_plan', from: response)
end

#delete_account(id) ⇒ Bool

Parameters:

  • id (Fixnum)

    Account ID

Returns:

  • (Bool)


596
597
598
599
# File 'lib/3scale/api/client.rb', line 596

def (id)
  http_client.delete("/admin/api/accounts/#{id}")
  true
end

#delete_activedocs(id) ⇒ Hash

Returns:

  • (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

Parameters:

  • account_id (Fixnum)

    Account ID

  • id (Fixnum)

    Application ID

Returns:

  • (Bool)


605
606
607
608
# File 'lib/3scale/api/client.rb', line 605

def delete_application(, id)
  http_client.delete("/admin/api/accounts/#{}/applications/#{id}")
  true
end

#delete_application_plan(service_id, application_plan_id) ⇒ Bool

Parameters:

  • service_id (Fixnum)

    Service ID

  • application_plan_id (Fixnum)

    Application Plan ID

Returns:

  • (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.

Parameters:

  • account_id (Fixnum)

    Account ID

  • application_id (Fixnum)

    Application ID

Returns:

  • (Hash)

    a Plan



116
117
118
119
# File 'lib/3scale/api/client.rb', line 116

def delete_application_plan_customization(, application_id)
  response = http_client.put("/admin/api/accounts/#{}/applications/#{application_id}/decustomize_plan")
  extract(entity: 'application_plan', from: response)
end

#delete_application_plan_feature(application_plan_id, id) ⇒ Boolean

Parameters:

  • application_plan_id (Fixnum)

    Application Plan ID

  • id (Fixnum)

    Feature ID

Returns:

  • (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

Parameters:

  • application_plan_id (Fixnum)

    Application Plan ID

  • metric_id (Fixnum)

    Metric ID

  • limit_id (Fixnum)

    Usage Limit ID



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

Parameters:

  • application_plan_id (Fixnum)

    Application Plan ID

  • metric_id (Fixnum)

    Metric ID

  • id (Fixnum)

    Rule ID

Returns:

  • (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

Parameters:

  • id (Fixnum)

    Backend ID



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

Parameters:

  • backend_id (Fixnum)

    Backend ID

  • mapping_rule_id (Fixnum)

    MappingRule ID



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

Parameters:

  • backend_id (Fixnum)

    Backend ID

  • metric_id (Fixnum)

    Backend Metric ID

  • method_id (Fixnum)

    Backend Method ID



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

Parameters:

  • backend_id (Fixnum)

    Backend ID

  • metric_id (Fixnum)

    Backend Metric ID



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

Parameters:

  • product_id (Fixnum)

    Product ID

  • id (Fixnum)

    Backend Usage ID



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>

Parameters:

  • service_id (Fixnum)

    Service ID

  • id (Fixnum)

    Mapping Rule ID

Returns:

  • (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

Parameters:

  • service_id (Fixnum)

    Service ID

  • parent_id (Fixnum)

    Parent metric ID

  • id (Fixnum)

    Metric ID

Returns:

  • (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

Parameters:

  • service_id (Fixnum)

    Service ID

  • metric_id (Fixnum)

    Metric ID

Returns:

  • (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

Parameters:

  • id (Fixnum)

    Policy Registry Id



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

Parameters:

  • id (Fixnum)

    Service ID



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

Parameters:

  • service_id (Fixnum)

    Service ID

  • id (Fixnum)

    Feature ID

Returns:

  • (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

Parameters:

  • criteria (Hash)

    Search parameters

Returns:

  • (Hash)


491
492
493
494
# File 'lib/3scale/api/client.rb', line 491

def (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

Parameters:

  • id (Fixnum) (defaults to: nil)

    Application ID

  • user_key (String) (defaults to: nil)

    Application User Key

  • application_id (String) (defaults to: nil)

    Application app_id

Returns:

  • (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>

Parameters:

  • account_id (String)

    Account ID

Returns:

  • (Array<Hash>)


745
746
747
748
# File 'lib/3scale/api/client.rb', line 745

def ()
  response = http_client.get("/admin/api/accounts/#{}/applications")
  extract(collection: 'applications', entity: 'application', from: response)
end

#list_accountsArray<Hash>

Returns:

  • (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_activedocsArray<Hash>

Returns:

  • (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>

Parameters:

  • account_id (String)

    Account ID

  • application_id (String)

    Application ID

Returns:

  • (Array<Hash>)


761
762
763
764
# File 'lib/3scale/api/client.rb', line 761

def list_application_keys(, application_id)
  response = http_client.get("/admin/api/accounts/#{}/applications/#{application_id}/keys")
  extract(collection: 'keys', entity: 'key', from: response)
end

#list_application_plan_limits(application_plan_id) ⇒ Array<Hash>

Parameters:

  • application_plan_id (Fixnum)

    Application Plan ID

Returns:

  • (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_plansArray<Hash]

Returns Array<Hash].

Returns:

  • (Array<Hash])

    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>

Parameters:

  • service_id (Fixnum) (defaults to: nil)

    Service ID

  • plan_id (Fixnum) (defaults to: nil)

    Application Plan ID

Returns:

  • (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>

Parameters:

  • account_id (Fixnum)

    Account ID

Returns:

  • (Array<Hash>)


50
51
52
53
# File 'lib/3scale/api/client.rb', line 50

def ()
  response = http_client.get("/admin/api/accounts/#{}/applications")
  extract(collection: 'applications', entity: 'application', from: response)
end

#list_backend_mapping_rules(backend_id) ⇒ List

Parameters:

  • backend_id (Fixnum)

    Backend ID

Returns:

  • (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

Parameters:

  • backend_id (Fixnum)

    Backend ID

  • metric_id (Fixnum)

    Backend Metric ID

Returns:

  • (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

Parameters:

  • id (Fixnum)

    Backend ID

Returns:

  • (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

Parameters:

  • product_id (Fixnum)

    Product ID

Returns:

  • (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

Returns:

  • (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>

Parameters:

  • application_plan_id (Fixnum)

    Application Plan ID

Returns:

  • (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>

Parameters:

  • service_id (Fixnum)

    Service ID

Returns:

  • (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>

Parameters:

  • service_id (Fixnum)

    Service ID

  • metric_id (Fixnum)

    Metric ID

Returns:

  • (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

Parameters:

  • application_plan_id (Fixnum)

    Application Plan ID

  • metric_id (Fixnum)

    Metric ID

Returns:

  • (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>

Parameters:

  • service_id (Fixnum)

    Service ID

Returns:

  • (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_registryArray<Hash>

Returns:

  • (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>

Parameters:

  • application_plan_id (Fixnum)

    Application Plan ID

Returns:

  • (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>

Parameters:

  • application_plan_id (Fixnum)

    Application Plan ID

  • metric_id (Fixnum)

    Metric ID

Returns:

  • (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>

Parameters:

  • service_id (Fixnum)

    Service ID

Returns:

  • (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>

Parameters:

  • id (Fixnum)

    Service ID

Returns:

  • (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>

Returns:

  • (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>

Parameters:

  • account_id (Fixnum)

    Account ID

  • state (String) (defaults to: nil)

    State

  • role (String) (defaults to: nil)

    Role

Returns:

  • (Array<Hash>)


706
707
708
709
710
# File 'lib/3scale/api/client.rb', line 706

def list_users(, state: nil, role: nil)
  params = { state: state, role: role }.reject { |_, value| value.nil? }
  response = http_client.get("/admin/api/accounts/#{}/users", params: params)
  extract(collection: 'users', entity: 'user', from: response)
end

#promote_proxy_config(service_id, environment, version, to) ⇒ Hash

Parameters:

  • service_id (Fixnum)

    Service ID

  • environment (String)

    Must be ‘sandbox’ or ‘production’

  • version (Fixnum)

    Version to promote

  • to (Fixnum)

    To which the specified proxy configuration will be promoted to

Returns:

  • (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

Parameters:

  • service_id (Fixnum)

    Service ID

  • environment. (String)

    Must be ‘sandbox’ or ‘production’

Returns:

  • (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

Parameters:

  • service_id (Fixnum)

    Service ID

  • environment. (String)

    Must be ‘sandbox’ or ‘production’

Returns:

  • (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

Parameters:

  • service_id (Fixnum)

    Service ID

Returns:

  • (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.

Parameters:

  • account_id (String)

    Account ID

  • application_id (String)

    Application ID

Returns:

  • (Hash)

    application Application



798
799
800
801
# File 'lib/3scale/api/client.rb', line 798

def resume_application(, application_id)
  response = http_client.put("/admin/api/accounts/#{}/applications/#{application_id}/resume")
  extract(entity: 'application', from: response)
end

#show_account(id) ⇒ Hash

Parameters:

  • id (Fixnum)

    Account Id

Returns:

  • (Hash)


499
500
501
502
# File 'lib/3scale/api/client.rb', line 499

def (id)
  response = http_client.get("/admin/api/accounts/#{id}")
  extract(entity: 'account', from: response)
end

#show_application(id) ⇒ Hash

Parameters:

  • id (Fixnum)

    Application ID

Returns:

  • (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

Parameters:

  • service_id (Fixnum)

    Service ID

  • id (Fixnum)

    Application Plan ID

Returns:

  • (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>

Parameters:

  • service_id (Fixnum)

    Service ID

  • id (Fixnum)

    Mapping Rule ID

Returns:

  • (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

Parameters:

  • service_id (Fixnum)

    Service ID

  • parent_id (Fixnum)

    Parent metric ID

  • id (Fixnum)

    Method ID

Returns:

  • (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

Parameters:

  • service_id (Fixnum)

    Service ID

  • id (Fixnum)

    Metric ID

Returns:

  • (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>

Parameters:

  • service_id (Fixnum)

    Service ID

Returns:

  • (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

Parameters:

  • id (Fixnum)

    Service ID

Returns:

  • (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

Parameters:

  • id (Fixnum)

    Policy Registry Id

Returns:

  • (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_providerHash

Returns:

  • (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

Parameters:

  • service_id (Fixnum)

    Service ID

Returns:

  • (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

Parameters:

  • service_id (Fixnum)

    Service ID

  • environment. (String)

    Must be ‘sandbox’ or ‘production’

  • version (Fixnum)

    Proxy configuration version

Returns:

  • (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

Parameters:

  • id (Fixnum)

    Service ID

Returns:

  • (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

Parameters:

  • service_id (Fixnum)

    Service ID

  • id (Fixnum)

    Feature ID

Returns:

  • (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.

Parameters:

  • name (String)

    Account Name

  • username (String)

    User Username

  • attributes (Hash) (defaults to: {})

    User and Account Attributes

Options Hash (attributes):

  • :email (String)

    User Email

  • :password (String)

    User Password

  • :account_plan_id (String)

    Account Plan ID

  • :service_plan_id (String)

    Service Plan ID

  • :application_plan_id (String)

    Application Plan ID

Returns:

  • (Hash)

    an Account



131
132
133
134
135
136
# File 'lib/3scale/api/client.rb', line 131

def (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.

Parameters:

  • account_id (String)

    Account ID

  • application_id (String)

    Application ID

Returns:

  • (Hash)

    application Application



789
790
791
792
# File 'lib/3scale/api/client.rb', line 789

def suspend_application(, application_id)
  response = http_client.put("/admin/api/accounts/#{}/applications/#{application_id}/suspend")
  extract(entity: 'application', from: response)
end

#update_activedocs(id, attributes) ⇒ Hash

Parameters:

  • id (Fixnum)

    ActiveDocs ID

  • attributes (Hash)

    ActiveDocs attributes

Returns:

  • (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.

Parameters:

  • account_id (Fixnum)

    Account ID

  • id (Fixnum)

    Application ID

  • attrs (Hash)

    Application Attributes

Returns:

  • (Hash)

    an Application



98
99
100
101
# File 'lib/3scale/api/client.rb', line 98

def update_application(, id, attrs)
  response = http_client.put("/admin/api/accounts/#{}/applications/#{id}", body: attrs)
  extract(entity: 'application', from: response)
end

#update_application_plan(service_id, id, attributes) ⇒ Hash

Parameters:

  • service_id (Fixnum)

    Service ID

  • id (Fixnum)

    Application Plan ID

  • attributes (Hash)

    Application Plan Attributes

Returns:

  • (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

Parameters:

  • application_plan_id (Fixnum)

    Application Plan ID

  • metric_id (Fixnum)

    Metric ID

  • limit_id (Fixnum)

    Usage Limit ID

  • attributes (Hash)

    Limit Attributes

Returns:

  • (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

Parameters:

  • id (Fixnum)

    Backend ID

  • attributes (Hash)

    Backend attributes

Returns:

  • (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

Parameters:

  • backend_id (Fixnum)

    Backend ID

  • mapping_rule_id (Fixnum)

    MappingRule ID

  • attributes (Hash)

    Backend attributes

Returns:

  • (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

Parameters:

  • backend_id (Fixnum)

    Backend ID

  • metric_id (Fixnum)

    Backend Metric ID

  • method_id (Fixnum)

    Backend Method ID

  • attributes (Hash)

    Backend attributes

Returns:

  • (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

Parameters:

  • backend_id (Fixnum)

    Backend ID

  • metric_id (Fixnum)

    Backend Metric ID

  • attributes (Hash)

    Backend attributes

Returns:

  • (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

Parameters:

  • product_id (Fixnum)

    Product ID

  • id (Fixnum)

    Backend Usage ID

  • attrs (Hash)

    Backend Usage attributes

Returns:

  • (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>

Parameters:

  • service_id (Fixnum)

    Service ID

  • id (Fixnum)

    Mapping Rule ID

  • attributes (Hash)

    Mapping Rule Attributes

Options Hash (attributes):

  • :http_method (String)

    HTTP Method

  • :pattern (String)

    Pattern

  • :delta (Fixnum)

    Increase the metric by delta.

  • :metric_id (Fixnum)

    Metric ID

Returns:

  • (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

Parameters:

  • service_id (Fixnum)

    Service ID

  • parent_id (Fixnum)

    Parent metric ID

  • id (Fixnum)

    Method ID

  • attributes (Hash)

    Method Attributes

Returns:

  • (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

Parameters:

  • service_id (Fixnum)

    Service ID

  • metric_id (Fixnum)

    Metric ID

  • attributes (Hash)

    Metric Attributes

Options Hash (attributes):

  • :friendly_name (String)

    Metric Name

  • :unit (String)

    Metric unit

  • :description (String)

    Metric description

Returns:

  • (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

Parameters:

  • service_id (Fixnum)

    Service ID

Returns:

  • (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

Parameters:

  • id (Fixnum)

    Service ID

Returns:

  • (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

Parameters:

  • id (Fixnum)

    Policy Registry Id

  • attributes (Hash)

    Policy Registry Attributes

Returns:

  • (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

Parameters:

  • service_id (Fixnum)

    Service ID

Returns:

  • (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

Parameters:

  • service_id (Fixnum)

    Service ID

  • attributes (Hash)

    Service Attributes

Options Hash (attributes):

  • :name (String)

    Service Name

Returns:

  • (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

Parameters:

  • service_id (Fixnum)

    Service ID

  • id (Fixnum)

    Feature ID

  • attributes (Hash)

    Feature Attributes

Returns:

  • (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