raddocs 1.0.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/raddocs/models.rb +14 -5
- data/lib/views/example.haml +3 -0
- data/lib/views/guide.erb +6 -6
- data/lib/views/index.haml +3 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5043b44d22752b964fc9a570ef8a2788e052b40c
|
4
|
+
data.tar.gz: 311bb2c3b45d3707d2da468e65fe685f68c5b438
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b17b829952b94d6730582268d63c3b1fa72d26fe4f08c40b54cb54a75db48b4cff2439b9f2167c3a1e03c5148c1e4410ba84ba173d22aea80749ec97cbc37bcf
|
7
|
+
data.tar.gz: 3c9f051091ae8ee325b8d985ea236510cbe1f3d675d3bee556aa1cfe3d9f532198a54c898eb8d029c06584a85bb8a1e0a86a83562e500ae05866fa5a0bf53ae0
|
data/lib/raddocs/models.rb
CHANGED
@@ -8,19 +8,23 @@ module Raddocs
|
|
8
8
|
# @return [Array] array of {Raddocs::Resource Resources}
|
9
9
|
def resources
|
10
10
|
@attrs.fetch("resources", {}).map do |resource|
|
11
|
-
Resource.new(resource["name"], resource["examples"])
|
11
|
+
Resource.new(resource["name"], resource["explanation"], resource["examples"])
|
12
12
|
end
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
16
|
# Group of examples related to a specific resource, eg "Orders"
|
17
|
-
class Resource < Struct.new(:name, :examples)
|
17
|
+
class Resource < Struct.new(:name, :explanation, :examples)
|
18
18
|
# @return [Array] array of {Raddocs::IndexExample IndexExamples}
|
19
19
|
def examples
|
20
20
|
@examples ||= super.map do |example|
|
21
21
|
IndexExample.new(example)
|
22
22
|
end
|
23
23
|
end
|
24
|
+
|
25
|
+
def explanation?
|
26
|
+
!explanation.nil?
|
27
|
+
end
|
24
28
|
end
|
25
29
|
|
26
30
|
# Example model for the index page
|
@@ -42,17 +46,18 @@ module Raddocs
|
|
42
46
|
|
43
47
|
# Example page model
|
44
48
|
class Example
|
45
|
-
attr_reader :resource, :description, :explanation, :parameters, :response_fields,
|
49
|
+
attr_reader :resource, :resource_explanation, :description, :explanation, :parameters, :response_fields,
|
46
50
|
:requests
|
47
51
|
|
48
52
|
def initialize(file)
|
49
53
|
@attrs = JSON.parse(File.read(file))
|
50
|
-
|
54
|
+
@resource_explanation = @attrs.fetch("resource_explanation", nil)
|
51
55
|
@resource = @attrs.fetch("resource")
|
56
|
+
|
52
57
|
@description = @attrs.fetch("description")
|
53
58
|
@explanation = @attrs.fetch("explanation", nil)
|
54
59
|
@parameters = Parameters.new(@attrs.fetch("parameters"))
|
55
|
-
@response_fields = ResponseFields.new(@attrs.fetch("response_fields"))
|
60
|
+
@response_fields = ResponseFields.new(@attrs.fetch("response_fields", []))
|
56
61
|
@requests = @attrs.fetch("requests").map { |request| Request.new(request) }
|
57
62
|
end
|
58
63
|
|
@@ -60,6 +65,10 @@ module Raddocs
|
|
60
65
|
def explanation?
|
61
66
|
!explanation.nil?
|
62
67
|
end
|
68
|
+
|
69
|
+
def resource_explanation?
|
70
|
+
!resource_explanation.nil?
|
71
|
+
end
|
63
72
|
end
|
64
73
|
|
65
74
|
# Guide page model
|
data/lib/views/example.haml
CHANGED
data/lib/views/guide.erb
CHANGED
@@ -6,12 +6,12 @@
|
|
6
6
|
<link rel="stylesheet" href="<%= file %>" />
|
7
7
|
<% end %>
|
8
8
|
|
9
|
-
<script src="
|
10
|
-
<script src="
|
11
|
-
<script src="
|
12
|
-
<script src="
|
13
|
-
<script src="
|
14
|
-
<script src="
|
9
|
+
<script src="<%= url_location %>/js/jquery-1-7-2.js"></script>
|
10
|
+
<script src="<%= url_location %>/js/codemirror.js"></script>
|
11
|
+
<script src="<%= url_location %>/js/mode/css/css.js"></script>
|
12
|
+
<script src="<%= url_location %>/js/mode/htmlmixed/htmlmixed.js"></script>
|
13
|
+
<script src="<%= url_location %>/js/mode/javascript/javascript.js"></script>
|
14
|
+
<script src="<%= url_location %>/js/mode/xml/xml.js"></script>
|
15
15
|
|
16
16
|
<style>
|
17
17
|
td.required .name:after {
|
data/lib/views/index.haml
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: raddocs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Oestrich
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-05-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sinatra
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.0'
|
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
|
-
version: '
|
26
|
+
version: '2.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: haml
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|