grape-apiary 0.2.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop.yml +13 -3
- data/CHANGELOG.md +7 -0
- data/grape-apiary.gemspec +7 -8
- data/lib/grape-apiary/config.rb +11 -11
- data/lib/grape-apiary/parameter.rb +21 -3
- data/lib/grape-apiary/version.rb +2 -1
- data/spec/grape-apiary/config_spec.rb +1 -1
- data/spec/support/config_context.rb +1 -1
- metadata +49 -49
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f15baf2f928e704b22c5d37d1c41463341194e2edf5a7f36290f4936c14a6ebe
|
4
|
+
data.tar.gz: 5b1e793a02d2bd82f1600f674d09c4080fe17aed951abbbf2fe3bbce508be198
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a821e36bcb47f1c2257a59c47282eebc5b50f4686aa12fd4b77cf2f986fce4cd4b5c056aa1e5da19e39890615d26961a62568ada5b8ccea5e6e19c1046613975
|
7
|
+
data.tar.gz: 97adf592beda9ef045d0fc3224d39acef628b415b8ce76345c6eac120e132e6fffddabfeb6bdd46eea33a01d612ad798199882851aec5ee957c24a50081c8a36
|
data/.rubocop.yml
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
AllCops:
|
2
|
+
TargetRubyVersion: 2.4
|
2
3
|
Excludes:
|
3
4
|
- Rakefile
|
4
5
|
- vendor/**/*
|
@@ -22,7 +23,7 @@ AlignParameters:
|
|
22
23
|
# )
|
23
24
|
EnforcedStyle: with_fixed_indentation
|
24
25
|
|
25
|
-
|
26
|
+
Layout/AlignParameters:
|
26
27
|
# allow for end of if to be aligned with a variable.
|
27
28
|
# for example:
|
28
29
|
#
|
@@ -33,7 +34,7 @@ Style/AlignParameters:
|
|
33
34
|
# end
|
34
35
|
EnforcedStyle: with_fixed_indentation
|
35
36
|
|
36
|
-
|
37
|
+
Layout/ElseAlignment:
|
37
38
|
Enabled: false
|
38
39
|
|
39
40
|
Lint/EndAlignment:
|
@@ -41,7 +42,7 @@ Lint/EndAlignment:
|
|
41
42
|
|
42
43
|
ClassAndModuleChildren:
|
43
44
|
# ok to use compact style when modules are predefined.
|
44
|
-
# for example the following is fine so long as we're sure that
|
45
|
+
# for example the following is fine so long as we're sure that
|
45
46
|
# module MDB has already been required/defined.
|
46
47
|
#
|
47
48
|
# class Foo::Bar; end
|
@@ -52,3 +53,12 @@ Metrics/BlockLength:
|
|
52
53
|
Exclude:
|
53
54
|
- 'grape-apiary.gemspec'
|
54
55
|
- 'spec/**/*'
|
56
|
+
|
57
|
+
Style/FrozenStringLiteralComment:
|
58
|
+
Enabled: false
|
59
|
+
|
60
|
+
Style/PercentLiteralDelimiters:
|
61
|
+
PreferredDelimiters:
|
62
|
+
default: ()
|
63
|
+
"%i": ()
|
64
|
+
"%w": ()
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,13 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
4
4
|
|
5
5
|
## Recent updates
|
6
6
|
|
7
|
+
## 1.0.0 (2017-12-20)
|
8
|
+
|
9
|
+
#### Maintenance
|
10
|
+
|
11
|
+
- [PR #16](https://github.com/technekes/grape-apiary/pull/16) - Upgrade to latest version of RuboCop [@jallen3d](https://github.com/johnallen3d).
|
12
|
+
- [PR #15](https://github.com/technekes/grape-apiary/pull/15) - Update for grape 1.0 [@travisp](https://github.com/travisp).
|
13
|
+
|
7
14
|
## 0.2.0 (2017-02-21)
|
8
15
|
|
9
16
|
#### Maintenance
|
data/grape-apiary.gemspec
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# coding: utf-8
|
2
1
|
lib = File.expand_path('../lib', __FILE__)
|
3
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
3
|
require 'grape-apiary/version'
|
@@ -25,16 +24,16 @@ Gem::Specification.new do |spec|
|
|
25
24
|
docuementation that is created by your Grape API
|
26
25
|
DESCRIPTION
|
27
26
|
|
28
|
-
spec.add_runtime_dependency 'grape', '>= 0.16.0', '<= 0.19.1'
|
29
27
|
spec.add_runtime_dependency 'activesupport'
|
28
|
+
spec.add_runtime_dependency 'grape', '>= 0.16.0', '<= 1.0.1'
|
30
29
|
|
31
|
-
spec.add_development_dependency 'codeclimate-test-reporter', '~> 0.4'
|
32
|
-
spec.add_development_dependency 'rspec', '~> 2.14'
|
33
30
|
spec.add_development_dependency 'bundler', '~> 1.5'
|
34
|
-
spec.add_development_dependency '
|
35
|
-
spec.add_development_dependency 'rubocop', '>= 0.37', '< 1.0'
|
36
|
-
spec.add_development_dependency 'pry', '~> 0.9'
|
31
|
+
spec.add_development_dependency 'codeclimate-test-reporter', '~> 0.4'
|
37
32
|
spec.add_development_dependency 'guard', '~> 2.4'
|
38
|
-
spec.add_development_dependency 'guard-rspec', '~> 4.2'
|
39
33
|
spec.add_development_dependency 'guard-bundler', '~> 2.0'
|
34
|
+
spec.add_development_dependency 'guard-rspec', '~> 4.2'
|
35
|
+
spec.add_development_dependency 'pry', '~> 0.9'
|
36
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
37
|
+
spec.add_development_dependency 'rspec', '~> 2.14'
|
38
|
+
spec.add_development_dependency 'rubocop', '>= 0.37', '< 1.0'
|
40
39
|
end
|
data/lib/grape-apiary/config.rb
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
module GrapeApiary
|
2
2
|
class Config
|
3
|
-
SETTINGS =
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
3
|
+
SETTINGS = %i(
|
4
|
+
host
|
5
|
+
name
|
6
|
+
description
|
7
|
+
request_headers
|
8
|
+
response_headers
|
9
|
+
example_id_type
|
10
|
+
resource_exclusion
|
11
|
+
include_root
|
12
|
+
).freeze
|
13
13
|
|
14
14
|
class << self
|
15
15
|
attr_accessor(*SETTINGS)
|
@@ -31,7 +31,7 @@ module GrapeApiary
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def supported_id_types
|
34
|
-
|
34
|
+
%i(integer uuid bson)
|
35
35
|
end
|
36
36
|
|
37
37
|
def example_id_type=(value)
|
@@ -3,8 +3,6 @@ module GrapeApiary
|
|
3
3
|
attr_reader :route, :full_name, :name, :settings
|
4
4
|
|
5
5
|
delegate :route_model, :namespace, to: :route
|
6
|
-
delegate :requirement, :type, :documentation, :desc, to: :settings
|
7
|
-
delegate :example, to: :documentation, allow_nil: true
|
8
6
|
|
9
7
|
def initialize(route, name, options)
|
10
8
|
@full_name = name
|
@@ -14,6 +12,26 @@ module GrapeApiary
|
|
14
12
|
@settings = parse_options(options)
|
15
13
|
end
|
16
14
|
|
15
|
+
def requirement
|
16
|
+
settings[:requirement]
|
17
|
+
end
|
18
|
+
|
19
|
+
def type
|
20
|
+
settings[:type]
|
21
|
+
end
|
22
|
+
|
23
|
+
def desc
|
24
|
+
settings[:desc]
|
25
|
+
end
|
26
|
+
|
27
|
+
def documentation
|
28
|
+
settings[:documentation]
|
29
|
+
end
|
30
|
+
|
31
|
+
def example
|
32
|
+
documentation ? documentation[:example] : nil
|
33
|
+
end
|
34
|
+
|
17
35
|
def description
|
18
36
|
"#{name} (#{requirement}, #{type}, `#{example}`) ... #{desc}"
|
19
37
|
end
|
@@ -25,7 +43,7 @@ module GrapeApiary
|
|
25
43
|
|
26
44
|
options[:requirement] = options[:required] ? 'required' : 'optional'
|
27
45
|
|
28
|
-
|
46
|
+
options
|
29
47
|
end
|
30
48
|
|
31
49
|
def default_options
|
data/lib/grape-apiary/version.rb
CHANGED
@@ -36,7 +36,7 @@ describe GrapeApiary::Config do
|
|
36
36
|
end
|
37
37
|
|
38
38
|
context 'headers' do
|
39
|
-
|
39
|
+
%i(request_headers response_headers).each do |type|
|
40
40
|
context type do
|
41
41
|
it 'is an array' do
|
42
42
|
expect(subject.send(type)).to be_a(Array)
|
@@ -2,7 +2,7 @@ shared_context 'configuration' do
|
|
2
2
|
let(:host) { 'http://grape-apiary.apiary.io' }
|
3
3
|
let(:name) { 'some api v1' }
|
4
4
|
let(:description) { 'some blueprint description' }
|
5
|
-
let(:resource_exclusion) {
|
5
|
+
let(:resource_exclusion) { %i(admin swagger_docs) }
|
6
6
|
|
7
7
|
let(:request_headers) do
|
8
8
|
[{ 'Accept-Charset' => 'utf-8' }]
|
metadata
CHANGED
@@ -1,125 +1,119 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grape-apiary
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Allen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-12-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: activesupport
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0
|
20
|
-
- - "<="
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: 0.19.1
|
19
|
+
version: '0'
|
23
20
|
type: :runtime
|
24
21
|
prerelease: false
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
26
23
|
requirements:
|
27
24
|
- - ">="
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version: 0
|
30
|
-
- - "<="
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
version: 0.19.1
|
26
|
+
version: '0'
|
33
27
|
- !ruby/object:Gem::Dependency
|
34
|
-
name:
|
28
|
+
name: grape
|
35
29
|
requirement: !ruby/object:Gem::Requirement
|
36
30
|
requirements:
|
37
31
|
- - ">="
|
38
32
|
- !ruby/object:Gem::Version
|
39
|
-
version:
|
33
|
+
version: 0.16.0
|
34
|
+
- - "<="
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: 1.0.1
|
40
37
|
type: :runtime
|
41
38
|
prerelease: false
|
42
39
|
version_requirements: !ruby/object:Gem::Requirement
|
43
40
|
requirements:
|
44
41
|
- - ">="
|
45
42
|
- !ruby/object:Gem::Version
|
46
|
-
version:
|
43
|
+
version: 0.16.0
|
44
|
+
- - "<="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 1.0.1
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
|
-
name:
|
48
|
+
name: bundler
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
51
|
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: '
|
53
|
+
version: '1.5'
|
54
54
|
type: :development
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
58
|
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: '
|
60
|
+
version: '1.5'
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
|
-
name:
|
62
|
+
name: codeclimate-test-reporter
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
65
|
- - "~>"
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version: '
|
67
|
+
version: '0.4'
|
68
68
|
type: :development
|
69
69
|
prerelease: false
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
72
|
- - "~>"
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version: '
|
74
|
+
version: '0.4'
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
|
-
name:
|
76
|
+
name: guard
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
78
78
|
requirements:
|
79
79
|
- - "~>"
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version: '
|
81
|
+
version: '2.4'
|
82
82
|
type: :development
|
83
83
|
prerelease: false
|
84
84
|
version_requirements: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
86
|
- - "~>"
|
87
87
|
- !ruby/object:Gem::Version
|
88
|
-
version: '
|
88
|
+
version: '2.4'
|
89
89
|
- !ruby/object:Gem::Dependency
|
90
|
-
name:
|
90
|
+
name: guard-bundler
|
91
91
|
requirement: !ruby/object:Gem::Requirement
|
92
92
|
requirements:
|
93
93
|
- - "~>"
|
94
94
|
- !ruby/object:Gem::Version
|
95
|
-
version: '
|
95
|
+
version: '2.0'
|
96
96
|
type: :development
|
97
97
|
prerelease: false
|
98
98
|
version_requirements: !ruby/object:Gem::Requirement
|
99
99
|
requirements:
|
100
100
|
- - "~>"
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version: '
|
102
|
+
version: '2.0'
|
103
103
|
- !ruby/object:Gem::Dependency
|
104
|
-
name:
|
104
|
+
name: guard-rspec
|
105
105
|
requirement: !ruby/object:Gem::Requirement
|
106
106
|
requirements:
|
107
|
-
- - "
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
version: '0.37'
|
110
|
-
- - "<"
|
107
|
+
- - "~>"
|
111
108
|
- !ruby/object:Gem::Version
|
112
|
-
version: '
|
109
|
+
version: '4.2'
|
113
110
|
type: :development
|
114
111
|
prerelease: false
|
115
112
|
version_requirements: !ruby/object:Gem::Requirement
|
116
113
|
requirements:
|
117
|
-
- - "
|
118
|
-
- !ruby/object:Gem::Version
|
119
|
-
version: '0.37'
|
120
|
-
- - "<"
|
114
|
+
- - "~>"
|
121
115
|
- !ruby/object:Gem::Version
|
122
|
-
version: '
|
116
|
+
version: '4.2'
|
123
117
|
- !ruby/object:Gem::Dependency
|
124
118
|
name: pry
|
125
119
|
requirement: !ruby/object:Gem::Requirement
|
@@ -135,47 +129,53 @@ dependencies:
|
|
135
129
|
- !ruby/object:Gem::Version
|
136
130
|
version: '0.9'
|
137
131
|
- !ruby/object:Gem::Dependency
|
138
|
-
name:
|
132
|
+
name: rake
|
139
133
|
requirement: !ruby/object:Gem::Requirement
|
140
134
|
requirements:
|
141
135
|
- - "~>"
|
142
136
|
- !ruby/object:Gem::Version
|
143
|
-
version: '
|
137
|
+
version: '10.0'
|
144
138
|
type: :development
|
145
139
|
prerelease: false
|
146
140
|
version_requirements: !ruby/object:Gem::Requirement
|
147
141
|
requirements:
|
148
142
|
- - "~>"
|
149
143
|
- !ruby/object:Gem::Version
|
150
|
-
version: '
|
144
|
+
version: '10.0'
|
151
145
|
- !ruby/object:Gem::Dependency
|
152
|
-
name:
|
146
|
+
name: rspec
|
153
147
|
requirement: !ruby/object:Gem::Requirement
|
154
148
|
requirements:
|
155
149
|
- - "~>"
|
156
150
|
- !ruby/object:Gem::Version
|
157
|
-
version: '
|
151
|
+
version: '2.14'
|
158
152
|
type: :development
|
159
153
|
prerelease: false
|
160
154
|
version_requirements: !ruby/object:Gem::Requirement
|
161
155
|
requirements:
|
162
156
|
- - "~>"
|
163
157
|
- !ruby/object:Gem::Version
|
164
|
-
version: '
|
158
|
+
version: '2.14'
|
165
159
|
- !ruby/object:Gem::Dependency
|
166
|
-
name:
|
160
|
+
name: rubocop
|
167
161
|
requirement: !ruby/object:Gem::Requirement
|
168
162
|
requirements:
|
169
|
-
- - "
|
163
|
+
- - ">="
|
170
164
|
- !ruby/object:Gem::Version
|
171
|
-
version: '
|
165
|
+
version: '0.37'
|
166
|
+
- - "<"
|
167
|
+
- !ruby/object:Gem::Version
|
168
|
+
version: '1.0'
|
172
169
|
type: :development
|
173
170
|
prerelease: false
|
174
171
|
version_requirements: !ruby/object:Gem::Requirement
|
175
172
|
requirements:
|
176
|
-
- - "
|
173
|
+
- - ">="
|
177
174
|
- !ruby/object:Gem::Version
|
178
|
-
version: '
|
175
|
+
version: '0.37'
|
176
|
+
- - "<"
|
177
|
+
- !ruby/object:Gem::Version
|
178
|
+
version: '1.0'
|
179
179
|
description: |2
|
180
180
|
Auto generates an Apiary (http://apiary.io) Blueprint from the
|
181
181
|
docuementation that is created by your Grape API
|
@@ -238,7 +238,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
238
238
|
version: '0'
|
239
239
|
requirements: []
|
240
240
|
rubyforge_project:
|
241
|
-
rubygems_version: 2.
|
241
|
+
rubygems_version: 2.7.2
|
242
242
|
signing_key:
|
243
243
|
specification_version: 4
|
244
244
|
summary: Allows for generating an Apiary Blueprint for you Grape API
|