api_explorer 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/README.md +122 -0
  2. data/lib/api_explorer/version.rb +1 -1
  3. metadata +2 -2
  4. data/README.rdoc +0 -54
@@ -0,0 +1,122 @@
1
+ # API Explorer
2
+
3
+ API Explorer is a tool that reads a specification and creates a console where developers can test their own web services.
4
+
5
+ ## Features
6
+
7
+ - Loads API specification from a file or a string
8
+ - Multiple HTTP methods supported: GET, POST, PUT, DELETE
9
+ - Syntax highlighting for Json, XML and HTTP responses.
10
+ - History of requests/responses
11
+ - Specify HTTP headers
12
+ - Specify Request parameters
13
+ - Show description of the web service, which can be used as a documentation of the web services.
14
+
15
+ ## Precondition
16
+ Given that it makes a request to the same server, it requires a multi-threaded server. On this example we will use 'thin' but it should work with 'unicorn' as well.
17
+
18
+
19
+ ## Configure thin server on threaded mode (it should work with unicorn also)
20
+
21
+ Add thin to the Gemfile.
22
+ ```
23
+ gem 'thin', '~> 1.6.1'
24
+ ```
25
+
26
+ Bundle install
27
+ ```
28
+ bundle install
29
+ ```
30
+
31
+
32
+ Set thread dsafe mode in development.rb (or the right environment)
33
+
34
+ ```
35
+ config.thread_safe!
36
+ ```
37
+
38
+ Test the server by running it with:
39
+ ```
40
+ thin start --threaded
41
+ ```
42
+
43
+ ## Install the gem
44
+
45
+ Add the gem to the Gemfile.
46
+
47
+ ```
48
+ gem 'api_explorer'
49
+ ```
50
+
51
+ Create a file named ws_specification.json (or any name you desire) and place it on /lib. An example can be:
52
+
53
+ ```
54
+ { "methods": [
55
+ { "name": "Users index",
56
+ "url": "v1/users",
57
+ "description": "The index of users",
58
+ "method": "GET",
59
+ "parameters": [{"name": "API_TOKEN"}]
60
+ },
61
+ { "name": "User login",
62
+ "url": "v1/users/login",
63
+ "description": "Users login",
64
+ "method": "POST",
65
+ "parameters": [{"name": "API_TOKEN"}, {"name": "email"}, {"name": "password"}]
66
+ }
67
+ ]
68
+ }
69
+ ```
70
+
71
+ Create an initializer in /config/initializers/api_explorer.rb with the following content:
72
+
73
+ ```
74
+ ApiExplorer::use_file = true
75
+ ApiExplorer::json_path = ‘lib/ws_specification.json’
76
+ ```
77
+
78
+ Another option can be:
79
+ ```
80
+ ApiExplorer::use_file = false
81
+ ApiExplorer::json_string = { ... - Web services specification - ....}
82
+ ```
83
+
84
+ And install all dependencies:
85
+
86
+ ```
87
+ bundle install
88
+ ```
89
+
90
+ And finally mount the engine on config/routes.rb
91
+ ```
92
+ mount ApiExplorer::Engine => '/api_explorer'
93
+ ```
94
+
95
+ That's it. Its ready to go.
96
+
97
+
98
+ ## Run
99
+
100
+ Start thin
101
+
102
+ ```
103
+ thin start --threaded
104
+ ```
105
+
106
+ And go to
107
+
108
+ ```
109
+ http://localhost:3000/api_explorer
110
+ ```
111
+
112
+ ## Contribute
113
+
114
+ - Fork project
115
+ - Add features
116
+ - Run tests
117
+ - Send pull request
118
+
119
+ ## License
120
+
121
+ See LICENSE file for details
122
+ Developed at [TopTier labs](http://www.toptierlabs.com/ "TopTier labs")
@@ -1,3 +1,3 @@
1
1
  module ApiExplorer
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
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.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -108,7 +108,7 @@ files:
108
108
  - lib/tasks/api_explorer_tasks.rake
109
109
  - MIT-LICENSE
110
110
  - Rakefile
111
- - README.rdoc
111
+ - README.md
112
112
  - test/api_explorer_test.rb
113
113
  - test/dummy/app/assets/javascripts/application.js
114
114
  - test/dummy/app/assets/stylesheets/application.css
@@ -1,54 +0,0 @@
1
- = ApiExplorer
2
-
3
- This project is intended to be mounte on an existing Rails Application.
4
-
5
-
6
- The only precondition is that it requires a multithreaded rails server.
7
-
8
- Instructions:
9
-
10
- - gem 'thin', '~> 1.6.1'
11
- - bundle install
12
- - Add to development.rb (or production.rb): config.thread_safe!
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
-