raml_ruby 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +2 -0
  3. data/README.md +1 -9
  4. data/Rakefile +7 -0
  5. data/lib/raml.rb +6 -26
  6. data/lib/raml/exceptions.rb +1 -0
  7. data/lib/raml/mixin/bodies.rb +3 -3
  8. data/lib/raml/mixin/documentable.rb +3 -8
  9. data/lib/raml/mixin/global.rb +14 -10
  10. data/lib/raml/mixin/headers.rb +1 -1
  11. data/lib/raml/mixin/merge.rb +4 -4
  12. data/lib/raml/mixin/secured_by.rb +27 -0
  13. data/lib/raml/mixin/validation.rb +27 -27
  14. data/lib/raml/node.rb +22 -80
  15. data/lib/raml/node/abstract_method.rb +7 -7
  16. data/lib/raml/node/abstract_resource.rb +17 -7
  17. data/lib/raml/node/body.rb +12 -10
  18. data/lib/raml/node/documentation.rb +0 -8
  19. data/lib/raml/node/method.rb +5 -7
  20. data/lib/raml/node/parameter/abstract_parameter.rb +22 -24
  21. data/lib/raml/node/parametized_reference.rb +3 -3
  22. data/lib/raml/node/resource.rb +0 -2
  23. data/lib/raml/node/resource_type.rb +9 -9
  24. data/lib/raml/node/resource_type_reference.rb +2 -2
  25. data/lib/raml/node/response.rb +0 -2
  26. data/lib/raml/node/root.rb +66 -57
  27. data/lib/raml/node/schema.rb +3 -9
  28. data/lib/raml/node/schema_reference.rb +2 -2
  29. data/lib/raml/node/security_scheme.rb +47 -0
  30. data/lib/raml/node/security_scheme_reference.rb +5 -0
  31. data/lib/raml/node/trait.rb +8 -8
  32. data/lib/raml/node/trait_reference.rb +2 -2
  33. data/lib/raml/parser.rb +25 -16
  34. data/lib/raml/version.rb +1 -1
  35. data/raml_ruby.gemspec +3 -7
  36. data/test/apis/box-api.raml +1447 -1447
  37. data/test/apis/instagram-api.raml +48 -48
  38. data/test/apis/stripe-api.raml +4266 -4266
  39. data/test/apis/twilio-rest-api.raml +47 -47
  40. data/test/apis/twitter-rest-api.raml +1883 -1883
  41. data/test/raml/body_spec.rb +22 -39
  42. data/test/raml/documentation_spec.rb +2 -12
  43. data/test/raml/method_spec.rb +112 -93
  44. data/test/raml/parameter/abstract_parameter_spec.rb +9 -34
  45. data/test/raml/parameter/query_parameter_spec.rb +0 -15
  46. data/test/raml/parameter/uri_parameter_spec.rb +1 -16
  47. data/test/raml/resource_spec.rb +59 -41
  48. data/test/raml/resource_type_spec.rb +13 -13
  49. data/test/raml/response_spec.rb +23 -36
  50. data/test/raml/root_spec.rb +85 -18
  51. data/test/raml/security_scheme_spec.rb +71 -0
  52. data/test/raml/spec_helper.rb +2 -1
  53. data/test/raml/template_spec.rb +92 -92
  54. data/test/raml/trait_spec.rb +7 -7
  55. metadata +14 -74
  56. data/templates/abstract_parameter.slim +0 -68
  57. data/templates/body.slim +0 -15
  58. data/templates/collapse.slim +0 -10
  59. data/templates/documentation.slim +0 -2
  60. data/templates/method.slim +0 -38
  61. data/templates/resource.slim +0 -33
  62. data/templates/response.slim +0 -13
  63. data/templates/root.slim +0 -39
  64. data/templates/style.sass +0 -119
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: raml_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kirill Gorin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-28 00:00:00.000000000 Z
11
+ date: 2016-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '4.1'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '4.1'
27
27
  - !ruby/object:Gem::Dependency
@@ -30,70 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '2.2'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '2.2'
41
- - !ruby/object:Gem::Dependency
42
- name: kramdown
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '1.4'
48
- type: :runtime
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '1.4'
55
- - !ruby/object:Gem::Dependency
56
- name: rouge
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '1.7'
62
- type: :runtime
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '1.7'
69
- - !ruby/object:Gem::Dependency
70
- name: sass
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: '3.4'
76
- type: :runtime
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: '3.4'
83
- - !ruby/object:Gem::Dependency
84
- name: slim
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: '2.0'
33
+ version: '2.5'
90
34
  type: :runtime
91
35
  prerelease: false
92
36
  version_requirements: !ruby/object:Gem::Requirement
93
37
  requirements:
94
38
  - - "~>"
95
39
  - !ruby/object:Gem::Version
96
- version: '2.0'
40
+ version: '2.5'
97
41
  - !ruby/object:Gem::Dependency
98
42
  name: uri_template
99
43
  requirement: !ruby/object:Gem::Requirement
@@ -114,14 +58,14 @@ dependencies:
114
58
  requirements:
115
59
  - - "~>"
116
60
  - !ruby/object:Gem::Version
117
- version: '1.3'
61
+ version: '1.11'
118
62
  type: :development
119
63
  prerelease: false
120
64
  version_requirements: !ruby/object:Gem::Requirement
121
65
  requirements:
122
66
  - - "~>"
123
67
  - !ruby/object:Gem::Version
124
- version: '1.3'
68
+ version: '1.11'
125
69
  - !ruby/object:Gem::Dependency
126
70
  name: rake
127
71
  requirement: !ruby/object:Gem::Requirement
@@ -219,6 +163,7 @@ files:
219
163
  - lib/raml/mixin/headers.rb
220
164
  - lib/raml/mixin/merge.rb
221
165
  - lib/raml/mixin/parent.rb
166
+ - lib/raml/mixin/secured_by.rb
222
167
  - lib/raml/mixin/validation.rb
223
168
  - lib/raml/node.rb
224
169
  - lib/raml/node/abstract_method.rb
@@ -242,6 +187,8 @@ files:
242
187
  - lib/raml/node/root.rb
243
188
  - lib/raml/node/schema.rb
244
189
  - lib/raml/node/schema_reference.rb
190
+ - lib/raml/node/security_scheme.rb
191
+ - lib/raml/node/security_scheme_reference.rb
245
192
  - lib/raml/node/template.rb
246
193
  - lib/raml/node/trait.rb
247
194
  - lib/raml/node/trait_reference.rb
@@ -252,15 +199,6 @@ files:
252
199
  - lib/raml/version.rb
253
200
  - raml_ruby.gemspec
254
201
  - raml_spec_reqs.md
255
- - templates/abstract_parameter.slim
256
- - templates/body.slim
257
- - templates/collapse.slim
258
- - templates/documentation.slim
259
- - templates/method.slim
260
- - templates/resource.slim
261
- - templates/response.slim
262
- - templates/root.slim
263
- - templates/style.sass
264
202
  - test/apis/box-api.raml
265
203
  - test/apis/instagram-api.raml
266
204
  - test/apis/stripe-api.raml
@@ -282,6 +220,7 @@ files:
282
220
  - test/raml/response_spec.rb
283
221
  - test/raml/root_spec.rb
284
222
  - test/raml/schema_spec.rb
223
+ - test/raml/security_scheme_spec.rb
285
224
  - test/raml/spec_helper.rb
286
225
  - test/raml/template_spec.rb
287
226
  - test/raml/trait_spec.rb
@@ -305,7 +244,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
305
244
  version: '0'
306
245
  requirements: []
307
246
  rubyforge_project:
308
- rubygems_version: 2.4.6
247
+ rubygems_version: 2.4.8
309
248
  signing_key:
310
249
  specification_version: 4
311
250
  summary: raml_ruby is implementation of RAML parser in Ruby.
@@ -331,6 +270,7 @@ test_files:
331
270
  - test/raml/response_spec.rb
332
271
  - test/raml/root_spec.rb
333
272
  - test/raml/schema_spec.rb
273
+ - test/raml/security_scheme_spec.rb
334
274
  - test/raml/spec_helper.rb
335
275
  - test/raml/template_spec.rb
336
276
  - test/raml/trait_spec.rb
@@ -1,68 +0,0 @@
1
- - if has_multiple_types?
2
- div
3
- span.param_names
4
- span.param_name> => name
5
- | (multiple types)
6
- - for child in children
7
- == child.document
8
-
9
- - else
10
- .param
11
- div
12
- span.param_names
13
- span.param_name> => name
14
- - unless display_name.nil?
15
- | (#{ display_name })
16
-
17
- span.param_attrs
18
- - if required
19
- span.param_attr required
20
- - else
21
- span.param_attr optional
22
-
23
- - if repeat
24
- span.param_attr can repeat
25
-
26
- - unless type.nil?
27
- span.param_attr #{ type } type
28
-
29
- - unless default.nil?
30
- span.param_attr
31
- | default
32
- span.param_val< = default
33
-
34
- - unless enum.nil?
35
- span.param_attr
36
- | one of
37
- span.param_val< = enum.join ', '
38
-
39
- - unless pattern.nil?
40
- span.param_attr must match #{ pattern.inspect }
41
-
42
- - if min_length and max_length
43
- - if min_length == max_length
44
- span.param_attr length #{ min_length }
45
- - else
46
- span.param_attr #{ min_length }-#{ max_length } length
47
- - elsif min_length
48
- span.param_attr min length #{ min_length }
49
- - elsif max_length
50
- span.param_attr max length #{ max_length }
51
-
52
- - unless minimum.nil?
53
- span.param_attr
54
- | minimum
55
- span.param_val< = minimum
56
-
57
- - unless maximum.nil?
58
- span.param_attr
59
- | maximum
60
- span.param_val< = maximum
61
-
62
- - unless example.nil?
63
- span.param_attr
64
- | example
65
- span.param_val< = example
66
-
67
- - unless description.nil?
68
- .param_description == html_description
@@ -1,15 +0,0 @@
1
- == collapse 5, media_type
2
- - if schema
3
- == collapse 5, 'Schema'
4
- pre: code.schema
5
- == schema.document
6
-
7
- - elsif web_form? and not form_parameters.empty?
8
- == collapse 5, 'Web Form Parameters'
9
- - for parameter in form_parameters.values
10
- == parameter.document
11
-
12
- - if example
13
- == collapse 5, 'Example'
14
- pre: code.example
15
- == highlight example, media_type
@@ -1,10 +0,0 @@
1
- section
2
- label for="collapse-#{cid}"
3
- <h#{level}>
4
- ==> highlight_url_params Temple::Utils.escape_html title
5
- - if display_name
6
- | (#{display_name})
7
- </h#{level}>
8
- input type="checkbox" id="collapse-#{cid}" checked=true aria-hidden="true"
9
- .collapse_content
10
- == content
@@ -1,2 +0,0 @@
1
- == collapse 2, title
2
- == html_content
@@ -1,38 +0,0 @@
1
- == collapse 3, name, display_name
2
-
3
- - unless traits.empty? and protocols.empty?
4
- .properties
5
- - unless traits.empty?
6
- div
7
- span.property traits:
8
- =< traits.map(&:name).join ', '
9
-
10
- - unless protocols.empty?
11
- div
12
- span.property protocols:
13
- =< protocols.join ', '
14
-
15
- - if description
16
- .method_description == html_description
17
-
18
- - unless headers.empty? and query_parameters.empty? and bodies.empty?
19
- == collapse 4, 'Request'
20
-
21
- - unless headers.empty?
22
- == collapse 5, 'Request Headers'
23
- - for header in headers.values
24
- == header.document
25
-
26
- - unless query_parameters.empty?
27
- == collapse 5, 'Query Parameters'
28
- - for parameter in query_parameters.values
29
- == parameter.document
30
-
31
- - unless bodies.empty?
32
- - for body in bodies.values
33
- == body.document
34
-
35
- - unless responses.empty?
36
- == collapse 4, 'Responses'
37
- - for response in responses.values
38
- == response.document
@@ -1,33 +0,0 @@
1
- - if description || type || !traits.empty? || !methods.empty?
2
- == collapse 2, resource_path, display_name
3
-
4
- - if description
5
- div == html_description
6
-
7
- .properties
8
- - if type
9
- div
10
- span.property type:
11
- =< type.name
12
-
13
- - unless traits.empty?
14
- div
15
- span.property traits:
16
- =< traits.map(&:name).join ', '
17
-
18
- - unless base_uri_parameters.empty?
19
- == collapse 5, 'Base URI Parameters'
20
- - for parameter in base_uri_parameters.values
21
- == parameter.document
22
-
23
- - unless uri_parameters.empty?
24
- == collapse 5, 'URI Parameters'
25
- - for parameter in uri_parameters.values
26
- == parameter.document
27
-
28
- - unless methods.empty?
29
- - for method in methods.values
30
- == method.document
31
-
32
- - for resource in resources.values
33
- == resource.document
@@ -1,13 +0,0 @@
1
- == collapse 5, name, display_name
2
-
3
- - if description
4
- .response_description == html_description
5
-
6
- - unless headers.empty?
7
- == collapse 6, 'Headers'
8
- - for header in headers.values
9
- == header.document
10
-
11
- - unless bodies.empty?
12
- - for body in bodies.values
13
- == body.document
@@ -1,39 +0,0 @@
1
- doctype html
2
-
3
- head
4
- meta charset="utf-8"
5
- title
6
- => title
7
- - if version
8
- = version
9
- style type="text/css" == Rouge::Themes::Github.render(scope: '.highlight')
10
- style type="text/css" == style_sheet
11
-
12
- main
13
- h1.title
14
- => title
15
- - if version
16
- = version
17
-
18
- section
19
- - if base_uri
20
- .properties
21
- - unless protocols.nil? or protocols.empty?
22
- div
23
- span.property protocols:
24
- =< protocols.join ', '
25
- div
26
- span.property base uri:
27
- ==< highlight_url_params base_uri
28
- - unless base_uri_parameters.empty?
29
- == collapse 5, 'Base URI Parameters'
30
- - for parameter in base_uri_parameters.values
31
- == parameter.document
32
-
33
- - unless documents.empty?
34
- .documentation
35
- - for document in documents
36
- == document.document
37
-
38
- - for resource in resources.values
39
- == resource.document
@@ -1,119 +0,0 @@
1
- @import url(http://fonts.googleapis.com/css?family=Inconsolata);
2
-
3
- html {
4
- -webkit-font-smoothing: antialiased;
5
- font-family: Palatino, "Palatino Linotype", "Palatino LT STD", "Book Antiqua", Georgia, serif;
6
- font-size: 11pt;
7
- }
8
- main {
9
- display: block;
10
- width: 75em;
11
- margin-left: auto;
12
- margin-right: auto;
13
- margin-top: 2em;
14
- margin-bottom: 2em;
15
- }
16
-
17
- h1.title {
18
- font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
19
- font-weight: 300;
20
- font-size: 24pt;
21
- }
22
- h2 {
23
- font-family: "Inconsolata", monospace;
24
- font-size: 16pt;
25
- font-weight: normal;
26
- margin-bottom: 0.25em;
27
- }
28
- h3 {
29
- font-size: 15pt;
30
- font-weight: normal;
31
- color: #444;
32
- }
33
- h4 {
34
- font-size: 14pt;
35
- font-weight: normal;
36
- font-style: italic;
37
- color: #444;
38
- }
39
- h5 {
40
- font-size: 11pt;
41
- font-style: italic;
42
- color: #333;
43
- margin-top: 1em;
44
- margin-bottom: 1em;
45
- }
46
- h6 {
47
- font-size: 11pt;
48
- font-weight: normal;
49
- text-decoration: underline;
50
- margin-top: 1em;
51
- margin-bottom: 1em;
52
- }
53
-
54
- .documentation {
55
- margin-bottom: 3em;
56
- }
57
-
58
- .properties {
59
- margin-bottom: 1.25em;
60
- }
61
-
62
- .property {
63
- font-variant: small-caps;
64
- font-size: 1.15em;
65
- color: #252525;
66
- margin-right: 0.3em;
67
- }
68
-
69
- .param {
70
- margin-bottom: .75em;
71
- }
72
- .param_names {
73
- margin-right: 1em;
74
- }
75
- .param_name {
76
- font-family: "Inconsolata", monospace;
77
- font-weight: bold;
78
- color: #444;
79
- }
80
- .param_attrs {
81
- // float: right;
82
- color: #555;
83
- font-style: italic;
84
- }
85
- .param_attr {
86
- margin-right: 0.5em;
87
- }
88
- .param_attr:after {
89
- content: ', '
90
- }
91
- .param_attr:last-child:after {
92
- content: ''
93
- }
94
- .param_val {
95
- color: #000;
96
- }
97
- .param_description {
98
- margin-top: 0.5em;
99
- margin-left: 1em;
100
- color: #252525;
101
- }
102
-
103
- .method_description {
104
- color: #252525;
105
- }
106
- .response_description {
107
- color: #252525;
108
- }
109
-
110
- .url_param {
111
- color: red;
112
- }
113
-
114
- main section > .collapse_content { margin-left: 1em; }
115
- .subsection { margin-left: 1em; }
116
-
117
- label { cursor: pointer }
118
- input[type=checkbox] { display: none }
119
- input[type=checkbox]:checked ~ div { display: none }