api_explorer 0.0.1 → 0.0.2
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.
- data/README.rdoc +43 -2
- data/lib/api_explorer/version.rb +1 -1
- data/test/dummy/lib/file2.json +2 -4
- metadata +17 -1
data/README.rdoc
CHANGED
@@ -7,7 +7,48 @@ The only precondition is that it requires a multithreaded rails server.
|
|
7
7
|
|
8
8
|
Instructions:
|
9
9
|
|
10
|
-
- gem
|
10
|
+
- gem 'thin', '~> 1.6.1'
|
11
11
|
- bundle install
|
12
12
|
- Add to development.rb (or production.rb): config.thread_safe!
|
13
|
-
|
13
|
+
|
14
|
+
|
15
|
+
|
16
|
+
Create a file named ws_specification.json (or any name you desire) and place it on /lib.
|
17
|
+
|
18
|
+
As an example:
|
19
|
+
|
20
|
+
{
|
21
|
+
"methods": [ {
|
22
|
+
"name": "Users index",
|
23
|
+
"url": "v1/users",
|
24
|
+
"description": "The index of users",
|
25
|
+
"method": "GET",
|
26
|
+
"parameters": [{"name": "API_TOKEN"}]
|
27
|
+
},
|
28
|
+
{
|
29
|
+
"name": "User login",
|
30
|
+
"url": "v1/users/login",
|
31
|
+
"description": "Users login",
|
32
|
+
"method": "POST",
|
33
|
+
"parameters": [{"name": "API_TOKEN"}, {"name": "email"}, {"name": "password"}]
|
34
|
+
}
|
35
|
+
]
|
36
|
+
}
|
37
|
+
|
38
|
+
|
39
|
+
Create an initializer in /config/initializers/api_explorer.rb with the following content:
|
40
|
+
|
41
|
+
ApiExplorer::use_file = true
|
42
|
+
ApiExplorer::json_path = 'lib/ws_specification.json'
|
43
|
+
|
44
|
+
|
45
|
+
|
46
|
+
And finally mount the engine on config/routes.rb
|
47
|
+
|
48
|
+
mount ApiExplorer::Engine => "/api_explorer"
|
49
|
+
|
50
|
+
|
51
|
+
- Start the server with "thin start --threaded"
|
52
|
+
|
53
|
+
Then go to http://localhost:3000/api_explorer
|
54
|
+
|
data/lib/api_explorer/version.rb
CHANGED
data/test/dummy/lib/file2.json
CHANGED
@@ -4,16 +4,14 @@
|
|
4
4
|
"url": "v1/users",
|
5
5
|
"description": "The index of users",
|
6
6
|
"method": "GET",
|
7
|
-
"parameters": [{"name": "API_TOKEN"}]
|
8
|
-
"http_headers": [{"X-USER-ID": "ASSAJISIJA"}]
|
7
|
+
"parameters": [{"name": "API_TOKEN"}]
|
9
8
|
},
|
10
9
|
{
|
11
10
|
"name": "User login",
|
12
11
|
"url": "v1/users/login",
|
13
12
|
"description": "Users login",
|
14
13
|
"method": "POST",
|
15
|
-
"parameters": [{"name": "API_TOKEN"}, {"name": "email"}, {"name": "password"}]
|
16
|
-
"http_headers": [{"X-USER-ID": "6"}, {"X-API-ID": "JAOSIJAS"}]
|
14
|
+
"parameters": [{"name": "API_TOKEN"}, {"name": "email"}, {"name": "password"}]
|
17
15
|
}
|
18
16
|
]
|
19
17
|
}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: api_explorer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -43,6 +43,22 @@ dependencies:
|
|
43
43
|
- - ! '>='
|
44
44
|
- !ruby/object:Gem::Version
|
45
45
|
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: coderay
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 1.1.0
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.1.0
|
46
62
|
description: https://github.com/toptierlabs/api_explorer
|
47
63
|
email:
|
48
64
|
- afigueroa@toptierlabs.com
|