rails_api_explorer 0.0.4.pre.1 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -19,17 +19,6 @@ And then execute:
19
19
 
20
20
  ## Usage
21
21
 
22
- ### Assets
23
- Include the JavaScript in your `application.js`, make sure to require it *after* jQuery:
24
-
25
- //= require jquery
26
- //= require api_explorer
27
-
28
- Include the CSS in `application.css`:
29
-
30
- *= require api_explorer
31
-
32
-
33
22
  ### Describe your API
34
23
  Describe your API in `config/initializers/api_explorer.rb`:
35
24
 
@@ -95,10 +84,6 @@ ApiExplorer.auth = lambda do
95
84
  end
96
85
  ```
97
86
 
98
- ## Notes
99
- The explorer is rendered within your application layout and uses bootstrap 3 classes, so it's prettier if you have that included.
100
- Bootstrap is optional, but it requires jQuery.
101
-
102
87
  ## Contributing
103
88
 
104
89
  1. Fork it
@@ -10,5 +10,6 @@
10
10
  // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
11
11
  // about supported directives.
12
12
  //
13
+ //= require jquery
13
14
  //= require api_explorer/serialize_object
14
15
  //= require api_explorer/explorer
@@ -9,6 +9,10 @@
9
9
  </head>
10
10
 
11
11
  <body>
12
- <%= yield %>
12
+ <div class="container">
13
+ <div class="col-sm-12">
14
+ <%= yield %>
15
+ </div>
16
+ </div>
13
17
  </body>
14
18
  </html>
@@ -1,3 +1,3 @@
1
1
  module ApiExplorer
2
- VERSION = "0.0.4.pre.1"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,8 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_api_explorer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4.pre.1
5
- prerelease: 6
4
+ version: 0.0.5
5
+ prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Max Hollmann
@@ -151,9 +151,6 @@ files:
151
151
  - app/helpers/api_explorer/application_helper.rb
152
152
  - app/helpers/api_explorer/explorer_helper.rb
153
153
  - app/assets/stylesheets/api_explorer/explorer.css
154
- - app/assets/stylesheets/api_explorer.css
155
- - app/assets/javascripts/api_explorer/explorer.js
156
- - app/assets/javascripts/api_explorer/scroll.js
157
154
  - app/assets/javascripts/api_explorer/serialize_object.js
158
155
  - app/assets/javascripts/api_explorer.js
159
156
  - app/views/api_explorer/explorer/_node.html.erb
@@ -204,9 +201,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
204
201
  required_rubygems_version: !ruby/object:Gem::Requirement
205
202
  none: false
206
203
  requirements:
207
- - - ! '>'
204
+ - - ! '>='
208
205
  - !ruby/object:Gem::Version
209
- version: 1.3.1
206
+ version: '0'
210
207
  requirements: []
211
208
  rubyforge_project:
212
209
  rubygems_version: 1.8.23
@@ -1,89 +0,0 @@
1
- // Generated by CoffeeScript 1.4.0
2
- (function() {
3
-
4
- $(function() {
5
- var setValuesFromRequest, updateShareds;
6
- $(".hidden").hide().removeClass("hidden");
7
- window.responses = {};
8
- $(".shared-input.header").change(function() {
9
- return updateShareds();
10
- });
11
- updateShareds = function() {
12
- return $(".shared-input.header").each(function() {
13
- var name;
14
- name = $(this).attr("data-name");
15
- return $(".shared.header[data-name=" + name + "]").val($(this).val());
16
- });
17
- };
18
- setValuesFromRequest = function(request) {
19
- $("[data-source-request='" + request + "']").each(function(input) {
20
- var v;
21
- v = eval("responses['" + request + "']" + $(this).attr("data-source-accessor"));
22
- return $(this).val(v);
23
- });
24
- return updateShareds();
25
- };
26
- $(".param input").prop("disabled", false);
27
- $(".send-toggle").click(function(event) {
28
- var param, send, setState;
29
- event.preventDefault();
30
- setState = function(elements, state) {
31
- return elements.each(function(i, el) {
32
- $(el).attr("data-send", state ? "true" : "false");
33
- $(el).find("input").first().prop("disabled", !state);
34
- $(el).find(".send-toggle").first().text(state ? "don't send" : "send");
35
- return $(el).find(".name").first().toggleClass("strikethrough", !state);
36
- });
37
- };
38
- param = $(this).closest(".param");
39
- send = param.attr("data-send") !== "true";
40
- setState(param.add(param.find(".param")), send);
41
- if (send) {
42
- return setState(param.parents(".param"), true);
43
- }
44
- });
45
- return $("form").submit(function(event) {
46
- var form, path, req;
47
- event.preventDefault();
48
- form = $(this);
49
- req = form.serializeObject().request;
50
- form.closest(".request").find(".status").html("Requesting...");
51
- path = req.path;
52
- if (req.url_params) {
53
- $.each(req.url_params, function(p, v) {
54
- return path = path.replace(":" + p, v);
55
- });
56
- }
57
- return $.ajax({
58
- url: path,
59
- type: req.method,
60
- headers: req.headers,
61
- data: req.params,
62
- dataType: 'json'
63
- }).always(function(data, status, error) {
64
- var code, key;
65
- if (status === 'success') {
66
- code = 200;
67
- key = req.method.toUpperCase() + ":" + req.path.replace(api_explorer_base_url, "");
68
- window.responses[key] = data;
69
- setValuesFromRequest(key);
70
- } else {
71
- code = data.status;
72
- try {
73
- data = $.parseJSON(data.responseText);
74
- } catch (SyntaxError) {
75
-
76
- }
77
- }
78
- if (code === 0) {
79
- form.closest(".request").find(".status").text("Can't reach server");
80
- return form.closest(".request").find(".response").hide();
81
- } else {
82
- form.closest(".request").find(".status").text(code);
83
- return form.closest(".request").find(".response").text(JSON.stringify(data, null, 4)).show();
84
- }
85
- });
86
- });
87
- });
88
-
89
- }).call(this);
@@ -1,39 +0,0 @@
1
- $(function() {
2
- /**
3
- * Check a href for an anchor. If exists, and in document, scroll to it.
4
- * If href argument ommited, assumes context (this) is HTML Element,
5
- * which will be the case when invoked by jQuery after an event
6
- */
7
- function scroll_if_anchor(href) {
8
- href = typeof(href) == "string" ? href : $(this).attr("href");
9
- if (typeof(href) == 'undefined') return
10
-
11
- var fromTop = 0;
12
-
13
- if ($(".navbar-fixed-top").length > 0) {
14
- fromTop = $(".navbar-fixed-top").height();
15
- }
16
-
17
- // If our Href points to a valid, non-empty anchor, and is on the same page (e.g. #foo)
18
- // Legacy jQuery and IE7 may have issues: http://stackoverflow.com/q/1593174
19
- if(href.indexOf("#") == 0) {
20
- var $target = $(href);
21
-
22
- // Older browser without pushState might flicker here, as they momentarily
23
- // jump to the wrong position (IE < 10)
24
- if($target.length) {
25
- $('html, body').animate({ scrollTop: $target.offset().top - fromTop });
26
- if(history && "pushState" in history) {
27
- history.pushState({}, document.title, window.location.pathname + href);
28
- return false;
29
- }
30
- }
31
- }
32
- }
33
-
34
- // When our page loads, check to see if it contains and anchor
35
- scroll_if_anchor(window.location.hash);
36
-
37
- // Intercept all anchor clicks
38
- $("body").on("click", "a", scroll_if_anchor);
39
- });
@@ -1,15 +0,0 @@
1
- /*
2
- * This is a manifest file that'll be compiled into application.css, which will include all the files
3
- * listed below.
4
- *
5
- * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
- * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
- *
8
- * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
- * compiled file so the styles you add here take precedence over styles defined in any styles
10
- * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
- * file per style scope.
12
- *
13
- *= require_tree ./api_explorer
14
- *= require_self
15
- */