nexmo-oas-renderer 0.1.2 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '058f40793d74dc93cce14fa241242607b42cbe23117ff400cb7916383bd42e2c'
4
- data.tar.gz: c7452cfaafee70b93cb3d9c407ab73ebc60c0f7af877b644786a6b496667c8a3
3
+ metadata.gz: 74ab38d6725f9113a464d5eedab93d7c0a8aaf0160c60b515b533ac67b860a14
4
+ data.tar.gz: 2a0a788701f84b2dd015dccbb1ebbef3003f54b07f14c8832616296767182031
5
5
  SHA512:
6
- metadata.gz: 0f2387494071872069663a4903d783c34b17a3b73345372fc39b20c7d8ac4d909f740e456a10bcd26029612185675bb8a0e8f7e3d787c65a6c669d89b1483f65
7
- data.tar.gz: 80f56b9cbb076e5bf82714ba7c94f70ffa463961ac7005be85a7052c96f4ec8711d207b6be38b116f9b1c277ec97f46f8fdcc1f80295713f9291d8b7fcab075d
6
+ metadata.gz: 88a603360bf33afe9104ba0904db0b0f27d55518032aaaa75ff3bbe27c1c28bdf7f4ca79ecef0713dbde0d41508d365d5db0f9688850521c8f537202df4ca5d3
7
+ data.tar.gz: 7591f8a1fccd77af7256295ffc67b56a908c00f8903461f05d6e82db1d4c1580e26de290df3a0e22bf85496b71fa3bbeed1c7675a1e39cd74fafc42b41794df4
data/.env.example CHANGED
@@ -1 +1,2 @@
1
- OAS_PATH='../nexmo-developer'
1
+ OAS_PATH='../api-specification'
2
+ OAS_CI=true
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- nexmo-oas-renderer (0.1.1)
4
+ nexmo-oas-renderer (0.1.2)
5
5
  activemodel (~> 5.2)
6
6
  activesupport (~> 5.2)
7
7
  banzai (~> 0.1.2)
@@ -107,7 +107,7 @@ GEM
107
107
  octicons_helper (8.5.0)
108
108
  octicons (= 8.5.0)
109
109
  rails
110
- public_suffix (3.0.3)
110
+ public_suffix (3.1.0)
111
111
  rack (2.0.7)
112
112
  rack-protection (2.0.5)
113
113
  rack
@@ -167,9 +167,9 @@ GEM
167
167
  tilt (2.0.9)
168
168
  tzinfo (1.2.5)
169
169
  thread_safe (~> 0.1)
170
- websocket-driver (0.7.0)
170
+ websocket-driver (0.7.1)
171
171
  websocket-extensions (>= 0.1.0)
172
- websocket-extensions (0.1.3)
172
+ websocket-extensions (0.1.4)
173
173
 
174
174
  PLATFORMS
175
175
  ruby
data/README.md CHANGED
@@ -22,7 +22,7 @@ Install the gem:
22
22
  $ gem install nexmo-oas-renderer
23
23
  ```
24
24
 
25
- And simply run the executable:
25
+ And simply run the executable with the corresponding env variables set (see [Note](#note)):
26
26
  ``` shell
27
27
  $ nexmo-oas-renderer
28
28
  ```
@@ -64,10 +64,11 @@ $ cp .env.example .env
64
64
  and assign values to the corresponding variables.
65
65
 
66
66
  #### Note
67
- The app won't boot if the env variable `OAS_PATH` is not set. This variable indicates the path to the documents that will be rendered.
67
+ The env variable `OAS_PATH` indicates the path to the documents that will be rendered.
68
+ Set `OAS_CI` to true to treat all the OAS docs under `OAS_PATH` as valid.
68
69
 
69
70
  ## Contributing
70
71
  We ❤️ contributions from everyone! [Bug reports](https://github.com/Nexmo/nexmo-oas-renderer/issues), [bug fixes](https://github.com/Nexmo/nexmo-oas-renderer/pulls) and feedback on the library is always appreciated. Look at the [Contributor Guidelines](https://github.com/Nexmo/nexmo-oas-renderer/blob/master/CONTRIBUTING.md) for more information and please follow the [GitHub Flow](https://guides.github.com/introduction/flow/index.html).
71
72
 
72
73
  ## License
73
- This project is under the [MIT LICENSE](https://github.com/Nexmo/nexmo-oas-renderer/blob/master/LICENSE).
74
+ This project is under the [MIT LICENSE](https://github.com/Nexmo/nexmo-oas-renderer/blob/master/LICENSE).
@@ -70,6 +70,16 @@ module Nexmo
70
70
  not_found erb :'static/404', layout: layout
71
71
  end
72
72
 
73
+ unless defined?(NexmoDeveloper::Application)
74
+ get '/' do
75
+ prefix = "#{API.oas_path}definitions"
76
+ @definitions = Dir.glob("#{prefix}/**/*.yml").map do |d|
77
+ d.gsub("#{prefix}/", '').gsub('.yml', '')
78
+ end.sort.reject { |d| d.include? 'common/' }
79
+ erb :'api/index', layout: false
80
+ end
81
+ end
82
+
73
83
  get '(/api)/*definition' do
74
84
  check_redirect!
75
85
 
@@ -1,7 +1,7 @@
1
1
  module Nexmo
2
2
  module OAS
3
3
  module Renderer
4
- VERSION = "0.1.2"
4
+ VERSION = "0.2.0"
5
5
  end
6
6
  end
7
7
  end
@@ -0,0 +1,19 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <%= erb :'layouts/_head' %>
4
+
5
+ <body class="Nxd-template">
6
+ <main class="Vlt-main Vlt-main--light Nxd-main" tabindex="2">
7
+ <div class="Vlt-card" id="primary-content">
8
+ <h1>Choose a definition</h1>
9
+ <ul class="Vlt-list Vlt-list--simple">
10
+ <% @definitions.each do |d| %>
11
+ <li><a href="<%= d %>"><%= d %></a></li>
12
+ <% end %>
13
+ </ul>
14
+ </div>
15
+ </main>
16
+
17
+ <%= erb :"layouts/_javascripts" %>
18
+ </body>
19
+ </html>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nexmo-oas-renderer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fabian Rodriguez
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-06-18 00:00:00.000000000 Z
11
+ date: 2019-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sinatra
@@ -339,6 +339,7 @@ files:
339
339
  - lib/nexmo/oas/renderer/services/oas_parser.rb
340
340
  - lib/nexmo/oas/renderer/services/open_api_definition_resolver.rb
341
341
  - lib/nexmo/oas/renderer/version.rb
342
+ - lib/nexmo/oas/renderer/views/api/index.erb
342
343
  - lib/nexmo/oas/renderer/views/api/show.erb
343
344
  - lib/nexmo/oas/renderer/views/code_snippets/_application_messages_dispatch.html.erb
344
345
  - lib/nexmo/oas/renderer/views/code_snippets/_application_rtc.html.erb