esplanade 1.6.0 → 1.7.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
  SHA256:
3
- metadata.gz: f5a2030af1a5071793987d6ee1bab57942a83efd21ae68b6323de133c0667e4b
4
- data.tar.gz: 2474417384e61677938e602e48657bb8acffaeed13cdbf1593c64c4d97620f42
3
+ metadata.gz: 8c136a3d8b6813e9a5be58f5cd21ed11014290ba75aa609fe9d8ba2444326a5d
4
+ data.tar.gz: 5e38971b73680f6e33274360b52343ff459eee5910f9bb16b564751ff45e6a03
5
5
  SHA512:
6
- metadata.gz: 490ca6b622daf918b964966a523d751744923048a5ea78a7eaea7bb4fee5bd6d4623a8951d5255ba0fae49ac78eeba5bc00b6bff876f05c38d9cec88e706a170
7
- data.tar.gz: b8bfb543326e2d7789d4a1842c96ae163e1a84ba6b3118ee95b57fe53451a308429dc103f7678b613f081d61e29df9668842e2ef8c9062dcdc139bdfa80a0c65
6
+ metadata.gz: 21f291d6c57c8ef46908f9844e6fc01bc1d28590cc9817c61947fcc37309c2fca318b2d1a2a8a3756f5175c93677c2a1ef32ab0aba7f385950db505655cf36b0
7
+ data.tar.gz: 2e0384d3a06fc34cf2ba17162bfa447af7a0f35775b9fc50e0c645680b7c7da1277538a48e73dc8c3b0ff0e3ecefeba65470cdcd23383beb7832b13aa6aeaa39
@@ -23,10 +23,10 @@ jobs:
23
23
  - name: Set up Ruby
24
24
  # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
25
25
  # change this to (see https://github.com/ruby/setup-ruby#versioning):
26
- # uses: ruby/setup-ruby@v1
27
- uses: ruby/setup-ruby@ec106b438a1ff6ff109590de34ddc62c540232e0
26
+ uses: ruby/setup-ruby@v1
27
+ # uses: ruby/setup-ruby@ec106b438a1ff6ff109590de34ddc62c540232e0
28
28
  with:
29
- ruby-version: 2.6
29
+ ruby-version: 2.7
30
30
  - name: Install dependencies
31
31
  run: bundle install
32
32
  - name: Run tests
@@ -1,5 +1,10 @@
1
1
  # Change log
2
2
 
3
+ ### 1.7.0 - 2020-12-22
4
+
5
+ * improvements
6
+ * changed middleware arguments
7
+
3
8
  ### 1.6.0 - 2020-10-12
4
9
 
5
10
  * features
data/README.md CHANGED
@@ -57,7 +57,7 @@ $ gem install esplanade
57
57
  `config/application.rb`:
58
58
 
59
59
  ```ruby
60
- config.middleware.use Esplanade::SafeMiddleware, apib_path: 'doc.apib'
60
+ config.middleware.use Esplanade::SafeMiddleware, drafter_yaml_path: 'doc.yaml'
61
61
  ```
62
62
 
63
63
  ## Middlewares
@@ -72,7 +72,7 @@ It throws errors, so you should add your own middleware for processing.
72
72
 
73
73
  ```ruby
74
74
  config.middleware.use YourMiddleware
75
- config.middleware.use Esplanade::DangerousMiddleware, apib_path: 'doc.apib'
75
+ config.middleware.use Esplanade::DangerousMiddleware, drafter_yaml_path: 'doc.yaml'
76
76
  ```
77
77
 
78
78
  ### Esplanade::CheckCustomResponseMiddleware
@@ -80,9 +80,9 @@ config.middleware.use Esplanade::DangerousMiddleware, apib_path: 'doc.apib'
80
80
  Use it if you want to be sure that you have documented new custom responses.
81
81
 
82
82
  ```ruby
83
- config.middleware.use Esplanade::CheckCustomResponseMiddleware, apib_path: 'doc.apib'
83
+ config.middleware.use Esplanade::CheckCustomResponseMiddleware, drafter_yaml_path: 'doc.yaml'
84
84
  config.middleware.use YourMiddleware
85
- config.middleware.use Esplanade::DangerousMiddleware, apib_path: 'doc.apib'
85
+ config.middleware.use Esplanade::DangerousMiddleware, drafter_yaml_path: 'doc.yaml'
86
86
  ```
87
87
 
88
88
  ## Esplanade::Error
@@ -95,7 +95,7 @@ Parent class for those described below. Inherited from `Esplanade::Error`.
95
95
 
96
96
  #### Esplanade::Request::PrefixNotMatch
97
97
 
98
- Error message format:
98
+ Error message format:
99
99
 
100
100
  ```ruby
101
101
  {
@@ -169,7 +169,7 @@ Parent class for those described below. Inherited from `Esplanade::Error`.
169
169
 
170
170
  #### Esplanade::Response::PrefixNotMatch
171
171
 
172
- Error message format:
172
+ Error message format:
173
173
 
174
174
  ```ruby
175
175
  {
@@ -233,17 +233,7 @@ Error message format:
233
233
 
234
234
  ## Middleware args
235
235
 
236
- ### `apib_path`
237
-
238
- Path to API Blueprint documentation. There must be an installed [drafter](https://github.com/apiaryio/drafter) to parse it.
239
-
240
- ### `drafter_yaml_path`
241
-
242
- Path to API Blueprint documentation pre-parsed with `drafter` and saved to a YAML file.
243
-
244
- ### `prefix`
245
-
246
- Prefix for API requests. Example: `'/api'`. The prefix is added to the requests in the documentation.
236
+ Support any [tomograph constructor-params](https://github.com/funbox/tomograph/tree/master#constructor-params)
247
237
 
248
238
  ## License
249
239
 
@@ -1,11 +1,9 @@
1
1
  module Esplanade
2
2
  class Configuration
3
- attr_accessor :apib_path,
4
- :drafter_yaml_path,
5
- :prefix
3
+ attr_accessor :params
6
4
 
7
5
  def initialize
8
- @prefix = ''
6
+ @params = {}
9
7
  end
10
8
  end
11
9
  end
@@ -4,18 +4,9 @@ require 'esplanade/response'
4
4
 
5
5
  module Esplanade
6
6
  class Middleware
7
- def initialize(
8
- app,
9
- prefix: Esplanade.configuration.prefix,
10
- apib_path: Esplanade.configuration.apib_path,
11
- drafter_yaml_path: Esplanade.configuration.drafter_yaml_path
12
- )
7
+ def initialize(app, **params)
13
8
  @app = app
14
- @documentation = Tomograph::Tomogram.new(
15
- prefix: prefix,
16
- apib_path: apib_path,
17
- drafter_yaml_path: drafter_yaml_path
18
- )
9
+ @documentation = Tomograph::Tomogram.new(Esplanade.configuration.params.merge(params))
19
10
  end
20
11
 
21
12
  def call(env)
@@ -4,18 +4,9 @@ require 'esplanade/response'
4
4
 
5
5
  module Esplanade
6
6
  class CheckCustomResponseMiddleware
7
- def initialize(
8
- app,
9
- prefix: Esplanade.configuration.prefix,
10
- apib_path: Esplanade.configuration.apib_path,
11
- drafter_yaml_path: Esplanade.configuration.drafter_yaml_path
12
- )
7
+ def initialize(app, **params)
13
8
  @app = app
14
- @documentation = Tomograph::Tomogram.new(
15
- prefix: prefix,
16
- apib_path: apib_path,
17
- drafter_yaml_path: drafter_yaml_path
18
- )
9
+ @documentation = Tomograph::Tomogram.new(Esplanade.configuration.params.merge(params))
19
10
  end
20
11
 
21
12
  def call(env)
@@ -4,18 +4,9 @@ require 'esplanade/response'
4
4
 
5
5
  module Esplanade
6
6
  class DangerousMiddleware
7
- def initialize(
8
- app,
9
- prefix: Esplanade.configuration.prefix,
10
- apib_path: Esplanade.configuration.apib_path,
11
- drafter_yaml_path: Esplanade.configuration.drafter_yaml_path
12
- )
7
+ def initialize(app, **params)
13
8
  @app = app
14
- @documentation = Tomograph::Tomogram.new(
15
- prefix: prefix,
16
- apib_path: apib_path,
17
- drafter_yaml_path: drafter_yaml_path
18
- )
9
+ @documentation = Tomograph::Tomogram.new(Esplanade.configuration.params.merge(params))
19
10
  end
20
11
 
21
12
  def call(env)
@@ -4,18 +4,9 @@ require 'esplanade/response'
4
4
 
5
5
  module Esplanade
6
6
  class SafeMiddleware
7
- def initialize(
8
- app,
9
- prefix: Esplanade.configuration.prefix,
10
- apib_path: Esplanade.configuration.apib_path,
11
- drafter_yaml_path: Esplanade.configuration.drafter_yaml_path
12
- )
7
+ def initialize(app, **params)
13
8
  @app = app
14
- @documentation = Tomograph::Tomogram.new(
15
- prefix: prefix,
16
- apib_path: apib_path,
17
- drafter_yaml_path: drafter_yaml_path
18
- )
9
+ @documentation = Tomograph::Tomogram.new(Esplanade.configuration.params.merge(params))
19
10
  end
20
11
 
21
12
  def call(env)
@@ -1,3 +1,3 @@
1
1
  module Esplanade
2
- VERSION = '1.6.0'.freeze
2
+ VERSION = '1.7.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: esplanade
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - d.efimov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-10-12 00:00:00.000000000 Z
11
+ date: 2021-01-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json-schema