rspec_api_documentation 5.1.0 → 6.0.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.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rspec_api_documentation.rb +26 -1
  3. data/lib/rspec_api_documentation/api_documentation.rb +2 -0
  4. data/lib/rspec_api_documentation/configuration.rb +11 -1
  5. data/lib/rspec_api_documentation/dsl/endpoint.rb +33 -1
  6. data/lib/rspec_api_documentation/dsl/endpoint/params.rb +19 -3
  7. data/lib/rspec_api_documentation/dsl/endpoint/set_param.rb +12 -1
  8. data/lib/rspec_api_documentation/dsl/resource.rb +23 -0
  9. data/lib/rspec_api_documentation/open_api/contact.rb +9 -0
  10. data/lib/rspec_api_documentation/open_api/example.rb +7 -0
  11. data/lib/rspec_api_documentation/open_api/header.rb +12 -0
  12. data/lib/rspec_api_documentation/open_api/headers.rb +7 -0
  13. data/lib/rspec_api_documentation/open_api/helper.rb +29 -0
  14. data/lib/rspec_api_documentation/open_api/info.rb +12 -0
  15. data/lib/rspec_api_documentation/open_api/license.rb +8 -0
  16. data/lib/rspec_api_documentation/open_api/node.rb +112 -0
  17. data/lib/rspec_api_documentation/open_api/operation.rb +18 -0
  18. data/lib/rspec_api_documentation/open_api/parameter.rb +33 -0
  19. data/lib/rspec_api_documentation/open_api/path.rb +13 -0
  20. data/lib/rspec_api_documentation/open_api/paths.rb +7 -0
  21. data/lib/rspec_api_documentation/open_api/response.rb +10 -0
  22. data/lib/rspec_api_documentation/open_api/responses.rb +9 -0
  23. data/lib/rspec_api_documentation/open_api/root.rb +21 -0
  24. data/lib/rspec_api_documentation/open_api/schema.rb +15 -0
  25. data/lib/rspec_api_documentation/open_api/security_definitions.rb +7 -0
  26. data/lib/rspec_api_documentation/open_api/security_schema.rb +14 -0
  27. data/lib/rspec_api_documentation/open_api/tag.rb +9 -0
  28. data/lib/rspec_api_documentation/views/api_blueprint_example.rb +15 -3
  29. data/lib/rspec_api_documentation/views/api_blueprint_index.rb +17 -2
  30. data/lib/rspec_api_documentation/views/markdown_example.rb +1 -1
  31. data/lib/rspec_api_documentation/views/markup_example.rb +8 -3
  32. data/lib/rspec_api_documentation/views/slate_index.rb +4 -0
  33. data/lib/rspec_api_documentation/writers/combined_json_writer.rb +1 -1
  34. data/lib/rspec_api_documentation/writers/json_iodocs_writer.rb +2 -2
  35. data/lib/rspec_api_documentation/writers/json_writer.rb +6 -6
  36. data/lib/rspec_api_documentation/writers/markdown_writer.rb +1 -1
  37. data/lib/rspec_api_documentation/writers/open_api_writer.rb +244 -0
  38. data/lib/rspec_api_documentation/writers/slate_writer.rb +2 -8
  39. data/templates/rspec_api_documentation/api_blueprint_index.mustache +6 -5
  40. data/templates/rspec_api_documentation/slate_index.mustache +8 -0
  41. metadata +57 -3
@@ -21,17 +21,11 @@ module RspecApiDocumentation
21
21
  def write
22
22
  File.open(configuration.docs_dir.join("#{FILENAME}.#{extension}"), 'w+') do |file|
23
23
 
24
- file.write %Q{---\n}
25
- file.write %Q{title: "#{configuration.api_name}"\n}
26
- file.write %Q{language_tabs:\n}
27
- file.write %Q{ - json: JSON\n}
28
- file.write %Q{ - shell: cURL\n}
29
- file.write %Q{---\n\n}
24
+ file.write markup_index_class.new(index, configuration).render
30
25
 
31
26
  IndexHelper.sections(index.examples, @configuration).each do |section|
32
-
33
27
  file.write "# #{section[:resource_name]}\n\n"
34
- section[:examples].sort_by!(&:description) unless configuration.keep_source_order
28
+ file.write "#{section[:resource_explanation]}\n\n"
35
29
 
36
30
  section[:examples].each do |example|
37
31
  markup_example = markup_example_class.new(example, configuration)
@@ -1,4 +1,5 @@
1
- FORMAT: A1
1
+ FORMAT: 1A
2
+ # {{ api_name }}
2
3
  {{# sections }}
3
4
 
4
5
  # Group {{ resource_name }}
@@ -48,13 +49,13 @@ explanation: {{ explanation }}
48
49
 
49
50
  + Headers
50
51
 
51
- {{{ request_headers_text }}}
52
+ {{{ request_headers_text }}}
52
53
  {{/ request_headers_text }}
53
54
  {{# request_body }}
54
55
 
55
56
  + Body
56
57
 
57
- {{{ request_body }}}
58
+ {{{ request_body }}}
58
59
  {{/ request_body }}
59
60
  {{# has_response? }}
60
61
 
@@ -64,13 +65,13 @@ explanation: {{ explanation }}
64
65
 
65
66
  + Headers
66
67
 
67
- {{{ response_headers_text }}}
68
+ {{{ response_headers_text }}}
68
69
  {{/ response_headers_text }}
69
70
  {{# response_body }}
70
71
 
71
72
  + Body
72
73
 
73
- {{{ response_body }}}
74
+ {{{ response_body }}}
74
75
  {{/ response_body }}
75
76
  {{/ requests }}
76
77
  {{/ examples }}
@@ -0,0 +1,8 @@
1
+ ---
2
+ title: {{ api_name }}
3
+ language_tabs:
4
+ - json: JSON
5
+ - shell: cURL
6
+ ---
7
+
8
+ {{{ api_explanation }}}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec_api_documentation
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.1.0
4
+ version: 6.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Cahoon
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2017-09-27 00:00:00.000000000 Z
13
+ date: 2018-08-23 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rspec
@@ -252,6 +252,40 @@ dependencies:
252
252
  - - ">="
253
253
  - !ruby/object:Gem::Version
254
254
  version: 1.6.3
255
+ - !ruby/object:Gem::Dependency
256
+ name: nokogiri
257
+ requirement: !ruby/object:Gem::Requirement
258
+ requirements:
259
+ - - "~>"
260
+ - !ruby/object:Gem::Version
261
+ version: '1.8'
262
+ - - ">="
263
+ - !ruby/object:Gem::Version
264
+ version: 1.8.2
265
+ type: :development
266
+ prerelease: false
267
+ version_requirements: !ruby/object:Gem::Requirement
268
+ requirements:
269
+ - - "~>"
270
+ - !ruby/object:Gem::Version
271
+ version: '1.8'
272
+ - - ">="
273
+ - !ruby/object:Gem::Version
274
+ version: 1.8.2
275
+ - !ruby/object:Gem::Dependency
276
+ name: yard
277
+ requirement: !ruby/object:Gem::Requirement
278
+ requirements:
279
+ - - ">="
280
+ - !ruby/object:Gem::Version
281
+ version: 0.9.11
282
+ type: :development
283
+ prerelease: false
284
+ version_requirements: !ruby/object:Gem::Requirement
285
+ requirements:
286
+ - - ">="
287
+ - !ruby/object:Gem::Version
288
+ version: 0.9.11
255
289
  description: Generate API docs from your test suite
256
290
  email:
257
291
  - chris@smartlogicsolutions.com
@@ -279,6 +313,25 @@ files:
279
313
  - lib/rspec_api_documentation/http_test_client.rb
280
314
  - lib/rspec_api_documentation/index.rb
281
315
  - lib/rspec_api_documentation/oauth2_mac_client.rb
316
+ - lib/rspec_api_documentation/open_api/contact.rb
317
+ - lib/rspec_api_documentation/open_api/example.rb
318
+ - lib/rspec_api_documentation/open_api/header.rb
319
+ - lib/rspec_api_documentation/open_api/headers.rb
320
+ - lib/rspec_api_documentation/open_api/helper.rb
321
+ - lib/rspec_api_documentation/open_api/info.rb
322
+ - lib/rspec_api_documentation/open_api/license.rb
323
+ - lib/rspec_api_documentation/open_api/node.rb
324
+ - lib/rspec_api_documentation/open_api/operation.rb
325
+ - lib/rspec_api_documentation/open_api/parameter.rb
326
+ - lib/rspec_api_documentation/open_api/path.rb
327
+ - lib/rspec_api_documentation/open_api/paths.rb
328
+ - lib/rspec_api_documentation/open_api/response.rb
329
+ - lib/rspec_api_documentation/open_api/responses.rb
330
+ - lib/rspec_api_documentation/open_api/root.rb
331
+ - lib/rspec_api_documentation/open_api/schema.rb
332
+ - lib/rspec_api_documentation/open_api/security_definitions.rb
333
+ - lib/rspec_api_documentation/open_api/security_schema.rb
334
+ - lib/rspec_api_documentation/open_api/tag.rb
282
335
  - lib/rspec_api_documentation/rack_test_client.rb
283
336
  - lib/rspec_api_documentation/railtie.rb
284
337
  - lib/rspec_api_documentation/test_server.rb
@@ -305,6 +358,7 @@ files:
305
358
  - lib/rspec_api_documentation/writers/json_iodocs_writer.rb
306
359
  - lib/rspec_api_documentation/writers/json_writer.rb
307
360
  - lib/rspec_api_documentation/writers/markdown_writer.rb
361
+ - lib/rspec_api_documentation/writers/open_api_writer.rb
308
362
  - lib/rspec_api_documentation/writers/slate_writer.rb
309
363
  - lib/rspec_api_documentation/writers/textile_writer.rb
310
364
  - lib/rspec_api_documentation/writers/writer.rb
@@ -315,6 +369,7 @@ files:
315
369
  - templates/rspec_api_documentation/markdown_example.mustache
316
370
  - templates/rspec_api_documentation/markdown_index.mustache
317
371
  - templates/rspec_api_documentation/slate_example.mustache
372
+ - templates/rspec_api_documentation/slate_index.mustache
318
373
  - templates/rspec_api_documentation/textile_example.mustache
319
374
  - templates/rspec_api_documentation/textile_index.mustache
320
375
  homepage: http://smartlogicsolutions.com
@@ -342,4 +397,3 @@ signing_key:
342
397
  specification_version: 4
343
398
  summary: A double black belt for your docs
344
399
  test_files: []
345
- has_rdoc: