angus-sdoc 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/lib/angus/definitions/base.rb +1 -0
- data/lib/angus/definitions/message.rb +5 -0
- data/lib/angus/definitions/message_field.rb +27 -0
- data/lib/angus/definitions_reader.rb +31 -2
- data/lib/angus/sdoc/version.rb +2 -2
- metadata +19 -18
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
MjMwNmJkMTI4YTQ1NGQ0M2YxOTBjZjI3OGY4N2U0NjU5ZWJlYjY2Yw==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f1e789e1dbc54103d3e5a3c77dba6921a183c2e2
|
4
|
+
data.tar.gz: a7c9c1940257b319fdb7718d5bb0f600e7a38f88
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
NGRjODY4YTY5NDU2OWQ5NmUwNTgzMzgxMWFkOGIzNzEwNWFiYWIxMzkwYTU1
|
11
|
-
MmI5ODg0NmY3OWFjNTU3MzM4ZDExYmRlMmZlNDA0Mzc2MGU3ZjY=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
ZTE0NjM3NmQyMTJkOTk0MTJiYTk1MjYwYTQxNWVjNjAzZjMyMDY3OWRkMmQw
|
14
|
-
YzE3NDdlY2VlZDVjOWJjODg3YjAyOTM3YjVmYTQxMTQ2YmUwODU2ODZkZjQ1
|
15
|
-
ZDU4NzFjY2E5OTgyMjI3NDk1ZmJmMzk5NjYzNTQ1MzJiNjA4ODY=
|
6
|
+
metadata.gz: 489847ef042e704b7e2ede824a5780b6527497d0f99c3bca6e152e4fba9d09a458b9b4148e26d708a473b56d83dd70e5ee594704c76fab88356e64a6d2a716a6
|
7
|
+
data.tar.gz: b86b74e9d35be027ac08367b98288f88f2549ff4a6f39bc9122e4438e324d8b51cca318fbb4e9d21e10d7292e2404f32bde13fed2e174a172847aa0f1a56d594
|
@@ -26,6 +26,11 @@ module Angus
|
|
26
26
|
# @!attribute [rw] text
|
27
27
|
# @return [String] when set this text overrides all others and is set as the message description.
|
28
28
|
attr_accessor :text
|
29
|
+
|
30
|
+
# @!attribute [rw] fields
|
31
|
+
# @return [Array<Field>] the fields for the message.
|
32
|
+
attr_accessor :fields
|
33
|
+
|
29
34
|
end
|
30
35
|
end
|
31
36
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Angus
|
2
|
+
module SDoc
|
3
|
+
class Definitions::MessageField
|
4
|
+
|
5
|
+
# @!attribute [rw] name
|
6
|
+
# @return [String] the name of the message field.
|
7
|
+
attr_accessor :name
|
8
|
+
|
9
|
+
# @!attribute [rw] description
|
10
|
+
# @return [String] the description of the message field.
|
11
|
+
attr_accessor :description
|
12
|
+
|
13
|
+
# @!attribute [rw] required
|
14
|
+
# @return [Boolean] indicates if the message field. is required or not.
|
15
|
+
attr_accessor :required
|
16
|
+
|
17
|
+
# @!attribute [rw] type
|
18
|
+
# @return [String] the type of the message field.
|
19
|
+
attr_accessor :type
|
20
|
+
|
21
|
+
# @!attribute [rw] elements_type
|
22
|
+
# @return [String] the elements type of the message field.
|
23
|
+
attr_accessor :elements_type
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -108,7 +108,7 @@ module Angus
|
|
108
108
|
|
109
109
|
messages_hash.each do |key, attrs|
|
110
110
|
messages[key] = build_message(key, attrs['level'], attrs['status_code'],
|
111
|
-
attrs['description'], attrs['text'])
|
111
|
+
attrs['description'], attrs['text'], attrs['fields'])
|
112
112
|
end
|
113
113
|
|
114
114
|
messages
|
@@ -127,7 +127,7 @@ module Angus
|
|
127
127
|
# was not specified.
|
128
128
|
#
|
129
129
|
# @return [Message] the message.
|
130
|
-
def build_message(key, level, status_code, description, text)
|
130
|
+
def build_message(key, level, status_code, description, text, fields)
|
131
131
|
unless level
|
132
132
|
raise Angus::SDoc::InvalidServiceMessage.new(key ,'Can not create message without level.')
|
133
133
|
end
|
@@ -142,11 +142,40 @@ module Angus
|
|
142
142
|
message.status_code = status_code
|
143
143
|
message.description = description
|
144
144
|
message.text = text
|
145
|
+
message.fields = (fields || []).map { |field| build_message_field(field['name'],
|
146
|
+
field['description'],
|
147
|
+
field['type'],
|
148
|
+
field['elements_type'],
|
149
|
+
field['required']) }
|
145
150
|
|
146
151
|
message
|
147
152
|
end
|
148
153
|
private :build_message
|
149
154
|
|
155
|
+
# Builds Definitions::Field with the message data.
|
156
|
+
#
|
157
|
+
# @param [String] key The message key.
|
158
|
+
# @param [String] level The message level.
|
159
|
+
# @param [String] status_code The message status code.
|
160
|
+
# @param [String] description The message description.
|
161
|
+
# @param [String] text The message text.
|
162
|
+
#
|
163
|
+
# @raise [Angus::SDoc::InvalidServiceMessage] if the level or the status code
|
164
|
+
# was not specified.
|
165
|
+
#
|
166
|
+
# @return [Message] the message.
|
167
|
+
def build_message_field(name, description, type, elements_type, required)
|
168
|
+
field = Angus::SDoc::Definitions::MessageField.new
|
169
|
+
field.name = name
|
170
|
+
field.description = description
|
171
|
+
field.type = type
|
172
|
+
field.elements_type = elements_type
|
173
|
+
field.required = required
|
174
|
+
|
175
|
+
field
|
176
|
+
end
|
177
|
+
private :build_message_field
|
178
|
+
|
150
179
|
# Builds Definitions::ProxyOperation objects for each proxy operation metadata.
|
151
180
|
#
|
152
181
|
# @param [Hash] proxy_operations_hash The proxy operations metadata.
|
data/lib/angus/sdoc/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: angus-sdoc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pablo Ifran
|
@@ -10,20 +10,20 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2014-
|
13
|
+
date: 2014-12-29 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rake
|
17
17
|
requirement: !ruby/object:Gem::Requirement
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - ">="
|
20
20
|
- !ruby/object:Gem::Version
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
|
-
- -
|
26
|
+
- - ">="
|
27
27
|
- !ruby/object:Gem::Version
|
28
28
|
version: '0'
|
29
29
|
- !ruby/object:Gem::Dependency
|
@@ -44,42 +44,42 @@ dependencies:
|
|
44
44
|
name: rspec
|
45
45
|
requirement: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
|
-
- - ~>
|
47
|
+
- - "~>"
|
48
48
|
- !ruby/object:Gem::Version
|
49
49
|
version: '2.12'
|
50
50
|
type: :development
|
51
51
|
prerelease: false
|
52
52
|
version_requirements: !ruby/object:Gem::Requirement
|
53
53
|
requirements:
|
54
|
-
- - ~>
|
54
|
+
- - "~>"
|
55
55
|
- !ruby/object:Gem::Version
|
56
56
|
version: '2.12'
|
57
57
|
- !ruby/object:Gem::Dependency
|
58
58
|
name: factory_girl
|
59
59
|
requirement: !ruby/object:Gem::Requirement
|
60
60
|
requirements:
|
61
|
-
- -
|
61
|
+
- - ">="
|
62
62
|
- !ruby/object:Gem::Version
|
63
63
|
version: '0'
|
64
64
|
type: :development
|
65
65
|
prerelease: false
|
66
66
|
version_requirements: !ruby/object:Gem::Requirement
|
67
67
|
requirements:
|
68
|
-
- -
|
68
|
+
- - ">="
|
69
69
|
- !ruby/object:Gem::Version
|
70
70
|
version: '0'
|
71
71
|
- !ruby/object:Gem::Dependency
|
72
72
|
name: json_expressions
|
73
73
|
requirement: !ruby/object:Gem::Requirement
|
74
74
|
requirements:
|
75
|
-
- -
|
75
|
+
- - ">="
|
76
76
|
- !ruby/object:Gem::Version
|
77
77
|
version: '0'
|
78
78
|
type: :development
|
79
79
|
prerelease: false
|
80
80
|
version_requirements: !ruby/object:Gem::Requirement
|
81
81
|
requirements:
|
82
|
-
- -
|
82
|
+
- - ">="
|
83
83
|
- !ruby/object:Gem::Version
|
84
84
|
version: '0'
|
85
85
|
- !ruby/object:Gem::Dependency
|
@@ -128,19 +128,20 @@ dependencies:
|
|
128
128
|
name: ci_reporter
|
129
129
|
requirement: !ruby/object:Gem::Requirement
|
130
130
|
requirements:
|
131
|
-
- -
|
131
|
+
- - ">="
|
132
132
|
- !ruby/object:Gem::Version
|
133
133
|
version: '0'
|
134
134
|
type: :development
|
135
135
|
prerelease: false
|
136
136
|
version_requirements: !ruby/object:Gem::Requirement
|
137
137
|
requirements:
|
138
|
-
- -
|
138
|
+
- - ">="
|
139
139
|
- !ruby/object:Gem::Version
|
140
140
|
version: '0'
|
141
|
-
description:
|
142
|
-
|
143
|
-
|
141
|
+
description: |2
|
142
|
+
Used to read the documentation of a service built in angus (but also is able to read any kind
|
143
|
+
of documentation that follow the angus structure), and generate an object representation of
|
144
|
+
that documentation.
|
144
145
|
email:
|
145
146
|
- angus@moove-it.com
|
146
147
|
executables: []
|
@@ -153,6 +154,7 @@ files:
|
|
153
154
|
- lib/angus/definitions/glossary.rb
|
154
155
|
- lib/angus/definitions/glossary_term.rb
|
155
156
|
- lib/angus/definitions/message.rb
|
157
|
+
- lib/angus/definitions/message_field.rb
|
156
158
|
- lib/angus/definitions/operation.rb
|
157
159
|
- lib/angus/definitions/proxy_operation.rb
|
158
160
|
- lib/angus/definitions/representation.rb
|
@@ -182,12 +184,12 @@ require_paths:
|
|
182
184
|
- lib
|
183
185
|
required_ruby_version: !ruby/object:Gem::Requirement
|
184
186
|
requirements:
|
185
|
-
- -
|
187
|
+
- - ">="
|
186
188
|
- !ruby/object:Gem::Version
|
187
189
|
version: '0'
|
188
190
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
189
191
|
requirements:
|
190
|
-
- -
|
192
|
+
- - ">="
|
191
193
|
- !ruby/object:Gem::Version
|
192
194
|
version: '0'
|
193
195
|
requirements: []
|
@@ -197,4 +199,3 @@ signing_key:
|
|
197
199
|
specification_version: 4
|
198
200
|
summary: Expose service API documentation.
|
199
201
|
test_files: []
|
200
|
-
has_rdoc:
|