rspec_api_documentation 5.0.0 → 5.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eab76d5c83c6d908b0d547852bf776001916a096
4
- data.tar.gz: e104765306842544aae1e13e425df1048898490e
3
+ metadata.gz: 5b64de927068173bdb8b5090658a90cfdfdebd87
4
+ data.tar.gz: 7d671588a963248bb37ca1b86d2ccb6139c5e4d0
5
5
  SHA512:
6
- metadata.gz: 950451c2559d9a185e3afd901ce7253c8c11d47dc2dff603e210b7d38fcb591cf0f15382113919f4c6bda2b4d90488a7c9c9fd7170ce39047c2091436694259c
7
- data.tar.gz: 7f319b73f94430152e6a6d161fb63f61abfb7d2bffc73109298a7caea084325ee9deba64425880b1991a0c9d04ac025a8542448e252ff7a867947f0b68def133
6
+ metadata.gz: 45149d40631eb2c476fa099fb728da825ef831adbbe2032ae2ca07aa4b659e0950b6ac83c59568f83845c6328266a4a697ac8165308a385b2955c3a655143889
7
+ data.tar.gz: 06d59a0dd3153544799cdaa3803894f2e0210d97ff72e17812194a0b565ee5bc1b369e23ae6a66f93a8b03f54d0224024aa2adfa72d3ff774a084f5589ce795b
@@ -75,6 +75,7 @@ module RspecApiDocumentation
75
75
  add_setting :curl_host, :default => nil
76
76
  add_setting :keep_source_order, :default => false
77
77
  add_setting :api_name, :default => "API Documentation"
78
+ add_setting :api_explanation, :default => nil
78
79
  add_setting :io_docs_protocol, :default => "http"
79
80
  add_setting :request_headers_to_include, :default => nil
80
81
  add_setting :response_headers_to_include, :default => nil
@@ -69,7 +69,12 @@ module RspecApiDocumentation
69
69
  end
70
70
 
71
71
  def format_full_header(header, value)
72
- formatted_value = value ? value.gsub(/"/, "\\\"") : ''
72
+ formatted_value = if value.is_a?(Numeric)
73
+ value
74
+ else
75
+ value ? value.gsub(/"/, "\\\"") : ''
76
+ end
77
+
73
78
  "#{format_header(header)}: #{formatted_value}"
74
79
  end
75
80
 
@@ -21,7 +21,7 @@ module RspecApiDocumentation
21
21
  options = args.last.is_a?(Hash) ? args.pop : {}
22
22
  options[:api_doc_dsl] = :resource
23
23
  options[:resource_name] = args.first.to_s
24
- options[:document] ||= :all
24
+ options[:document] = :all unless options.key?(:document)
25
25
  args.push(options)
26
26
  describe(*args, &block)
27
27
  end
@@ -45,10 +45,12 @@ module RspecApiDocumentation
45
45
  end
46
46
 
47
47
  def method_name
48
- @method_name ||= begin
49
- [custom_method_name, scoped_key, key].find do |name|
50
- name && example_group.respond_to?(name)
51
- end
48
+ if custom_method_name
49
+ custom_method_name if example_group.respond_to?(custom_method_name)
50
+ elsif scoped_key && example_group.respond_to?(scoped_key)
51
+ scoped_key
52
+ elsif key && example_group.respond_to?(key)
53
+ key
52
54
  end
53
55
  end
54
56
 
@@ -3,16 +3,14 @@ require 'mustache'
3
3
  module RspecApiDocumentation
4
4
  module Views
5
5
  class MarkupIndex < Mustache
6
+ delegate :api_name, :api_explanation, to: :@configuration, prefix: false
7
+
6
8
  def initialize(index, configuration)
7
9
  @index = index
8
10
  @configuration = configuration
9
11
  self.template_path = configuration.template_path
10
12
  end
11
13
 
12
- def api_name
13
- @configuration.api_name
14
- end
15
-
16
14
  def sections
17
15
  RspecApiDocumentation::Writers::IndexHelper.sections(examples, @configuration)
18
16
  end
@@ -94,6 +94,7 @@ module RspecApiDocumentation
94
94
  {
95
95
  @api_key.to_sym => {
96
96
  :name => @configuration.api_name,
97
+ :description => @configuration.api_explanation,
97
98
  :protocol => @configuration.io_docs_protocol,
98
99
  :publicPath => "",
99
100
  :baseURL => @configuration.curl_host
@@ -10,7 +10,7 @@
10
10
  <body>
11
11
  <div class="container">
12
12
  <h1>{{ api_name }}</h1>
13
-
13
+ {{{ api_explanation }}}
14
14
  {{# sections }}
15
15
  <div class="article">
16
16
  <h2>{{ resource_name }}</h2>
@@ -1,4 +1,5 @@
1
1
  # {{ api_name }}
2
+ {{{ api_explanation }}}
2
3
 
3
4
  {{# sections }}
4
5
  ## {{ resource_name }}
@@ -1,4 +1,5 @@
1
1
  h1. {{ api_name }}
2
+ {{{ api_explanation }}}
2
3
 
3
4
  {{# sections }}
4
5
  h2. {{ resource_name }}
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.0.0
4
+ version: 5.1.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-06-06 00:00:00.000000000 Z
13
+ date: 2017-09-27 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rspec