blueprint_agreement 0.1.2 → 0.1.3
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 +4 -4
- data/README.md +14 -12
- data/blueprint_agreement.gemspec +1 -1
- data/lib/blueprint_agreement.rb +31 -3
- data/lib/blueprint_agreement/api_services/drakov_service.rb +9 -8
- data/lib/blueprint_agreement/configuration.rb +31 -0
- data/lib/blueprint_agreement/minitest/assertions.rb +6 -6
- data/lib/blueprint_agreement/server.rb +2 -1
- data/lib/blueprint_agreement/utils/requester.rb +3 -0
- data/lib/blueprint_agreement/version.rb +1 -1
- data/test/fixtures/second_api.md +83 -0
- data/test/integration/simple_api_test.rb +30 -3
- data/test/unit_test/utils/{config_test.rb → configuration_test.rb} +2 -2
- metadata +7 -11
- data/lib/blueprint_agreement/config.rb +0 -69
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 28677ec795e7e0c8645db0290a6baf0295a9ba14
|
|
4
|
+
data.tar.gz: acf526bdeb96bec01eae55362e5487f6a95155d9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 83bf1f60ded145fe3862cba1770397cd308bb363c51d7eb1c7142a39efc9df05a845c40ea7b10d513d504e4cdb0385893d6785fac0e9b979de1e70ce84344964
|
|
7
|
+
data.tar.gz: cbe51475db42b814b050eab152411a4493060600c93c878ce8e3a043c7b9001ac4dd9caa81f01cd6edf0e5c01f323d442ae07a7f9411c668103415e4659c8f95
|
data/README.md
CHANGED
|
@@ -98,17 +98,19 @@ Body:
|
|
|
98
98
|
{"param_1": "hi"}
|
|
99
99
|
```
|
|
100
100
|
|
|
101
|
-
###
|
|
101
|
+
### Configuration
|
|
102
102
|
|
|
103
|
-
|
|
103
|
+
`config/initializer/blueprint_agreement.rb`
|
|
104
104
|
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
105
|
+
```ruby
|
|
106
|
+
BlueprintAgreement.configure do |config|
|
|
107
|
+
config.port = '8082'
|
|
108
|
+
config.server_path = '.'
|
|
109
|
+
config.exclude_attributes = ['field_name']
|
|
110
|
+
config.allow_headers = ['Authorization', 'Cookie']
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
BlueprintAgreement.configuration.port = '8080'
|
|
112
114
|
```
|
|
113
115
|
|
|
114
116
|
### Allow Headers
|
|
@@ -123,12 +125,12 @@ This config option intents to exclude attributes when the match is perform. It o
|
|
|
123
125
|
|
|
124
126
|
Examples:
|
|
125
127
|
|
|
126
|
-
```
|
|
128
|
+
```ruby
|
|
127
129
|
# This excludes 'field_one' and the element 'sub_field_one' inside the 'field_two' array. It doesn't exclude 'field_two'.
|
|
128
|
-
BlueprintAgreement
|
|
130
|
+
BlueprintAgreement.configuration.exclude_attributes = ['field_one', field_two: [ 'sub_field_one' ]]
|
|
129
131
|
|
|
130
132
|
# This excludes 'field_one' and 'sub_field_four'. It doesn't exclude 'field_two' or 'sub_field_one'.
|
|
131
|
-
BlueprintAgreement
|
|
133
|
+
BlueprintAgreement.configuration.exclude_attributes = ['field_one', field_two: { sub_field_one: [ 'sub_field_four' ] } ]
|
|
132
134
|
```
|
|
133
135
|
|
|
134
136
|
## Contributing
|
data/blueprint_agreement.gemspec
CHANGED
|
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
|
|
|
17
17
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
19
19
|
spec.require_paths = ["lib"]
|
|
20
|
-
spec.add_runtime_dependency "activesupport", ">=
|
|
20
|
+
spec.add_runtime_dependency "activesupport", ">=4.2"
|
|
21
21
|
|
|
22
22
|
spec.add_development_dependency "bundler", "~> 1.5"
|
|
23
23
|
spec.add_development_dependency "rake", "~>11.1"
|
data/lib/blueprint_agreement.rb
CHANGED
|
@@ -2,7 +2,7 @@ require "minitest"
|
|
|
2
2
|
require "minitest/spec"
|
|
3
3
|
require "minitest/mock"
|
|
4
4
|
require "blueprint_agreement/version"
|
|
5
|
-
require 'blueprint_agreement/
|
|
5
|
+
require 'blueprint_agreement/configuration'
|
|
6
6
|
require 'blueprint_agreement/errors'
|
|
7
7
|
require 'blueprint_agreement/api_services/drakov_service'
|
|
8
8
|
require "blueprint_agreement/server"
|
|
@@ -39,10 +39,38 @@ require 'blueprint_agreement/minitest/expectations'
|
|
|
39
39
|
# +-+-+ +--+--+ +-+-+
|
|
40
40
|
#
|
|
41
41
|
module BlueprintAgreement
|
|
42
|
+
class << self
|
|
43
|
+
attr_writer :configuration
|
|
44
|
+
|
|
45
|
+
def configure
|
|
46
|
+
yield configuration
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def configuration
|
|
50
|
+
@configuration ||= Configuration.new
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
module Config
|
|
55
|
+
class << self
|
|
56
|
+
def configure(&block)
|
|
57
|
+
warn "[DEPRECATION] `BlueprintAgreement::Config` is deprecated. Please use `BlueprintAgreement.configuration` instead."
|
|
58
|
+
BlueprintAgreement.configure(&block)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def method_missing(name, *args)
|
|
62
|
+
warn "[DEPRECATION] `BlueprintAgreement::Config` methods are deprecated. Please use `BlueprintAgreement.configuration` instead."
|
|
63
|
+
configuration = BlueprintAgreement.configuration;
|
|
64
|
+
return configuration.send(name) if name.to_s =~ /^(\w*)$/
|
|
65
|
+
return configuration.send(name, *args) if name.to_s =~ /^(\w*)=$/
|
|
66
|
+
super
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
42
70
|
end
|
|
43
71
|
|
|
44
72
|
Minitest.after_run do
|
|
45
|
-
if BlueprintAgreement
|
|
46
|
-
Process.kill 'TERM', BlueprintAgreement
|
|
73
|
+
if BlueprintAgreement.configuration.active_service?
|
|
74
|
+
Process.kill 'TERM', BlueprintAgreement.configuration.active_service[:pid]
|
|
47
75
|
end
|
|
48
76
|
end
|
|
@@ -2,21 +2,22 @@ module BlueprintAgreement
|
|
|
2
2
|
class DrakovService
|
|
3
3
|
attr :pid, :port, :hostname, :root_path, :allow_headers
|
|
4
4
|
|
|
5
|
-
def initialize
|
|
6
|
-
@
|
|
7
|
-
@
|
|
8
|
-
@
|
|
9
|
-
@
|
|
5
|
+
def initialize(config = BlueprintAgreement.configuration)
|
|
6
|
+
@config = config
|
|
7
|
+
@port = @config.port
|
|
8
|
+
@allow_headers = @config.allow_headers
|
|
9
|
+
@hostname = @config.hostname
|
|
10
|
+
@root_path = @config.server_path
|
|
10
11
|
end
|
|
11
12
|
|
|
12
13
|
def start(path)
|
|
13
14
|
@pid = spawn "drakov -f #{root_path}/#{path} -p #{port} #{allow_headers}".strip, options
|
|
14
|
-
|
|
15
|
+
@config.active_service = { pid: @pid, path: path }
|
|
15
16
|
end
|
|
16
17
|
|
|
17
18
|
def stop
|
|
18
|
-
Process.kill 'TERM',
|
|
19
|
-
|
|
19
|
+
Process.kill 'TERM', @config.active_service[:pid]
|
|
20
|
+
@config.active_service = nil
|
|
20
21
|
end
|
|
21
22
|
|
|
22
23
|
def host
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
module BlueprintAgreement
|
|
2
|
+
class Configuration
|
|
3
|
+
attr_accessor :active_service,
|
|
4
|
+
:exclude_attributes,
|
|
5
|
+
:allow_headers,
|
|
6
|
+
:port,
|
|
7
|
+
:hostname,
|
|
8
|
+
:server_path
|
|
9
|
+
|
|
10
|
+
def initialize
|
|
11
|
+
@active_service = nil
|
|
12
|
+
@exclude_attributes = nil
|
|
13
|
+
@allow_headers = nil
|
|
14
|
+
@port = "8082"
|
|
15
|
+
@hostname = "http://localhost"
|
|
16
|
+
@server_path = './docs'
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def active_service?
|
|
20
|
+
!!@active_service
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def allow_headers=(headers)
|
|
24
|
+
@allow_headers = headers.map { |header| "--header #{header}" }.join(" ")
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def default_format
|
|
28
|
+
'*.apib'
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
module Minitest
|
|
2
2
|
module Assertions
|
|
3
3
|
def assert_shall_agree_upon contract_name, response
|
|
4
|
-
result
|
|
5
|
-
api_service =
|
|
6
|
-
server
|
|
4
|
+
result = response.body
|
|
5
|
+
api_service = BlueprintAgreement::DrakovService.new(BlueprintAgreement.configuration)
|
|
6
|
+
server = BlueprintAgreement::Server.new(
|
|
7
7
|
api_service: api_service,
|
|
8
|
-
config: BlueprintAgreement
|
|
8
|
+
config: BlueprintAgreement.configuration
|
|
9
9
|
)
|
|
10
10
|
|
|
11
11
|
begin
|
|
@@ -14,8 +14,8 @@ module Minitest
|
|
|
14
14
|
requester = BlueprintAgreement::Utils::Requester.new(request, server)
|
|
15
15
|
expected = requester.perform.body.to_s
|
|
16
16
|
|
|
17
|
-
unless BlueprintAgreement
|
|
18
|
-
filters = BlueprintAgreement
|
|
17
|
+
unless BlueprintAgreement.configuration.exclude_attributes.nil?
|
|
18
|
+
filters = BlueprintAgreement.configuration.exclude_attributes
|
|
19
19
|
result = BlueprintAgreement::ExcludeFilter.deep_exclude(
|
|
20
20
|
BlueprintAgreement::Utils.to_json(result),
|
|
21
21
|
filters)
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
FORMAT: 1A
|
|
2
|
+
|
|
3
|
+
# The Simplest API
|
|
4
|
+
This is one of the simplest APIs written in the **API Blueprint**. One plain
|
|
5
|
+
resource combined with a method and that's it! We will explain what is going on
|
|
6
|
+
in the next installment -
|
|
7
|
+
[Resource and Actions](02.%20Resource%20and%20Actions.md).
|
|
8
|
+
|
|
9
|
+
**Note:** As we progress through the examples, do not also forget to view the
|
|
10
|
+
[Raw](https://raw.github.com/apiaryio/api-blueprint/master/examples/01.%20Simplest%20API.md)
|
|
11
|
+
code to see what is really going on in the API Blueprint, as opposed to just
|
|
12
|
+
seeing the output of the Github Markdown parser.
|
|
13
|
+
|
|
14
|
+
Also please keep in mind that every single example in this course is a **real
|
|
15
|
+
API Blueprint** and as such you can **parse** it with the
|
|
16
|
+
[API Blueprint parser](https://github.com/apiaryio/drafter) or one of its
|
|
17
|
+
[bindings](https://github.com/apiaryio/drafter#bindings).
|
|
18
|
+
|
|
19
|
+
## API Blueprint
|
|
20
|
+
+ [This: Raw API Blueprint](https://raw.github.com/apiaryio/api-blueprint/master/examples/01.%20Simplest%20API.md)
|
|
21
|
+
+ [Next: Resource and Actions](02.%20Resource%20and%20Actions.md)
|
|
22
|
+
|
|
23
|
+
# GET /message
|
|
24
|
+
+ Request (application/json)
|
|
25
|
+
+ Response 200 (application/json)
|
|
26
|
+
|
|
27
|
+
+ Body
|
|
28
|
+
|
|
29
|
+
{
|
|
30
|
+
"name": "Hello World"
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
# POST /message/empty
|
|
34
|
+
+ Request (application/json)
|
|
35
|
+
+ Response 204 (application/json)
|
|
36
|
+
|
|
37
|
+
+ Body
|
|
38
|
+
|
|
39
|
+
{
|
|
40
|
+
"name": "Hello World"
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
# PATCH /message/1
|
|
44
|
+
+ Request (application/json)
|
|
45
|
+
+ Response 200 (application/json)
|
|
46
|
+
|
|
47
|
+
+ Body
|
|
48
|
+
|
|
49
|
+
{
|
|
50
|
+
"name": "Hello World"
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
# GET /cookie
|
|
54
|
+
+ Request (application/json)
|
|
55
|
+
|
|
56
|
+
+ Headers
|
|
57
|
+
|
|
58
|
+
Cookie: cookie=have-a-cookie
|
|
59
|
+
|
|
60
|
+
+ Response 200 (application/json)
|
|
61
|
+
|
|
62
|
+
+ Body
|
|
63
|
+
|
|
64
|
+
{
|
|
65
|
+
"cookie": "have a cookie!"
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
# GET /extra_headers
|
|
69
|
+
+ Request (application/json)
|
|
70
|
+
|
|
71
|
+
+ Headers
|
|
72
|
+
|
|
73
|
+
Cookie: cookie=have-a-cookie
|
|
74
|
+
Accept: application/json
|
|
75
|
+
Version: v1
|
|
76
|
+
|
|
77
|
+
+ Response 200 (application/json)
|
|
78
|
+
|
|
79
|
+
+ Body
|
|
80
|
+
|
|
81
|
+
{
|
|
82
|
+
"cookie": "have a cookie!"
|
|
83
|
+
}
|
|
@@ -14,7 +14,7 @@ describe "Rails" do
|
|
|
14
14
|
|
|
15
15
|
before do
|
|
16
16
|
module Rails; end
|
|
17
|
-
BlueprintAgreement
|
|
17
|
+
BlueprintAgreement.configuration.server_path = './test/fixtures'
|
|
18
18
|
end
|
|
19
19
|
after do
|
|
20
20
|
Object.send(:remove_const, :Rails)
|
|
@@ -58,7 +58,7 @@ describe "Rack Test" do
|
|
|
58
58
|
|
|
59
59
|
before do
|
|
60
60
|
module Rack; module Test; end; end
|
|
61
|
-
BlueprintAgreement
|
|
61
|
+
BlueprintAgreement.configuration.server_path = './test/fixtures'
|
|
62
62
|
end
|
|
63
63
|
|
|
64
64
|
describe 'when blueprint agreement was included but never used' do
|
|
@@ -86,7 +86,7 @@ describe "Rack Test" do
|
|
|
86
86
|
let(:endpoint){ '/message' }
|
|
87
87
|
|
|
88
88
|
before do
|
|
89
|
-
BlueprintAgreement
|
|
89
|
+
BlueprintAgreement.configuration.exclude_attributes = ['name']
|
|
90
90
|
end
|
|
91
91
|
|
|
92
92
|
it 'returns a Not Found Route error' do
|
|
@@ -108,8 +108,35 @@ describe "Rack Test" do
|
|
|
108
108
|
let(:endpoint){ '/message/empty' }
|
|
109
109
|
let(:last_request) { RailsMocks::Request.new(fullpath: endpoint, request_method: 'POST') }
|
|
110
110
|
|
|
111
|
+
before do
|
|
112
|
+
BlueprintAgreement.configuration.exclude_attributes = ['name']
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
it 'returns a Not Found Route error' do
|
|
116
|
+
last_response.shall_agree_upon('hello_api.md')
|
|
117
|
+
end
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
describe 'with multiple apib files' do
|
|
121
|
+
let(:endpoint){ '/message/1' }
|
|
122
|
+
let(:last_request) { RailsMocks::Request.new(fullpath: endpoint, request_method: 'PATCH') }
|
|
123
|
+
|
|
124
|
+
it 'returns a Not Found Route error' do
|
|
125
|
+
last_response.shall_agree_upon('hello_api.md')
|
|
126
|
+
last_response.shall_agree_upon('second_api.md')
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
describe 'support old configuration method' do
|
|
131
|
+
let(:body) { "" }
|
|
132
|
+
let(:endpoint){ '/message/empty' }
|
|
133
|
+
let(:last_request) { RailsMocks::Request.new(fullpath: endpoint, request_method: 'POST') }
|
|
134
|
+
|
|
111
135
|
before do
|
|
112
136
|
BlueprintAgreement::Config.exclude_attributes = ['name']
|
|
137
|
+
BlueprintAgreement::Config.configure do |config|
|
|
138
|
+
config.exclude_attributes = ['name']
|
|
139
|
+
end
|
|
113
140
|
end
|
|
114
141
|
|
|
115
142
|
it 'returns a Not Found Route error' do
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
require "test_helper"
|
|
2
2
|
|
|
3
|
-
describe BlueprintAgreement::
|
|
4
|
-
let(:subject) { BlueprintAgreement::
|
|
3
|
+
describe BlueprintAgreement::Configuration do
|
|
4
|
+
let(:subject) { BlueprintAgreement::Configuration.new }
|
|
5
5
|
|
|
6
6
|
describe 'allow headers' do
|
|
7
7
|
it 'allows setting the allowed headers' do
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: blueprint_agreement
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Charly Palencia
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2017-
|
|
11
|
+
date: 2017-10-26 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|
|
@@ -17,9 +17,6 @@ dependencies:
|
|
|
17
17
|
- - ">="
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
19
|
version: '4.2'
|
|
20
|
-
- - "<"
|
|
21
|
-
- !ruby/object:Gem::Version
|
|
22
|
-
version: '5.1'
|
|
23
20
|
type: :runtime
|
|
24
21
|
prerelease: false
|
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -27,9 +24,6 @@ dependencies:
|
|
|
27
24
|
- - ">="
|
|
28
25
|
- !ruby/object:Gem::Version
|
|
29
26
|
version: '4.2'
|
|
30
|
-
- - "<"
|
|
31
|
-
- !ruby/object:Gem::Version
|
|
32
|
-
version: '5.1'
|
|
33
27
|
- !ruby/object:Gem::Dependency
|
|
34
28
|
name: bundler
|
|
35
29
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -117,7 +111,7 @@ files:
|
|
|
117
111
|
- blueprint_agreement.gemspec
|
|
118
112
|
- lib/blueprint_agreement.rb
|
|
119
113
|
- lib/blueprint_agreement/api_services/drakov_service.rb
|
|
120
|
-
- lib/blueprint_agreement/
|
|
114
|
+
- lib/blueprint_agreement/configuration.rb
|
|
121
115
|
- lib/blueprint_agreement/errors.rb
|
|
122
116
|
- lib/blueprint_agreement/minitest/assertions.rb
|
|
123
117
|
- lib/blueprint_agreement/minitest/expectations.rb
|
|
@@ -130,13 +124,14 @@ files:
|
|
|
130
124
|
- lib/blueprint_agreement/version.rb
|
|
131
125
|
- tasks/test.rake
|
|
132
126
|
- test/fixtures/hello_api.md
|
|
127
|
+
- test/fixtures/second_api.md
|
|
133
128
|
- test/integration/simple_api_test.rb
|
|
134
129
|
- test/request_builder_test.rb
|
|
135
130
|
- test/server_test.rb
|
|
136
131
|
- test/support/rails_mocks/request.rb
|
|
137
132
|
- test/support/rails_mocks/response.rb
|
|
138
133
|
- test/test_helper.rb
|
|
139
|
-
- test/unit_test/utils/
|
|
134
|
+
- test/unit_test/utils/configuration_test.rb
|
|
140
135
|
- test/unit_test/utils/exclude_filter_test.rb
|
|
141
136
|
- test/unit_test/utils/requester_test.rb
|
|
142
137
|
homepage: https://github.com/charly-palencia/blueprint-agreement
|
|
@@ -165,12 +160,13 @@ specification_version: 4
|
|
|
165
160
|
summary: A Minitest API Documentation Matcher , based on ApiBluePrint schema.
|
|
166
161
|
test_files:
|
|
167
162
|
- test/fixtures/hello_api.md
|
|
163
|
+
- test/fixtures/second_api.md
|
|
168
164
|
- test/integration/simple_api_test.rb
|
|
169
165
|
- test/request_builder_test.rb
|
|
170
166
|
- test/server_test.rb
|
|
171
167
|
- test/support/rails_mocks/request.rb
|
|
172
168
|
- test/support/rails_mocks/response.rb
|
|
173
169
|
- test/test_helper.rb
|
|
174
|
-
- test/unit_test/utils/
|
|
170
|
+
- test/unit_test/utils/configuration_test.rb
|
|
175
171
|
- test/unit_test/utils/exclude_filter_test.rb
|
|
176
172
|
- test/unit_test/utils/requester_test.rb
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
module BlueprintAgreement
|
|
2
|
-
module Config
|
|
3
|
-
extend self
|
|
4
|
-
@@active_service = nil
|
|
5
|
-
@@exclude_attributes = nil
|
|
6
|
-
@@allow_headers = nil
|
|
7
|
-
@@port = "8082"
|
|
8
|
-
@@hostname = "http://localhost"
|
|
9
|
-
|
|
10
|
-
def configure; yield self end
|
|
11
|
-
|
|
12
|
-
def port=(port)
|
|
13
|
-
@@port = port
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def server_path=(server_path)
|
|
17
|
-
@server_path = server_path
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
def exclude_attributes=(exclude_attributes)
|
|
21
|
-
@@exclude_attributes = exclude_attributes
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
def active_service?
|
|
25
|
-
!!@@active_service
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
def active_service=(active_service)
|
|
29
|
-
@@active_service = active_service
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
def active_service
|
|
33
|
-
@@active_service
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
def server_path(path = './docs')
|
|
37
|
-
@server_path ||= path
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
def allow_headers=(headers)
|
|
41
|
-
@@allow_headers = headers.map { |header| "--header #{header}" }.join(" ")
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
def allow_headers
|
|
45
|
-
@@allow_headers
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
def default_format
|
|
49
|
-
'*.apib'
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
def port
|
|
53
|
-
@@port
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
def hostname
|
|
57
|
-
@@hostname
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
def hostname=(host)
|
|
61
|
-
@@hostname = host
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
def exclude_attributes
|
|
65
|
-
@@exclude_attributes
|
|
66
|
-
end
|
|
67
|
-
end
|
|
68
|
-
end
|
|
69
|
-
|