nexmo-oas-renderer 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (128) hide show
  1. checksums.yaml +7 -0
  2. data/.env.example +1 -0
  3. data/.github/workflows/push-docker-publish.yml +19 -0
  4. data/.gitignore +6 -0
  5. data/.rspec +1 -0
  6. data/.rubocop.yml +135 -0
  7. data/.travis.yml +9 -0
  8. data/CHANGELOG.md +58 -0
  9. data/CONTRIBUTING.md +46 -0
  10. data/Dockerfile +6 -0
  11. data/Gemfile +6 -0
  12. data/Gemfile.lock +248 -0
  13. data/LICENSE.txt +21 -0
  14. data/README.md +103 -0
  15. data/Rakefile +2 -0
  16. data/bin/console +14 -0
  17. data/bin/setup +8 -0
  18. data/exe/nexmo-oas-renderer +5 -0
  19. data/lib/nexmo/oas/engine.rb +11 -0
  20. data/lib/nexmo/oas/renderer.rb +13 -0
  21. data/lib/nexmo/oas/renderer/app.rb +201 -0
  22. data/lib/nexmo/oas/renderer/config.ru +9 -0
  23. data/lib/nexmo/oas/renderer/config/code_languages.yml +138 -0
  24. data/lib/nexmo/oas/renderer/config/dynamic_content.yml +1 -0
  25. data/lib/nexmo/oas/renderer/decorators/response_parser_decorator.rb +55 -0
  26. data/lib/nexmo/oas/renderer/helpers/navigation.rb +66 -0
  27. data/lib/nexmo/oas/renderer/helpers/render.rb +25 -0
  28. data/lib/nexmo/oas/renderer/helpers/summary.rb +33 -0
  29. data/lib/nexmo/oas/renderer/helpers/url.rb +19 -0
  30. data/lib/nexmo/oas/renderer/presenters/api_specification.rb +54 -0
  31. data/lib/nexmo/oas/renderer/presenters/endpoint.rb +21 -0
  32. data/lib/nexmo/oas/renderer/presenters/groups.rb +39 -0
  33. data/lib/nexmo/oas/renderer/presenters/navigation.rb +26 -0
  34. data/lib/nexmo/oas/renderer/presenters/open_api_specification.rb +62 -0
  35. data/lib/nexmo/oas/renderer/presenters/request_body_raw.rb +141 -0
  36. data/lib/nexmo/oas/renderer/presenters/response_format.rb +29 -0
  37. data/lib/nexmo/oas/renderer/presenters/response_tab/link.rb +36 -0
  38. data/lib/nexmo/oas/renderer/presenters/response_tab/panel.rb +45 -0
  39. data/lib/nexmo/oas/renderer/presenters/response_tabs.rb +58 -0
  40. data/lib/nexmo/oas/renderer/presenters/versions.rb +51 -0
  41. data/lib/nexmo/oas/renderer/public/500.html +66 -0
  42. data/lib/nexmo/oas/renderer/public/assets/images/brands/android.svg +1 -0
  43. data/lib/nexmo/oas/renderer/public/assets/images/brands/curl.svg +1 -0
  44. data/lib/nexmo/oas/renderer/public/assets/images/brands/dotnet.svg +1 -0
  45. data/lib/nexmo/oas/renderer/public/assets/images/brands/ios.svg +1 -0
  46. data/lib/nexmo/oas/renderer/public/assets/images/brands/java.svg +1 -0
  47. data/lib/nexmo/oas/renderer/public/assets/images/brands/javascript.svg +1 -0
  48. data/lib/nexmo/oas/renderer/public/assets/images/brands/node.svg +1 -0
  49. data/lib/nexmo/oas/renderer/public/assets/images/brands/php.svg +1 -0
  50. data/lib/nexmo/oas/renderer/public/assets/images/brands/python.svg +11 -0
  51. data/lib/nexmo/oas/renderer/public/assets/images/brands/ruby.svg +1 -0
  52. data/lib/nexmo/oas/renderer/public/assets/images/lost.svg +37 -0
  53. data/lib/nexmo/oas/renderer/public/assets/javascripts/components/format.js +47 -0
  54. data/lib/nexmo/oas/renderer/public/assets/javascripts/nexmo-oas-renderer.js +65 -0
  55. data/lib/nexmo/oas/renderer/public/assets/javascripts/popper.min.js +5 -0
  56. data/lib/nexmo/oas/renderer/public/assets/javascripts/prism.js +22 -0
  57. data/lib/nexmo/oas/renderer/public/assets/javascripts/tooltip.min.js +5 -0
  58. data/lib/nexmo/oas/renderer/public/assets/javascripts/volta.accordion.js +307 -0
  59. data/lib/nexmo/oas/renderer/public/assets/javascripts/volta.core.js +230 -0
  60. data/lib/nexmo/oas/renderer/public/assets/javascripts/volta.modal.js +300 -0
  61. data/lib/nexmo/oas/renderer/public/assets/javascripts/volta.tabs.js +143 -0
  62. data/lib/nexmo/oas/renderer/public/assets/javascripts/volta.tooltip.js +76 -0
  63. data/lib/nexmo/oas/renderer/public/assets/stylesheets/nexmo-oas-renderer.css +287 -0
  64. data/lib/nexmo/oas/renderer/public/assets/stylesheets/nexmo-oas-renderer.css.map +7 -0
  65. data/lib/nexmo/oas/renderer/public/assets/stylesheets/sass/api.scss +341 -0
  66. data/lib/nexmo/oas/renderer/public/assets/stylesheets/sass/mediaqueries.scss +48 -0
  67. data/lib/nexmo/oas/renderer/public/assets/stylesheets/sass/style.scss +6 -0
  68. data/lib/nexmo/oas/renderer/public/assets/stylesheets/sass/themes/dark.scss +89 -0
  69. data/lib/nexmo/oas/renderer/public/assets/stylesheets/sass/themes/light.scss +68 -0
  70. data/lib/nexmo/oas/renderer/public/assets/stylesheets/sass/variables.scss +91 -0
  71. data/lib/nexmo/oas/renderer/public/assets/stylesheets/volta-prism.min.css +1 -0
  72. data/lib/nexmo/oas/renderer/public/assets/stylesheets/volta.min.css +1 -0
  73. data/lib/nexmo/oas/renderer/public/assets/symbol/volta-icons.svg +1 -0
  74. data/lib/nexmo/oas/renderer/public/favicon.ico +0 -0
  75. data/lib/nexmo/oas/renderer/public/fonts/Spezia-Regular.eot +0 -0
  76. data/lib/nexmo/oas/renderer/public/fonts/Spezia-Regular.ttf +0 -0
  77. data/lib/nexmo/oas/renderer/public/fonts/Spezia-Regular.woff +0 -0
  78. data/lib/nexmo/oas/renderer/public/fonts/Spezia-Regular.woff2 +0 -0
  79. data/lib/nexmo/oas/renderer/public/fonts/Spezia-SemiBold.eot +0 -0
  80. data/lib/nexmo/oas/renderer/public/fonts/Spezia-SemiBold.ttf +0 -0
  81. data/lib/nexmo/oas/renderer/public/fonts/Spezia-SemiBold.woff +0 -0
  82. data/lib/nexmo/oas/renderer/public/fonts/Spezia-SemiBold.woff2 +0 -0
  83. data/lib/nexmo/oas/renderer/public/fonts/Spezia-SemiMonoSemiBold.eot +0 -0
  84. data/lib/nexmo/oas/renderer/public/fonts/Spezia-SemiMonoSemiBold.ttf +0 -0
  85. data/lib/nexmo/oas/renderer/public/fonts/Spezia-SemiMonoSemiBold.woff +0 -0
  86. data/lib/nexmo/oas/renderer/public/fonts/Spezia-SemiMonoSemiBold.woff2 +0 -0
  87. data/lib/nexmo/oas/renderer/public/fonts/Spezia-WideMedium.eot +0 -0
  88. data/lib/nexmo/oas/renderer/public/fonts/Spezia-WideMedium.ttf +0 -0
  89. data/lib/nexmo/oas/renderer/public/fonts/Spezia-WideMedium.woff +0 -0
  90. data/lib/nexmo/oas/renderer/public/fonts/Spezia-WideMedium.woff2 +0 -0
  91. data/lib/nexmo/oas/renderer/services/oas_parser.rb +23 -0
  92. data/lib/nexmo/oas/renderer/services/open_api_definition_resolver.rb +35 -0
  93. data/lib/nexmo/oas/renderer/version.rb +9 -0
  94. data/lib/nexmo/oas/renderer/views/api/index.erb +19 -0
  95. data/lib/nexmo/oas/renderer/views/api/show.erb +1 -0
  96. data/lib/nexmo/oas/renderer/views/concepts/list/plain.html.erb +5 -0
  97. data/lib/nexmo/oas/renderer/views/layouts/_head.erb +6 -0
  98. data/lib/nexmo/oas/renderer/views/layouts/_javascripts.erb +14 -0
  99. data/lib/nexmo/oas/renderer/views/layouts/api.erb +23 -0
  100. data/lib/nexmo/oas/renderer/views/layouts/open_api.erb +12 -0
  101. data/lib/nexmo/oas/renderer/views/open_api/_auth.erb +74 -0
  102. data/lib/nexmo/oas/renderer/views/open_api/_available_endpoints.erb +25 -0
  103. data/lib/nexmo/oas/renderer/views/open_api/_callback.erb +5 -0
  104. data/lib/nexmo/oas/renderer/views/open_api/_callback_endpoint.erb +38 -0
  105. data/lib/nexmo/oas/renderer/views/open_api/_callbacks.erb +5 -0
  106. data/lib/nexmo/oas/renderer/views/open_api/_code_examples.erb +16 -0
  107. data/lib/nexmo/oas/renderer/views/open_api/_endpoint.erb +54 -0
  108. data/lib/nexmo/oas/renderer/views/open_api/_header.erb +71 -0
  109. data/lib/nexmo/oas/renderer/views/open_api/_model.erb +43 -0
  110. data/lib/nexmo/oas/renderer/views/open_api/_navigation.erb +68 -0
  111. data/lib/nexmo/oas/renderer/views/open_api/_parameter_groups.erb +56 -0
  112. data/lib/nexmo/oas/renderer/views/open_api/_parameters.erb +115 -0
  113. data/lib/nexmo/oas/renderer/views/open_api/_request_json.erb +4 -0
  114. data/lib/nexmo/oas/renderer/views/open_api/_request_one_of.erb +70 -0
  115. data/lib/nexmo/oas/renderer/views/open_api/_request_single.erb +53 -0
  116. data/lib/nexmo/oas/renderer/views/open_api/_requests.erb +22 -0
  117. data/lib/nexmo/oas/renderer/views/open_api/_response_description_parameters.erb +130 -0
  118. data/lib/nexmo/oas/renderer/views/open_api/_response_descriptions.erb +45 -0
  119. data/lib/nexmo/oas/renderer/views/open_api/_response_fields.erb +3 -0
  120. data/lib/nexmo/oas/renderer/views/open_api/_response_tabs.erb +18 -0
  121. data/lib/nexmo/oas/renderer/views/open_api/_responses.erb +51 -0
  122. data/lib/nexmo/oas/renderer/views/open_api/_tabbed_parameters.erb +64 -0
  123. data/lib/nexmo/oas/renderer/views/open_api/_tabbed_single_parameter.erb +56 -0
  124. data/lib/nexmo/oas/renderer/views/open_api/_webhooks.erb +30 -0
  125. data/lib/nexmo/oas/renderer/views/open_api/show.erb +26 -0
  126. data/lib/nexmo/oas/renderer/views/static/404.erb +6 -0
  127. data/nexmo-oas-renderer.gemspec +51 -0
  128. metadata +397 -0
@@ -0,0 +1,45 @@
1
+ <%
2
+ responses = endpoint.responses.select do |response|
3
+ next false unless response.success?
4
+ next false unless response.content
5
+ true
6
+ end
7
+
8
+ return unless responses.size.positive?
9
+ %>
10
+ <h4>Responses</h4>
11
+
12
+ <% responses.each do |response| %>
13
+ <% id = SecureRandom.hex %>
14
+ <div class="Vlt-accordion--chevron-left">
15
+ <div role="button" style="padding: 12px;" class="response-description-toggle Vlt-bg-<%= response.code[0] == "2" ? 'green' : 'red' %> Vlt-accordion__trigger Vlt-js-accordion__trigger Nxd-accordion-button" data-accordion="acc<%= id %>">
16
+ <strong><%= response.code %></strong> <%= response.description %>
17
+ </div>
18
+
19
+ <div id="acc<%= id %>" class="Vlt-js-accordion__content <%= @specification.auto_expand_responses ? 'Vlt-js-accordion__content_open' : '' %>">
20
+ <% missing = @specification.formats.keys %>
21
+
22
+ <% response.formats.each_with_index do |format, index| %>
23
+ <% missing.delete(format) %>
24
+
25
+ <% if response.exhibits_one_of_multiple_schemas?(format) %>
26
+ <%= erb :'open_api/_response_tabs', locals: { endpoint: endpoint, format: format, response: response, content: :descriptions } %>
27
+ <% else %>
28
+ <% schema = response.schema(format) %>
29
+ <%= erb :'open_api/_response_fields', locals: { endpoint: endpoint, schema: schema, format: format, index: nil } %>
30
+ <% end %>
31
+ <% end %>
32
+
33
+ <% missing.each do |format| %>
34
+ <div class="js-format Nxd-api__response" data-format="<%= format %>">
35
+ <div class="Vlt-callout Vlt-callout--warning" style="margin-top: 8px;">
36
+ <i></i>
37
+ <div class="Vlt-callout__content">
38
+ <p>This endpoint does not support <code><%= format %></code></p>
39
+ </div>
40
+ </div>
41
+ </div>
42
+ <% end %>
43
+ </div>
44
+ </div>
45
+ <% end %>
@@ -0,0 +1,3 @@
1
+ <div class="js-format Nxd-api__response" data-format="<%= format %>">
2
+ <%= erb :'open_api/_response_description_parameters', locals: { response: response, endpoint: endpoint, schema: schema } %>
3
+ </div>
@@ -0,0 +1,18 @@
1
+ <% tabs = Nexmo::OAS::Renderer::Presenters::ResponseTabs.new(format, response, content, endpoint, theme_light: @theme_light) %>
2
+
3
+ <div class='Vlt-tabs js-format' data-format='<%= tabs.format %>'>
4
+ <div class='Vlt-tabs__header' role='tablist' aria-label='Responses'>
5
+ <% tabs.tab_links.each do |link| %>
6
+ <div role='tab' class='<%= link.css_classes %>' <% if link.data_tab_link %>data-tab-link="<%= link.data_tab_link %>"<% end %>>
7
+ <%= link.content %>
8
+ </div>
9
+ <% end %>
10
+ </div>
11
+ <div class='Vlt-tabs__content'>
12
+ <% tabs.tab_panels.each do |panel| %>
13
+ <div class='<%= panel.css_classes %>'>
14
+ <%= erb *panel.content %>
15
+ </div>
16
+ <% end %>
17
+ </div>
18
+ </div>
@@ -0,0 +1,51 @@
1
+ <h4 class="Vlt-grey-light">Example Responses</h4>
2
+
3
+ <div class="response-tabs-selector" data-tab-content="response-tabs-<%= endpoint.operationId.parameterize %>">
4
+ <% endpoint.responses.each_with_index do |response, index| %>
5
+ <span role="tab" class="<%= index === 0 ? 'Vlt-js-tabs__link_active' : '' %> Vlt-bg-<%= response.code[0] == '2' ? 'green' : response.code[0] == '3' ? 'yellow' : 'red' %> Vlt-js-tabs__link response-tabs-selector-item"><%= response.code %></span>
6
+ <% end %>
7
+ </div>
8
+
9
+ <div id="response-tabs-<%= endpoint.operationId.parameterize %>" style="margin-bottom: 64px;">
10
+ <% endpoint.responses.each_with_index do |response, index| %>
11
+ <div class="Vlt-js-tabs__panel <%= index === 0 ? 'Vlt-js-tabs__panel_active' : '' %>">
12
+
13
+ <% missing = @specification.formats.keys %>
14
+
15
+ <% response.formats.each do |format| %>
16
+ <% missing.delete(format) %>
17
+ <div class="js-format" data-format="<%= format %>">
18
+ <% if response.exhibits_one_of_multiple_schemas?(format) %>
19
+ <%= erb :'open_api/_response_tabs', locals: { format: format, endpoint: endpoint, response: response, content: :responses } %>
20
+ <% else %>
21
+ <% schema = response.schema(format) %>
22
+ <% if ['application/json', 'application/xml', 'text/xml'].include?(format) %>
23
+ <%= Nexmo::OAS::Renderer::ResponseParserDecorator.new(schema).html(format, xml_options: schema['xml'], theme_light: @theme_light) %>
24
+ <% else %>
25
+ <% content = response.description ? response.description : 'No content' %>
26
+ <pre class="language-json Vlt-prism--copy-disabled <%= @theme_light ? 'Vlt-prism--dark' : '' %>"><code><%= content %></code></pre>
27
+ <% end %>
28
+ <% end %>
29
+ </div>
30
+ <% end %>
31
+
32
+ <% if response.code == '204' %>
33
+ <% content = response.description ? response.description : 'No content' %>
34
+ <pre class="language-json Vlt-prism--copy-disabled <%= @theme_light ? 'Vlt-prism--dark' : '' %>"><code><%= content %></code></pre>
35
+ <% else %>
36
+ <% missing.each do |format| %>
37
+ <div class="js-format Nxd-api__response" data-format="<%= format %>">
38
+ <div class="Vlt-callout Vlt-callout--warning">
39
+ <i></i>
40
+ <div class="Vlt-callout__content">
41
+ <p>This endpoint does not support <code><%= format %></code></p>
42
+ </div>
43
+ </div>
44
+ </div>
45
+ <% end %>
46
+ <% end %>
47
+
48
+ </div>
49
+
50
+ <% end %>
51
+ </div>
@@ -0,0 +1,64 @@
1
+ <%
2
+ # Handle any cases where the top level of the oneOf is an allOf
3
+ schemas = schema.map do |s|
4
+ if s['allOf']
5
+ newSchema = body.handle_all_of(s)
6
+ s.each do |k,v|
7
+ newSchema[k] = v
8
+ end
9
+
10
+ next newSchema
11
+ end
12
+ s
13
+ end
14
+
15
+
16
+ panels = []
17
+
18
+ schemas.each_with_index do |schema, index|
19
+ if schema['properties']
20
+ schema['properties'] = schema['properties'].map do |name, definition|
21
+ OasParser::Property.new(self, schema, name, definition)
22
+ end
23
+ .sort_by do |prop|
24
+ prop.required ? -1 : 1
25
+ end
26
+ end
27
+
28
+ panels.push({
29
+ 'description' => schema['title'] || schema['description'],
30
+ 'parameters' => schema['properties'],
31
+ 'oneOf' => schema['oneOf'],
32
+ 'x-tab-id' => schema['x-tab-id'] || schema['title'].parameterize,
33
+ 'active' => index == 0
34
+ })
35
+ end
36
+ %>
37
+
38
+ <div class="Vlt-tabs js-format" data-format="<%= format %>">
39
+ <div class="Vlt-tabs__header" role="tablist" aria-label="Responses">
40
+ <% panels.each do |panel| %>
41
+ <div role="tab" data-tab-link="<%= panel['x-tab-id'] %>" class="Vlt-tabs__link <%= panel['active'] ? 'Vlt-tabs__link_active' : '' %>">
42
+ <%= panel['description'] %>
43
+ </div>
44
+ <% end %>
45
+ </div>
46
+ <div class="Vlt-tabs__content">
47
+ <% panels.each do |panel| %>
48
+ <div class="Vlt-tabs__panel <%= panel['active'] ? 'Vlt-tabs__panel_active' : '' %>">
49
+ <%
50
+ # Nested oneOf?
51
+ if panel['oneOf']
52
+ %>
53
+ <%= erb :'open_api/_tabbed_parameters', locals: { body: body, schema: panel['oneOf'], format: format, callback: callback } %>
54
+ <%
55
+ else
56
+ %>
57
+
58
+ <%= erb :'open_api/_parameters', locals: { parameters: panel['parameters'], callback: callback } %>
59
+ <% end %>
60
+ </div>
61
+ <% end %>
62
+ </div>
63
+ </div>
64
+
@@ -0,0 +1,56 @@
1
+ <%
2
+ # Handle any cases where the top level of the oneOf is an allOf
3
+ panels = []
4
+ oneOfId = "tabs-#{SecureRandom.hex}"
5
+
6
+ parameters.each_with_index do |parameter, index|
7
+ schema = parameter.raw
8
+ if schema['properties']
9
+ schema['properties'] = schema['properties'].map do |name, definition|
10
+ next name if name.instance_of?(OasParser::Property)
11
+ OasParser::Property.new(self, schema, name, definition)
12
+ end
13
+ .sort_by do |prop|
14
+ prop.required ? -1 : 1
15
+ end
16
+ end
17
+
18
+ panels.push({
19
+ 'description' => schema['title'] || schema['description'],
20
+ 'parameters' => schema['properties'],
21
+ 'oneOf' => schema['oneOf'],
22
+ 'x-tab-id' => "tab-#{SecureRandom.hex}",
23
+ 'active' => index == 0
24
+ })
25
+ end
26
+ %>
27
+
28
+ <div data-tab-content="<%= oneOfId %>" class="Vlt-btn-group">
29
+ <strong>Choose an option:</strong>
30
+ <ul class="Vlt-list Vlt-list--simple">
31
+ <% panels.each do |panel| %>
32
+ <li data-tab-link="<%= panel['x-tab-id'] %>" class="Vlt-js-tabs__link">
33
+ <%= panel['description'] %>
34
+ </li>
35
+ <% end %>
36
+ </ul>
37
+ </div>
38
+
39
+ <div id="<%= oneOfId %>">
40
+ <% panels.each do |panel| %>
41
+ <div class="Vlt-js-tabs__panel <%= panel['active'] ? 'Vlt-tabs__panel_active' : '' %>">
42
+ <%
43
+ # Nested oneOf?
44
+ if panel['oneOf']
45
+ %>
46
+ <%= erb :'open_api/_tabbed_parameters', locals: { parent: parent, body: body, schema: panel['oneOf'], format: format, callback: callback } %>
47
+ <%
48
+ else
49
+ %>
50
+
51
+ <%= erb :'open_api/_parameters', locals: { parent: parent, parameters: panel['parameters'], callback: callback } %>
52
+ <% end %>
53
+ </div>
54
+ <% end %>
55
+ </div>
56
+
@@ -0,0 +1,30 @@
1
+ <% if definition.raw['x-webhooks'] || definition.webhooks.size.positive? %>
2
+ <div class="Vlt-grid">
3
+ <div class="Vlt-col oas-left-panel" style="padding-bottom: 36px;">
4
+ <h2 id="webhooks">Webhooks</h2>
5
+
6
+ <p>
7
+ Webhooks are an extension of an API, but instead of your code requesting data, the API sends data to you. The data arrives in a web request to your application.
8
+ </p>
9
+ <p>To learn more about webhooks, see our <a href="/concepts/guides/webhooks">webhooks documentation</a></p>
10
+
11
+ <p>This API may send any of the webhooks documented below to the URL that you have configured. You must respond with a <code>200</code> or <code>204</code> HTTP response, or the requests will be retried</p>
12
+
13
+ </div>
14
+
15
+ <div class="Vlt-col oas-right-panel sm-hidden">&nbsp;</div>
16
+ </div>
17
+ <% end %>
18
+
19
+ <% if definition.raw['x-webhooks'] %>
20
+ <% definition.raw['x-webhooks'].each do |name, definition| %>
21
+ <% callback = OasParser::Callback.new(self, name, definition) %>
22
+ <%= erb :'open_api/_callback', locals: { callback: callback, webhook: true } %>
23
+ <% end %>
24
+ <% end %>
25
+
26
+ <% definition.webhooks.each do |webhook| %>
27
+ <% webhook.endpoints.each do |endpoint| %>
28
+ <%= erb :'open_api/_callback_endpoint', locals: { webhook: webhook, endpoint: endpoint } %>
29
+ <% end %>
30
+ <% end %>
@@ -0,0 +1,26 @@
1
+ <% definition = @specification.definition %>
2
+
3
+ <div class="theme-<%= @theme %>">
4
+ <div class="oas-wrapper Vlt-article">
5
+ <%= erb :'open_api/_navigation', locals: { definition: definition } %>
6
+ <div class="oas-left-panel full-background sm-hidden">&nbsp;</div>
7
+ <div class="oas-right-panel full-background sm-hidden">&nbsp;</div>
8
+
9
+ <%= erb :'open_api/_header', locals: { definition: definition } %>
10
+
11
+ <% @specification.groups.each do |name, endpoints| %>
12
+ <% if name %>
13
+ <% group = definition.raw['tags'].select { |tag| tag['name'].capitalize == name.capitalize }.first %>
14
+ <%= erb :'open_api/_model', locals: { group: group, endpoints: endpoints } %>
15
+ <% end %>
16
+
17
+ <% endpoints.each do |endpoint| %>
18
+ <%= erb :'open_api/_endpoint', locals: { definition: definition, endpoint: endpoint } %>
19
+ <%= erb :'open_api/_callbacks', locals: { endpoint: endpoint } %>
20
+ <% end %>
21
+ <% end %>
22
+
23
+ <%= erb :'open_api/_webhooks', locals: { definition: definition } %>
24
+
25
+ </div>
26
+ </div>
@@ -0,0 +1,6 @@
1
+ <center>
2
+ <img src="/assets/images/lost.svg" alt="" width="120">
3
+ <br><br>
4
+ <h2>This page can't be found!</h2>
5
+ <p>Click <a href="/">here</a> to go back to the start</p>
6
+ </center>
@@ -0,0 +1,51 @@
1
+ lib = File.expand_path('lib', __dir__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require 'nexmo/oas/renderer/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'nexmo-oas-renderer'
7
+ spec.version = Nexmo::OAS::Renderer::VERSION
8
+ spec.authors = ['Fabian Rodriguez']
9
+ spec.email = ['fabian.rodriguez@vonage.com']
10
+
11
+ spec.summary = 'OpenAPI Specification renderer.'
12
+ spec.homepage = 'https://github.com/Nexmo/nexmo-oas-renderer'
13
+ spec.license = 'MIT'
14
+
15
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
16
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
17
+ if spec.respond_to?(:metadata)
18
+ spec.metadata['homepage_uri'] = spec.homepage
19
+ spec.metadata['source_code_uri'] = 'https://github.com/Nexmo/nexmo-oas-renderer'
20
+ else
21
+ raise 'RubyGems 2.0 or newer is required to protect against ' \
22
+ 'public gem pushes.'
23
+ end
24
+
25
+ # Specify which files should be added to the gem when it is released.
26
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
27
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
28
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
29
+ end
30
+ spec.bindir = 'exe'
31
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
32
+ spec.require_paths = ['lib']
33
+
34
+ spec.add_runtime_dependency 'activemodel', '~> 6.0'
35
+ spec.add_runtime_dependency 'activesupport', '~> 6.0'
36
+ spec.add_runtime_dependency 'banzai', '~> 0.1.2'
37
+ spec.add_runtime_dependency 'dotenv', '~> 2.7'
38
+ spec.add_runtime_dependency 'neatjson', '~> 0.8'
39
+ spec.add_runtime_dependency 'nexmo_markdown_renderer', '~> 0.3'
40
+ spec.add_runtime_dependency 'oas_parser', '~> 0.25.1'
41
+ spec.add_runtime_dependency 'octicons_helper', '~> 8.2'
42
+ spec.add_runtime_dependency 'redcarpet', '3.4.0'
43
+ spec.add_runtime_dependency 'sass', '~> 3.1'
44
+ spec.add_runtime_dependency 'shotgun', '~> 0.9'
45
+ spec.add_runtime_dependency 'sinatra', '~> 2.0'
46
+
47
+ spec.add_development_dependency 'bundler', '~> 2.0'
48
+ spec.add_development_dependency 'rake', '~> 13.0'
49
+ spec.add_development_dependency 'rspec', '~> 3.8'
50
+ spec.add_development_dependency 'rubocop', '~> 0.86'
51
+ end
metadata ADDED
@@ -0,0 +1,397 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: nexmo-oas-renderer
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Fabian Rodriguez
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2020-07-21 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activemodel
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '6.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '6.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: activesupport
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '6.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '6.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: banzai
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 0.1.2
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 0.1.2
55
+ - !ruby/object:Gem::Dependency
56
+ name: dotenv
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '2.7'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '2.7'
69
+ - !ruby/object:Gem::Dependency
70
+ name: neatjson
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '0.8'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '0.8'
83
+ - !ruby/object:Gem::Dependency
84
+ name: nexmo_markdown_renderer
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '0.3'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '0.3'
97
+ - !ruby/object:Gem::Dependency
98
+ name: oas_parser
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 0.25.1
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 0.25.1
111
+ - !ruby/object:Gem::Dependency
112
+ name: octicons_helper
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '8.2'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '8.2'
125
+ - !ruby/object:Gem::Dependency
126
+ name: redcarpet
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - '='
130
+ - !ruby/object:Gem::Version
131
+ version: 3.4.0
132
+ type: :runtime
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - '='
137
+ - !ruby/object:Gem::Version
138
+ version: 3.4.0
139
+ - !ruby/object:Gem::Dependency
140
+ name: sass
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: '3.1'
146
+ type: :runtime
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: '3.1'
153
+ - !ruby/object:Gem::Dependency
154
+ name: shotgun
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: '0.9'
160
+ type: :runtime
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - "~>"
165
+ - !ruby/object:Gem::Version
166
+ version: '0.9'
167
+ - !ruby/object:Gem::Dependency
168
+ name: sinatra
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - "~>"
172
+ - !ruby/object:Gem::Version
173
+ version: '2.0'
174
+ type: :runtime
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - "~>"
179
+ - !ruby/object:Gem::Version
180
+ version: '2.0'
181
+ - !ruby/object:Gem::Dependency
182
+ name: bundler
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - "~>"
186
+ - !ruby/object:Gem::Version
187
+ version: '2.0'
188
+ type: :development
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - "~>"
193
+ - !ruby/object:Gem::Version
194
+ version: '2.0'
195
+ - !ruby/object:Gem::Dependency
196
+ name: rake
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - "~>"
200
+ - !ruby/object:Gem::Version
201
+ version: '13.0'
202
+ type: :development
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - "~>"
207
+ - !ruby/object:Gem::Version
208
+ version: '13.0'
209
+ - !ruby/object:Gem::Dependency
210
+ name: rspec
211
+ requirement: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - "~>"
214
+ - !ruby/object:Gem::Version
215
+ version: '3.8'
216
+ type: :development
217
+ prerelease: false
218
+ version_requirements: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - "~>"
221
+ - !ruby/object:Gem::Version
222
+ version: '3.8'
223
+ - !ruby/object:Gem::Dependency
224
+ name: rubocop
225
+ requirement: !ruby/object:Gem::Requirement
226
+ requirements:
227
+ - - "~>"
228
+ - !ruby/object:Gem::Version
229
+ version: '0.86'
230
+ type: :development
231
+ prerelease: false
232
+ version_requirements: !ruby/object:Gem::Requirement
233
+ requirements:
234
+ - - "~>"
235
+ - !ruby/object:Gem::Version
236
+ version: '0.86'
237
+ description:
238
+ email:
239
+ - fabian.rodriguez@vonage.com
240
+ executables:
241
+ - nexmo-oas-renderer
242
+ extensions: []
243
+ extra_rdoc_files: []
244
+ files:
245
+ - ".env.example"
246
+ - ".github/workflows/push-docker-publish.yml"
247
+ - ".gitignore"
248
+ - ".rspec"
249
+ - ".rubocop.yml"
250
+ - ".travis.yml"
251
+ - CHANGELOG.md
252
+ - CONTRIBUTING.md
253
+ - Dockerfile
254
+ - Gemfile
255
+ - Gemfile.lock
256
+ - LICENSE.txt
257
+ - README.md
258
+ - Rakefile
259
+ - bin/console
260
+ - bin/setup
261
+ - exe/nexmo-oas-renderer
262
+ - lib/nexmo/oas/engine.rb
263
+ - lib/nexmo/oas/renderer.rb
264
+ - lib/nexmo/oas/renderer/app.rb
265
+ - lib/nexmo/oas/renderer/config.ru
266
+ - lib/nexmo/oas/renderer/config/code_languages.yml
267
+ - lib/nexmo/oas/renderer/config/dynamic_content.yml
268
+ - lib/nexmo/oas/renderer/decorators/response_parser_decorator.rb
269
+ - lib/nexmo/oas/renderer/helpers/navigation.rb
270
+ - lib/nexmo/oas/renderer/helpers/render.rb
271
+ - lib/nexmo/oas/renderer/helpers/summary.rb
272
+ - lib/nexmo/oas/renderer/helpers/url.rb
273
+ - lib/nexmo/oas/renderer/presenters/api_specification.rb
274
+ - lib/nexmo/oas/renderer/presenters/endpoint.rb
275
+ - lib/nexmo/oas/renderer/presenters/groups.rb
276
+ - lib/nexmo/oas/renderer/presenters/navigation.rb
277
+ - lib/nexmo/oas/renderer/presenters/open_api_specification.rb
278
+ - lib/nexmo/oas/renderer/presenters/request_body_raw.rb
279
+ - lib/nexmo/oas/renderer/presenters/response_format.rb
280
+ - lib/nexmo/oas/renderer/presenters/response_tab/link.rb
281
+ - lib/nexmo/oas/renderer/presenters/response_tab/panel.rb
282
+ - lib/nexmo/oas/renderer/presenters/response_tabs.rb
283
+ - lib/nexmo/oas/renderer/presenters/versions.rb
284
+ - lib/nexmo/oas/renderer/public/500.html
285
+ - lib/nexmo/oas/renderer/public/assets/images/brands/android.svg
286
+ - lib/nexmo/oas/renderer/public/assets/images/brands/curl.svg
287
+ - lib/nexmo/oas/renderer/public/assets/images/brands/dotnet.svg
288
+ - lib/nexmo/oas/renderer/public/assets/images/brands/ios.svg
289
+ - lib/nexmo/oas/renderer/public/assets/images/brands/java.svg
290
+ - lib/nexmo/oas/renderer/public/assets/images/brands/javascript.svg
291
+ - lib/nexmo/oas/renderer/public/assets/images/brands/node.svg
292
+ - lib/nexmo/oas/renderer/public/assets/images/brands/php.svg
293
+ - lib/nexmo/oas/renderer/public/assets/images/brands/python.svg
294
+ - lib/nexmo/oas/renderer/public/assets/images/brands/ruby.svg
295
+ - lib/nexmo/oas/renderer/public/assets/images/lost.svg
296
+ - lib/nexmo/oas/renderer/public/assets/javascripts/components/format.js
297
+ - lib/nexmo/oas/renderer/public/assets/javascripts/nexmo-oas-renderer.js
298
+ - lib/nexmo/oas/renderer/public/assets/javascripts/popper.min.js
299
+ - lib/nexmo/oas/renderer/public/assets/javascripts/prism.js
300
+ - lib/nexmo/oas/renderer/public/assets/javascripts/tooltip.min.js
301
+ - lib/nexmo/oas/renderer/public/assets/javascripts/volta.accordion.js
302
+ - lib/nexmo/oas/renderer/public/assets/javascripts/volta.core.js
303
+ - lib/nexmo/oas/renderer/public/assets/javascripts/volta.modal.js
304
+ - lib/nexmo/oas/renderer/public/assets/javascripts/volta.tabs.js
305
+ - lib/nexmo/oas/renderer/public/assets/javascripts/volta.tooltip.js
306
+ - lib/nexmo/oas/renderer/public/assets/stylesheets/nexmo-oas-renderer.css
307
+ - lib/nexmo/oas/renderer/public/assets/stylesheets/nexmo-oas-renderer.css.map
308
+ - lib/nexmo/oas/renderer/public/assets/stylesheets/sass/api.scss
309
+ - lib/nexmo/oas/renderer/public/assets/stylesheets/sass/mediaqueries.scss
310
+ - lib/nexmo/oas/renderer/public/assets/stylesheets/sass/style.scss
311
+ - lib/nexmo/oas/renderer/public/assets/stylesheets/sass/themes/dark.scss
312
+ - lib/nexmo/oas/renderer/public/assets/stylesheets/sass/themes/light.scss
313
+ - lib/nexmo/oas/renderer/public/assets/stylesheets/sass/variables.scss
314
+ - lib/nexmo/oas/renderer/public/assets/stylesheets/volta-prism.min.css
315
+ - lib/nexmo/oas/renderer/public/assets/stylesheets/volta.min.css
316
+ - lib/nexmo/oas/renderer/public/assets/symbol/volta-icons.svg
317
+ - lib/nexmo/oas/renderer/public/favicon.ico
318
+ - lib/nexmo/oas/renderer/public/fonts/Spezia-Regular.eot
319
+ - lib/nexmo/oas/renderer/public/fonts/Spezia-Regular.ttf
320
+ - lib/nexmo/oas/renderer/public/fonts/Spezia-Regular.woff
321
+ - lib/nexmo/oas/renderer/public/fonts/Spezia-Regular.woff2
322
+ - lib/nexmo/oas/renderer/public/fonts/Spezia-SemiBold.eot
323
+ - lib/nexmo/oas/renderer/public/fonts/Spezia-SemiBold.ttf
324
+ - lib/nexmo/oas/renderer/public/fonts/Spezia-SemiBold.woff
325
+ - lib/nexmo/oas/renderer/public/fonts/Spezia-SemiBold.woff2
326
+ - lib/nexmo/oas/renderer/public/fonts/Spezia-SemiMonoSemiBold.eot
327
+ - lib/nexmo/oas/renderer/public/fonts/Spezia-SemiMonoSemiBold.ttf
328
+ - lib/nexmo/oas/renderer/public/fonts/Spezia-SemiMonoSemiBold.woff
329
+ - lib/nexmo/oas/renderer/public/fonts/Spezia-SemiMonoSemiBold.woff2
330
+ - lib/nexmo/oas/renderer/public/fonts/Spezia-WideMedium.eot
331
+ - lib/nexmo/oas/renderer/public/fonts/Spezia-WideMedium.ttf
332
+ - lib/nexmo/oas/renderer/public/fonts/Spezia-WideMedium.woff
333
+ - lib/nexmo/oas/renderer/public/fonts/Spezia-WideMedium.woff2
334
+ - lib/nexmo/oas/renderer/services/oas_parser.rb
335
+ - lib/nexmo/oas/renderer/services/open_api_definition_resolver.rb
336
+ - lib/nexmo/oas/renderer/version.rb
337
+ - lib/nexmo/oas/renderer/views/api/index.erb
338
+ - lib/nexmo/oas/renderer/views/api/show.erb
339
+ - lib/nexmo/oas/renderer/views/concepts/list/plain.html.erb
340
+ - lib/nexmo/oas/renderer/views/layouts/_head.erb
341
+ - lib/nexmo/oas/renderer/views/layouts/_javascripts.erb
342
+ - lib/nexmo/oas/renderer/views/layouts/api.erb
343
+ - lib/nexmo/oas/renderer/views/layouts/open_api.erb
344
+ - lib/nexmo/oas/renderer/views/open_api/_auth.erb
345
+ - lib/nexmo/oas/renderer/views/open_api/_available_endpoints.erb
346
+ - lib/nexmo/oas/renderer/views/open_api/_callback.erb
347
+ - lib/nexmo/oas/renderer/views/open_api/_callback_endpoint.erb
348
+ - lib/nexmo/oas/renderer/views/open_api/_callbacks.erb
349
+ - lib/nexmo/oas/renderer/views/open_api/_code_examples.erb
350
+ - lib/nexmo/oas/renderer/views/open_api/_endpoint.erb
351
+ - lib/nexmo/oas/renderer/views/open_api/_header.erb
352
+ - lib/nexmo/oas/renderer/views/open_api/_model.erb
353
+ - lib/nexmo/oas/renderer/views/open_api/_navigation.erb
354
+ - lib/nexmo/oas/renderer/views/open_api/_parameter_groups.erb
355
+ - lib/nexmo/oas/renderer/views/open_api/_parameters.erb
356
+ - lib/nexmo/oas/renderer/views/open_api/_request_json.erb
357
+ - lib/nexmo/oas/renderer/views/open_api/_request_one_of.erb
358
+ - lib/nexmo/oas/renderer/views/open_api/_request_single.erb
359
+ - lib/nexmo/oas/renderer/views/open_api/_requests.erb
360
+ - lib/nexmo/oas/renderer/views/open_api/_response_description_parameters.erb
361
+ - lib/nexmo/oas/renderer/views/open_api/_response_descriptions.erb
362
+ - lib/nexmo/oas/renderer/views/open_api/_response_fields.erb
363
+ - lib/nexmo/oas/renderer/views/open_api/_response_tabs.erb
364
+ - lib/nexmo/oas/renderer/views/open_api/_responses.erb
365
+ - lib/nexmo/oas/renderer/views/open_api/_tabbed_parameters.erb
366
+ - lib/nexmo/oas/renderer/views/open_api/_tabbed_single_parameter.erb
367
+ - lib/nexmo/oas/renderer/views/open_api/_webhooks.erb
368
+ - lib/nexmo/oas/renderer/views/open_api/show.erb
369
+ - lib/nexmo/oas/renderer/views/static/404.erb
370
+ - nexmo-oas-renderer.gemspec
371
+ homepage: https://github.com/Nexmo/nexmo-oas-renderer
372
+ licenses:
373
+ - MIT
374
+ metadata:
375
+ homepage_uri: https://github.com/Nexmo/nexmo-oas-renderer
376
+ source_code_uri: https://github.com/Nexmo/nexmo-oas-renderer
377
+ post_install_message:
378
+ rdoc_options: []
379
+ require_paths:
380
+ - lib
381
+ required_ruby_version: !ruby/object:Gem::Requirement
382
+ requirements:
383
+ - - ">="
384
+ - !ruby/object:Gem::Version
385
+ version: '0'
386
+ required_rubygems_version: !ruby/object:Gem::Requirement
387
+ requirements:
388
+ - - ">="
389
+ - !ruby/object:Gem::Version
390
+ version: '0'
391
+ requirements: []
392
+ rubyforge_project:
393
+ rubygems_version: 2.7.6.2
394
+ signing_key:
395
+ specification_version: 4
396
+ summary: OpenAPI Specification renderer.
397
+ test_files: []