Skip to content

Commit

Permalink
THREESCALE-3927 made Api listing dynamic
Browse files Browse the repository at this point in the history
  • Loading branch information
nidhi-soni1104 committed Jan 4, 2023
1 parent bb07607 commit 179ac0a
Showing 1 changed file with 24 additions and 35 deletions.
59 changes: 24 additions & 35 deletions app/views/provider/admin/api_docs/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,42 +13,31 @@
<p class="InfoBox InfoBox--notice"><%= link_to 'Create an access token', provider_admin_user_access_tokens_path %> to authenticate against the Account Management API, the Analytics API and the Billing API.</p>
<% end %>

<div class='api-docs-wrap' id = "analytics-api-docs-wrap"></div>
<div class='api-docs-wrap' id = "billing-api-docs-wrap"></div>
<div class='api-docs-wrap' id = "service-management-api-docs-wrap"></div>
<div class='api-docs-wrap' id = "account-management-api-docs-wrap"></div>
<div class='api-docs-wrap' id = "policy-registry-api-docs-wrap"></div>

<div class='api-docs-wrap' id = "analytics-api-docs"></div>
<div class='api-docs-wrap' id = "billing-api-docs"></div>
<div class='api-docs-wrap' id = "service-management-api-docs"></div>
<div class='api-docs-wrap' id = "account-management-api-docs"></div>
<div class='api-docs-wrap' id = "policy-registry-api-docs"></div>

<script type="text/javascript">
(function () {
var url = "/api_docs/services/analytics_api.json";
var serviceEndpoint = "<%=j base_url.gsub(%r{/$}, '') %>"
SwaggerUI({ url: url, dom_id: "#analytics-api-docs-wrap" }, serviceEndpoint);
}());

(function () {
var url = "/api_docs/services/billing_api.json";
var serviceEndpoint = "<%=j base_url.gsub(%r{/$}, '') %>"
SwaggerUI({ url: url, dom_id: "#billing-api-docs-wrap" }, serviceEndpoint);
}());

(function () {
var url = "/api_docs/services/service_management_api.json";
var serviceEndpoint = "<%=j base_url.gsub(%r{/$}, '') %>"
SwaggerUI({ url: url, dom_id: "#service-management-api-docs-wrap" }, serviceEndpoint);
}());

(function () {
var url = "/api_docs/services/account_management_api.json";
var serviceEndpoint = "<%=j base_url.gsub(%r{/$}, '') %>"
SwaggerUI({ url: url, dom_id: "#account-management-api-docs-wrap" }, serviceEndpoint);
}());


(function () {
var url = "/api_docs/services/policy_registry_api.json";
$(function () {
let path = []
var response = '';
$.ajax({ type: "GET",
url: "<%= j api_docs_services_path %>",
async: false,
success : function(text)
{
response = text.apis;
var len = response.length
for (var i = 0; i < len; i++)
path.push(response[i].path)
}
});
path.forEach(function (url) {
var serviceEndpoint = "<%=j base_url.gsub(%r{/$}, '') %>"
SwaggerUI({ url: url, dom_id: "#policy-registry-api-docs-wrap" }, serviceEndpoint);
}());
dom_name = url.substring(url.lastIndexOf('/') + 1).replace(/\.json/g, '').replace(/\_/g, '-');
SwaggerUI({ url: url, dom_id: '#' + ''+ dom_name + '' + '-docs'}, serviceEndpoint);
});
});
</script>

0 comments on commit 179ac0a

Please sign in to comment.