apidoco 1.2.0 → 1.3.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 39f1a2c7a190223f718f59d453ae376c894565a4
4
- data.tar.gz: 3410841490a9e021dcc754dea4a2de9848318fb8
3
+ metadata.gz: b50213662ec2a1915fb036922e4df1c22dc93466
4
+ data.tar.gz: 1fa99c664b15ed0713e2dae12d5f697ceecc2331
5
5
  SHA512:
6
- metadata.gz: 0bcb6f7c99a5b1132d495efcfac384249f0392d864727bfbb8765eee63e47a5a6d1c066536cb8e7de6ff05407dfe672f20fbabff15514fcb3a5b3d5778111148
7
- data.tar.gz: 1ee1e1f63e806bcc2720e10fe0a8e236d97f8a6afc7459a43fdfa9b303ce3b16c2638cbda728c1cd88862f1aca74913e2c226908a34b38923c229e1f4916a9c7
6
+ metadata.gz: 13cc77b6575ac454869087f7a961fa67d71bf6372131d00705b6563004418d8948d1ecd34564afaa4505621ec8e9ed6d3fa917793e6d00ab158bcb53c07f9af4
7
+ data.tar.gz: ac3f2ffd8b016b42002793954fd9d7455eab48360843a94e4eb508567ab644c60c9dc42070dce37f68353f1502370ccc2ec89a75aea9b0a495a3ea37fd61d532
data/README.md CHANGED
@@ -1,6 +1,12 @@
1
- # Apidoco
1
+ [![Gem Version](https://badge.fury.io/rb/apidoco.svg)](https://badge.fury.io/rb/apidoco)
2
+
3
+ # Apidoco - Ruby on Rails API documentation tool
2
4
  Easy documentation of REST APIs - [Demo](https://apidoco-demo.herokuapp.com/docs/).
3
5
 
6
+ ## Screenshots
7
+
8
+ ![screeshot 1](https://github.com/72pulses/apidoco/blob/master/images/1.jpg?raw=true)
9
+
4
10
 
5
11
  ## Installation
6
12
  Add this line to your application's Gemfile:
@@ -20,6 +26,15 @@ Add this line to your routes:
20
26
  mount Apidoco::Engine, at: "/docs"
21
27
  ```
22
28
 
29
+ ## How to add authentication
30
+
31
+ Create a configuration file in initializers e.g. /config/initializers/apidoco.rb and add the following.
32
+
33
+ ```ruby
34
+ Apidoco.auth_name = 'authentication_name'
35
+ Apidoco.auth_password = 'authentication_password'
36
+ ```
37
+
23
38
  ## Generators
24
39
 
25
40
  To create a Api documentation file for an action:
@@ -51,12 +66,6 @@ will create the following files with sample content
51
66
  - docs/api/v1/posts/download.json
52
67
  - docs/api/v1/posts/upload.json
53
68
 
54
- ## Contributing
55
- Contribution directions go here.
56
-
57
- ## License
58
- The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
59
-
60
69
  ### Sample API documentation format
61
70
 
62
71
  ```
@@ -97,7 +106,9 @@ The gem is available as open source under the terms of the [MIT License](http://
97
106
  }
98
107
  }]
99
108
  }
109
+ ```
100
110
 
111
+ ```
101
112
  // docs/api/v1/posts/edit.json
102
113
  {
103
114
  "published": true,
@@ -140,10 +151,12 @@ The gem is available as open source under the terms of the [MIT License](http://
140
151
  "http_method": "POST",
141
152
  "params": [{
142
153
  "key": "post['name']",
143
- "required": true
154
+ "required": true,
155
+ "type": "String"
144
156
  }, {
145
157
  "key": "post['content']",
146
- "required": false
158
+ "required": false,
159
+ "type": "String"
147
160
  }],
148
161
  "examples": [{
149
162
  "request": {
@@ -162,3 +175,20 @@ The gem is available as open source under the terms of the [MIT License](http://
162
175
  }]
163
176
  }
164
177
  ```
178
+
179
+ ## Documentation format reference
180
+
181
+
182
+ | Key | Description | Default | Example |
183
+ | --- | --- | --- | --- |
184
+ | `published` | Set this to false if you do not want to list this api | `true` | -- |
185
+ | `sort_order` | The order of the api in the documenatation | 0 | `"sort_order": 10` |
186
+ | `name` | Name of the api | --- | --- |
187
+ | `end_point` | --- | --- | `"end_point": "/posts"` |
188
+ | `http_method` | The HTTP method of the API | --- | `"http_method": "GET"` |
189
+ | `params` | Parameters to be used | --- | `"params: [{ "key": "post['name']", "required": true, "type": "String" }]"` |
190
+ | `examples` | Array of sample requests and responses | --- | `[{ "request": { "post": { "name": "I was scared" } } }, "response": { "message": "Post was successfully created", "id": 101 } }]`
191
+
192
+
193
+ ## License
194
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
@@ -1,3 +1,3 @@
1
- angular.module('apiDocoApp', ['duScroll'])
1
+ angular.module('apiDocoApp', ['duScroll', 'ngclipboard'])
2
2
  .value('duScrollOffset', 250) // offset from top to the div
3
3
  .value('duScrollBottomSpy', true); // To make the last du-scrollspy link active when scroll reaches page/container bottom
@@ -15,7 +15,9 @@
15
15
  //= require apidoco/jquery.min
16
16
  //= require apidoco/jquery.json-viewer
17
17
  //= require apidoco/bootstrap/bootstrap.min
18
+ //= require apidoco/clipboard.min
18
19
  //= require apidoco/directives/angular_scroll.min
20
+ //= require apidoco/directives/ngclipboard
19
21
  //= require apidoco/apidoco_app
20
22
  //= require apidoco/directives/jq_json_viewer
21
23
  //= require apidoco/controllers/documentations_controller
@@ -0,0 +1,7 @@
1
+ /*!
2
+ * clipboard.js v1.6.0
3
+ * https://zenorocha.github.io/clipboard.js
4
+ *
5
+ * Licensed MIT © Zeno Rocha
6
+ */
7
+ !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.Clipboard=e()}}(function(){var e,t,n;return function e(t,n,o){function i(a,c){if(!n[a]){if(!t[a]){var l="function"==typeof require&&require;if(!c&&l)return l(a,!0);if(r)return r(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var s=n[a]={exports:{}};t[a][0].call(s.exports,function(e){var n=t[a][1][e];return i(n?n:e)},s,s.exports,e,t,n,o)}return n[a].exports}for(var r="function"==typeof require&&require,a=0;a<o.length;a++)i(o[a]);return i}({1:[function(e,t,n){function o(e,t){for(;e&&e.nodeType!==i;){if(e.matches(t))return e;e=e.parentNode}}var i=9;if(Element&&!Element.prototype.matches){var r=Element.prototype;r.matches=r.matchesSelector||r.mozMatchesSelector||r.msMatchesSelector||r.oMatchesSelector||r.webkitMatchesSelector}t.exports=o},{}],2:[function(e,t,n){function o(e,t,n,o,r){var a=i.apply(this,arguments);return e.addEventListener(n,a,r),{destroy:function(){e.removeEventListener(n,a,r)}}}function i(e,t,n,o){return function(n){n.delegateTarget=r(n.target,t),n.delegateTarget&&o.call(e,n)}}var r=e("./closest");t.exports=o},{"./closest":1}],3:[function(e,t,n){n.node=function(e){return void 0!==e&&e instanceof HTMLElement&&1===e.nodeType},n.nodeList=function(e){var t=Object.prototype.toString.call(e);return void 0!==e&&("[object NodeList]"===t||"[object HTMLCollection]"===t)&&"length"in e&&(0===e.length||n.node(e[0]))},n.string=function(e){return"string"==typeof e||e instanceof String},n.fn=function(e){var t=Object.prototype.toString.call(e);return"[object Function]"===t}},{}],4:[function(e,t,n){function o(e,t,n){if(!e&&!t&&!n)throw new Error("Missing required arguments");if(!c.string(t))throw new TypeError("Second argument must be a String");if(!c.fn(n))throw new TypeError("Third argument must be a Function");if(c.node(e))return i(e,t,n);if(c.nodeList(e))return r(e,t,n);if(c.string(e))return a(e,t,n);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList")}function i(e,t,n){return e.addEventListener(t,n),{destroy:function(){e.removeEventListener(t,n)}}}function r(e,t,n){return Array.prototype.forEach.call(e,function(e){e.addEventListener(t,n)}),{destroy:function(){Array.prototype.forEach.call(e,function(e){e.removeEventListener(t,n)})}}}function a(e,t,n){return l(document.body,e,t,n)}var c=e("./is"),l=e("delegate");t.exports=o},{"./is":3,delegate:2}],5:[function(e,t,n){function o(e){var t;if("SELECT"===e.nodeName)e.focus(),t=e.value;else if("INPUT"===e.nodeName||"TEXTAREA"===e.nodeName){var n=e.hasAttribute("readonly");n||e.setAttribute("readonly",""),e.select(),e.setSelectionRange(0,e.value.length),n||e.removeAttribute("readonly"),t=e.value}else{e.hasAttribute("contenteditable")&&e.focus();var o=window.getSelection(),i=document.createRange();i.selectNodeContents(e),o.removeAllRanges(),o.addRange(i),t=o.toString()}return t}t.exports=o},{}],6:[function(e,t,n){function o(){}o.prototype={on:function(e,t,n){var o=this.e||(this.e={});return(o[e]||(o[e]=[])).push({fn:t,ctx:n}),this},once:function(e,t,n){function o(){i.off(e,o),t.apply(n,arguments)}var i=this;return o._=t,this.on(e,o,n)},emit:function(e){var t=[].slice.call(arguments,1),n=((this.e||(this.e={}))[e]||[]).slice(),o=0,i=n.length;for(o;o<i;o++)n[o].fn.apply(n[o].ctx,t);return this},off:function(e,t){var n=this.e||(this.e={}),o=n[e],i=[];if(o&&t)for(var r=0,a=o.length;r<a;r++)o[r].fn!==t&&o[r].fn._!==t&&i.push(o[r]);return i.length?n[e]=i:delete n[e],this}},t.exports=o},{}],7:[function(t,n,o){!function(i,r){if("function"==typeof e&&e.amd)e(["module","select"],r);else if("undefined"!=typeof o)r(n,t("select"));else{var a={exports:{}};r(a,i.select),i.clipboardAction=a.exports}}(this,function(e,t){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=n(t),r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),c=function(){function e(t){o(this,e),this.resolveOptions(t),this.initSelection()}return a(e,[{key:"resolveOptions",value:function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.action=t.action,this.emitter=t.emitter,this.target=t.target,this.text=t.text,this.trigger=t.trigger,this.selectedText=""}},{key:"initSelection",value:function e(){this.text?this.selectFake():this.target&&this.selectTarget()}},{key:"selectFake",value:function e(){var t=this,n="rtl"==document.documentElement.getAttribute("dir");this.removeFake(),this.fakeHandlerCallback=function(){return t.removeFake()},this.fakeHandler=document.body.addEventListener("click",this.fakeHandlerCallback)||!0,this.fakeElem=document.createElement("textarea"),this.fakeElem.style.fontSize="12pt",this.fakeElem.style.border="0",this.fakeElem.style.padding="0",this.fakeElem.style.margin="0",this.fakeElem.style.position="absolute",this.fakeElem.style[n?"right":"left"]="-9999px";var o=window.pageYOffset||document.documentElement.scrollTop;this.fakeElem.style.top=o+"px",this.fakeElem.setAttribute("readonly",""),this.fakeElem.value=this.text,document.body.appendChild(this.fakeElem),this.selectedText=(0,i.default)(this.fakeElem),this.copyText()}},{key:"removeFake",value:function e(){this.fakeHandler&&(document.body.removeEventListener("click",this.fakeHandlerCallback),this.fakeHandler=null,this.fakeHandlerCallback=null),this.fakeElem&&(document.body.removeChild(this.fakeElem),this.fakeElem=null)}},{key:"selectTarget",value:function e(){this.selectedText=(0,i.default)(this.target),this.copyText()}},{key:"copyText",value:function e(){var t=void 0;try{t=document.execCommand(this.action)}catch(e){t=!1}this.handleResult(t)}},{key:"handleResult",value:function e(t){this.emitter.emit(t?"success":"error",{action:this.action,text:this.selectedText,trigger:this.trigger,clearSelection:this.clearSelection.bind(this)})}},{key:"clearSelection",value:function e(){this.target&&this.target.blur(),window.getSelection().removeAllRanges()}},{key:"destroy",value:function e(){this.removeFake()}},{key:"action",set:function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"copy";if(this._action=t,"copy"!==this._action&&"cut"!==this._action)throw new Error('Invalid "action" value, use either "copy" or "cut"')},get:function e(){return this._action}},{key:"target",set:function e(t){if(void 0!==t){if(!t||"object"!==("undefined"==typeof t?"undefined":r(t))||1!==t.nodeType)throw new Error('Invalid "target" value, use a valid Element');if("copy"===this.action&&t.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if("cut"===this.action&&(t.hasAttribute("readonly")||t.hasAttribute("disabled")))throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');this._target=t}},get:function e(){return this._target}}]),e}();e.exports=c})},{select:5}],8:[function(t,n,o){!function(i,r){if("function"==typeof e&&e.amd)e(["module","./clipboard-action","tiny-emitter","good-listener"],r);else if("undefined"!=typeof o)r(n,t("./clipboard-action"),t("tiny-emitter"),t("good-listener"));else{var a={exports:{}};r(a,i.clipboardAction,i.tinyEmitter,i.goodListener),i.clipboard=a.exports}}(this,function(e,t,n,o){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function c(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function l(e,t){var n="data-clipboard-"+e;if(t.hasAttribute(n))return t.getAttribute(n)}var u=i(t),s=i(n),f=i(o),d=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),h=function(e){function t(e,n){r(this,t);var o=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return o.resolveOptions(n),o.listenClick(e),o}return c(t,e),d(t,[{key:"resolveOptions",value:function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.action="function"==typeof t.action?t.action:this.defaultAction,this.target="function"==typeof t.target?t.target:this.defaultTarget,this.text="function"==typeof t.text?t.text:this.defaultText}},{key:"listenClick",value:function e(t){var n=this;this.listener=(0,f.default)(t,"click",function(e){return n.onClick(e)})}},{key:"onClick",value:function e(t){var n=t.delegateTarget||t.currentTarget;this.clipboardAction&&(this.clipboardAction=null),this.clipboardAction=new u.default({action:this.action(n),target:this.target(n),text:this.text(n),trigger:n,emitter:this})}},{key:"defaultAction",value:function e(t){return l("action",t)}},{key:"defaultTarget",value:function e(t){var n=l("target",t);if(n)return document.querySelector(n)}},{key:"defaultText",value:function e(t){return l("text",t)}},{key:"destroy",value:function e(){this.listener.destroy(),this.clipboardAction&&(this.clipboardAction.destroy(),this.clipboardAction=null)}}],[{key:"isSupported",value:function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:["copy","cut"],n="string"==typeof t?[t]:t,o=!!document.queryCommandSupported;return n.forEach(function(e){o=o&&!!document.queryCommandSupported(e)}),o}}]),t}(s.default);e.exports=h})},{"./clipboard-action":7,"good-listener":4,"tiny-emitter":6}]},{},[8])(8)});
@@ -1,2 +1 @@
1
1
  var duScrollDefaultEasing=function(e){"use strict";return.5>e?Math.pow(2*e,2)/2:1-Math.pow(2*(1-e),2)/2},duScroll=angular.module("duScroll",["duScroll.scrollspy","duScroll.smoothScroll","duScroll.scrollContainer","duScroll.spyContext","duScroll.scrollHelpers"]).value("duScrollDuration",350).value("duScrollSpyWait",100).value("duScrollGreedy",!1).value("duScrollOffset",0).value("duScrollEasing",duScrollDefaultEasing).value("duScrollCancelOnEvents","scroll mousedown mousewheel touchmove keydown").value("duScrollBottomSpy",!1).value("duScrollActiveClass","active");"undefined"!=typeof module&&module&&module.exports&&(module.exports=duScroll),angular.module("duScroll.scrollHelpers",["duScroll.requestAnimation"]).run(["$window","$q","cancelAnimation","requestAnimation","duScrollEasing","duScrollDuration","duScrollOffset","duScrollCancelOnEvents",function(e,t,n,r,o,l,u,c){"use strict";var i={},a=function(e){return"undefined"!=typeof HTMLDocument&&e instanceof HTMLDocument||e.nodeType&&e.nodeType===e.DOCUMENT_NODE},s=function(e){return"undefined"!=typeof HTMLElement&&e instanceof HTMLElement||e.nodeType&&e.nodeType===e.ELEMENT_NODE},d=function(e){return s(e)||a(e)?e:e[0]};i.duScrollTo=function(t,n,r,o){var l;if(angular.isElement(t)?l=this.duScrollToElement:angular.isDefined(r)&&(l=this.duScrollToAnimated),l)return l.apply(this,arguments);var u=d(this);return a(u)?e.scrollTo(t,n):(u.scrollLeft=t,void(u.scrollTop=n))};var f,m;i.duScrollToAnimated=function(e,l,u,i){u&&!i&&(i=o);var a=this.duScrollLeft(),s=this.duScrollTop(),d=Math.round(e-a),p=Math.round(l-s),S=null,g=0,v=this,h=function(e){(!e||g&&e.which>0)&&(c&&v.unbind(c,h),n(f),m.reject(),f=null)};if(f&&h(),m=t.defer(),0===u||!d&&!p)return 0===u&&v.duScrollTo(e,l),m.resolve(),m.promise;var y=function(e){null===S&&(S=e),g=e-S;var t=g>=u?1:i(g/u);v.scrollTo(a+Math.ceil(d*t),s+Math.ceil(p*t)),1>t?f=r(y):(c&&v.unbind(c,h),f=null,m.resolve())};return v.duScrollTo(a,s),c&&v.bind(c,h),f=r(y),m.promise},i.duScrollToElement=function(e,t,n,r){var o=d(this);(!angular.isNumber(t)||isNaN(t))&&(t=u);var l=this.duScrollTop()+d(e).getBoundingClientRect().top-t;return s(o)&&(l-=o.getBoundingClientRect().top),this.duScrollTo(0,l,n,r)},i.duScrollLeft=function(t,n,r){if(angular.isNumber(t))return this.duScrollTo(t,this.duScrollTop(),n,r);var o=d(this);return a(o)?e.scrollX||document.documentElement.scrollLeft||document.body.scrollLeft:o.scrollLeft},i.duScrollTop=function(t,n,r){if(angular.isNumber(t))return this.duScrollTo(this.duScrollLeft(),t,n,r);var o=d(this);return a(o)?e.scrollY||document.documentElement.scrollTop||document.body.scrollTop:o.scrollTop},i.duScrollToElementAnimated=function(e,t,n,r){return this.duScrollToElement(e,t,n||l,r)},i.duScrollTopAnimated=function(e,t,n){return this.duScrollTop(e,t||l,n)},i.duScrollLeftAnimated=function(e,t,n){return this.duScrollLeft(e,t||l,n)},angular.forEach(i,function(e,t){angular.element.prototype[t]=e;var n=t.replace(/^duScroll/,"scroll");angular.isUndefined(angular.element.prototype[n])&&(angular.element.prototype[n]=e)})}]),angular.module("duScroll.polyfill",[]).factory("polyfill",["$window",function(e){"use strict";var t=["webkit","moz","o","ms"];return function(n,r){if(e[n])return e[n];for(var o,l=n.substr(0,1).toUpperCase()+n.substr(1),u=0;u<t.length;u++)if(o=t[u]+l,e[o])return e[o];return r}}]),angular.module("duScroll.requestAnimation",["duScroll.polyfill"]).factory("requestAnimation",["polyfill","$timeout",function(e,t){"use strict";var n=0,r=function(e,r){var o=(new Date).getTime(),l=Math.max(0,16-(o-n)),u=t(function(){e(o+l)},l);return n=o+l,u};return e("requestAnimationFrame",r)}]).factory("cancelAnimation",["polyfill","$timeout",function(e,t){"use strict";var n=function(e){t.cancel(e)};return e("cancelAnimationFrame",n)}]),angular.module("duScroll.spyAPI",["duScroll.scrollContainerAPI"]).factory("spyAPI",["$rootScope","$timeout","$window","$document","scrollContainerAPI","duScrollGreedy","duScrollSpyWait","duScrollBottomSpy","duScrollActiveClass",function(e,t,n,r,o,l,u,c,i){"use strict";var a=function(o){var a=!1,s=!1,d=function(){s=!1;var t,u=o.container,a=u[0],d=0;if("undefined"!=typeof HTMLElement&&a instanceof HTMLElement||a.nodeType&&a.nodeType===a.ELEMENT_NODE)d=a.getBoundingClientRect().top,t=Math.round(a.scrollTop+a.clientHeight)>=a.scrollHeight;else{var f=r[0].body.scrollHeight||r[0].documentElement.scrollHeight;t=Math.round(n.pageYOffset+n.innerHeight)>=f}var m,p,S,g,v,h,y=c&&t?"bottom":"top";for(g=o.spies,p=o.currentlyActive,S=void 0,m=0;m<g.length;m++)v=g[m],h=v.getTargetPosition(),h&&(c&&t||h.top+v.offset-d<20&&(l||-1*h.top+d)<h.height)&&(!S||S[y]<h[y])&&(S={spy:v},S[y]=h[y]);S&&(S=S.spy),p===S||l&&!S||(p&&(p.$element.removeClass(i),e.$broadcast("duScrollspy:becameInactive",p.$element,angular.element(p.getTargetElement()))),S&&(S.$element.addClass(i),e.$broadcast("duScrollspy:becameActive",S.$element,angular.element(S.getTargetElement()))),o.currentlyActive=S)};return u?function(){a?s=!0:(d(),a=t(function(){a=!1,s&&d()},u,!1))}:d},s={},d=function(e){var t=e.$id,n={spies:[]};return n.handler=a(n),s[t]=n,e.$on("$destroy",function(){f(e)}),t},f=function(e){var t=e.$id,n=s[t],r=n.container;r&&r.off("scroll",n.handler),delete s[t]},m=d(e),p=function(e){return s[e.$id]?s[e.$id]:e.$parent?p(e.$parent):s[m]},S=function(e){var t,n,r=e.$scope;if(r)return p(r);for(n in s)if(t=s[n],-1!==t.spies.indexOf(e))return t},g=function(e){for(;e.parentNode;)if(e=e.parentNode,e===document)return!0;return!1},v=function(e){var t=S(e);t&&(t.spies.push(e),t.container&&g(t.container)||(t.container&&t.container.off("scroll",t.handler),t.container=o.getContainer(e.$scope),t.container.on("scroll",t.handler).triggerHandler("scroll")))},h=function(t){var n=S(t);t===n.currentlyActive&&(e.$broadcast("duScrollspy:becameInactive",n.currentlyActive.$element),n.currentlyActive=null);var r=n.spies.indexOf(t);-1!==r&&n.spies.splice(r,1),t.$element=null};return{addSpy:v,removeSpy:h,createContext:d,destroyContext:f,getContextForScope:p}}]),angular.module("duScroll.scrollContainerAPI",[]).factory("scrollContainerAPI",["$document",function(e){"use strict";var t={},n=function(e,n){var r=e.$id;return t[r]=n,r},r=function(e){return t[e.$id]?e.$id:e.$parent?r(e.$parent):void 0},o=function(n){var o=r(n);return o?t[o]:e},l=function(e){var n=r(e);n&&delete t[n]};return{getContainerId:r,getContainer:o,setContainer:n,removeContainer:l}}]),angular.module("duScroll.smoothScroll",["duScroll.scrollHelpers","duScroll.scrollContainerAPI"]).directive("duSmoothScroll",["duScrollDuration","duScrollOffset","scrollContainerAPI",function(e,t,n){"use strict";return{link:function(r,o,l){o.on("click",function(o){if(l.href&&-1!==l.href.indexOf("#")||""!==l.duSmoothScroll){var u=l.href?l.href.replace(/.*(?=#[^\s]+$)/,"").substring(1):l.duSmoothScroll,c=document.getElementById(u)||document.getElementsByName(u)[0];if(c&&c.getBoundingClientRect){o.stopPropagation&&o.stopPropagation(),o.preventDefault&&o.preventDefault();var i=l.offset?parseInt(l.offset,10):t,a=l.duration?parseInt(l.duration,10):e,s=n.getContainer(r);s.duScrollToElement(angular.element(c),isNaN(i)?0:i,isNaN(a)?0:a)}}})}}}]),angular.module("duScroll.spyContext",["duScroll.spyAPI"]).directive("duSpyContext",["spyAPI",function(e){"use strict";return{restrict:"A",scope:!0,compile:function(t,n,r){return{pre:function(t,n,r,o){e.createContext(t)}}}}}]),angular.module("duScroll.scrollContainer",["duScroll.scrollContainerAPI"]).directive("duScrollContainer",["scrollContainerAPI",function(e){"use strict";return{restrict:"A",scope:!0,compile:function(t,n,r){return{pre:function(t,n,r,o){r.$observe("duScrollContainer",function(r){angular.isString(r)&&(r=document.getElementById(r)),r=angular.isElement(r)?angular.element(r):n,e.setContainer(t,r),t.$on("$destroy",function(){e.removeContainer(t)})})}}}}}]),angular.module("duScroll.scrollspy",["duScroll.spyAPI"]).directive("duScrollspy",["spyAPI","duScrollOffset","$timeout","$rootScope",function(e,t,n,r){"use strict";var o=function(e,t,n,r){angular.isElement(e)?this.target=e:angular.isString(e)&&(this.targetId=e),this.$scope=t,this.$element=n,this.offset=r};return o.prototype.getTargetElement=function(){return!this.target&&this.targetId&&(this.target=document.getElementById(this.targetId)||document.getElementsByName(this.targetId)[0]),this.target},o.prototype.getTargetPosition=function(){var e=this.getTargetElement();return e?e.getBoundingClientRect():void 0},o.prototype.flushTargetCache=function(){this.targetId&&(this.target=void 0)},{link:function(l,u,c){var i,a=c.ngHref||c.href;if(a&&-1!==a.indexOf("#")?i=a.replace(/.*(?=#[^\s]+$)/,"").substring(1):c.duScrollspy?i=c.duScrollspy:c.duSmoothScroll&&(i=c.duSmoothScroll),i){var s=n(function(){var n=new o(i,l,u,-(c.offset?parseInt(c.offset,10):t));e.addSpy(n),l.$on("$locationChangeSuccess",n.flushTargetCache.bind(n));var a=r.$on("$stateChangeSuccess",n.flushTargetCache.bind(n));l.$on("$destroy",function(){e.removeSpy(n),a()})},0,!1);l.$on("$destroy",function(){n.cancel(s)})}}}}]);
2
- //# sourceMappingURL=angular-scroll.min.js.map
@@ -7,7 +7,7 @@ angular.module('apiDocoApp').directive('jqJsonViewer', [function() {
7
7
  data: "="
8
8
  },
9
9
  link: function(scope, elem, attrs) {
10
- $(elem).jsonViewer(scope.data);
10
+ $(elem).jsonViewer(scope.data, { withQuotes: true });
11
11
  }
12
12
  };
13
13
  }]);
@@ -0,0 +1,48 @@
1
+ /*! ngclipboard - v1.1.1 - 2016-02-26
2
+ * https://github.com/sachinchoolur/ngclipboard
3
+ * Copyright (c) 2016 Sachin; Licensed MIT */
4
+ (function() {
5
+ 'use strict';
6
+ var MODULE_NAME = 'ngclipboard';
7
+ var angular, Clipboard;
8
+
9
+ // Check for CommonJS support
10
+ if (typeof module === 'object' && module.exports) {
11
+ angular = require('angular');
12
+ Clipboard = require('clipboard');
13
+ module.exports = MODULE_NAME;
14
+ } else {
15
+ angular = window.angular;
16
+ Clipboard = window.Clipboard;
17
+ }
18
+
19
+ angular.module(MODULE_NAME, []).directive('ngclipboard', function() {
20
+ return {
21
+ restrict: 'A',
22
+ scope: {
23
+ ngclipboardSuccess: '&',
24
+ ngclipboardError: '&'
25
+ },
26
+ link: function(scope, element) {
27
+ var clipboard = new Clipboard(element[0]);
28
+
29
+ clipboard.on('success', function(e) {
30
+ scope.$apply(function () {
31
+ scope.ngclipboardSuccess({
32
+ e: e
33
+ });
34
+ });
35
+ });
36
+
37
+ clipboard.on('error', function(e) {
38
+ scope.$apply(function () {
39
+ scope.ngclipboardError({
40
+ e: e
41
+ });
42
+ });
43
+ });
44
+
45
+ }
46
+ };
47
+ });
48
+ }());
@@ -4,6 +4,9 @@ module Apidoco
4
4
  class ApisController < ApplicationController
5
5
  before_action :set_version_parser
6
6
 
7
+ http_basic_authenticate_with name: Apidoco.auth_name, password: Apidoco.auth_password,
8
+ if: proc { Apidoco.auth_name && Apidoco.auth_password }
9
+
7
10
  def index
8
11
  redirect_to api_path(id: @vp.documentations.first.name)
9
12
  end
@@ -29,8 +29,13 @@
29
29
  <h4>{{x.name}}</h4>
30
30
  <div class="row mt-10">
31
31
  <div class="col-lg-2 text-right">End Point:</div>
32
- <div class="col-lg-10">
33
- <code>{{x.end_point}}</code>
32
+ <div class="col-lg-5">
33
+ <div class="input-group">
34
+ <input type="text" readonly class="form-control" value="{{x.end_point}}">
35
+ <span class="input-group-btn">
36
+ <button class="btn btn-default" type="button" ngclipboard data-clipboard-text="{{x.end_point}}">Copy</button>
37
+ </span>
38
+ </div>
34
39
  </div>
35
40
  </div>
36
41
 
@@ -39,7 +44,7 @@
39
44
  <div class="col-lg-10">{{x.http_method}}</div>
40
45
  </div>
41
46
 
42
- <div class="row mt-10" ng-if="headers && headers.length > 0">
47
+ <div class="row mt-10" ng-if="x.header">
43
48
  <div class="col-lg-2 text-right">Headers:</div>
44
49
  <div class="col-lg-10">
45
50
  <p ng-repeat="(key, value) in x.header">
@@ -52,7 +57,7 @@
52
57
  </div>
53
58
  </div>
54
59
 
55
- <div class="row mt-10" ng-if="params && params.length > 0">
60
+ <div class="row mt-10" ng-if="x.params && x.params.length > 0">
56
61
  <div class="col-lg-2 text-right">Params:</div>
57
62
  <div class="col-lg-10">
58
63
  <p ng-repeat="param in x.params">
@@ -65,7 +70,7 @@
65
70
  </div>
66
71
  </div>
67
72
 
68
- <div class="row mt-10" ng-if="x.notes && notes.length > 0">
73
+ <div class="row mt-10" ng-if="x.notes">
69
74
  <div class="col-lg-2 text-right">Notes:</div>
70
75
  <div class="col-lg-10">
71
76
  <p ng-repeat="note in x.notes">
@@ -79,12 +84,26 @@
79
84
  <div class="col-lg-10">
80
85
  <div ng-repeat="example in x.examples">
81
86
  <div ng-if="example.request">
82
- <p class="text-center">Request</p>
83
- <div class="well" jq-json-viewer data="example.request"></div>
87
+ <div class="panel panel-default">
88
+ <div class="panel-heading">
89
+ <h4 class="panel-title">Request</h4>
90
+ </div>
91
+ <div class="panel-body">
92
+ <button class="btn btn-default btn-sm pull-right" ngclipboard data-clipboard-text="{{example.request}}">Copy</button>
93
+ <div jq-json-viewer data="example.request"></div>
94
+ </div>
95
+ </div>
84
96
  </div>
85
97
  <div ng-if="example.response">
86
- <p class="text-center">Response</p>
87
- <div class="well" jq-json-viewer data="example.response"></div>
98
+ <div class="panel panel-default">
99
+ <div class="panel-heading">
100
+ <h4 class="panel-title">Response</h4>
101
+ </div>
102
+ <div class="panel-body">
103
+ <button class="btn btn-default btn-sm pull-right" ngclipboard data-clipboard-text="{{example.response}}">Copy</button>
104
+ <div jq-json-viewer data="example.response"></div>
105
+ </div>
106
+ </div>
88
107
  </div>
89
108
  </div>
90
109
  </div>
@@ -5,4 +5,6 @@ require "apidoco/version_parser"
5
5
  require "apidoco/version_documentation"
6
6
  require "apidoco/resource_documentation"
7
7
 
8
- module Apidoco; end
8
+ module Apidoco
9
+ mattr_accessor :auth_name, :auth_password
10
+ end
@@ -1,3 +1,3 @@
1
1
  module Apidoco
2
- VERSION = '1.2.0'
2
+ VERSION = '1.3.0'
3
3
  end
metadata CHANGED
@@ -1,16 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apidoco
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Al Ameen
8
8
  - Sufinsha Musthafa
9
9
  - Nidhin S G
10
+ - Aby George
10
11
  autorequire:
11
12
  bindir: bin
12
13
  cert_chain: []
13
- date: 2017-04-11 00:00:00.000000000 Z
14
+ date: 2017-04-17 00:00:00.000000000 Z
14
15
  dependencies:
15
16
  - !ruby/object:Gem::Dependency
16
17
  name: rails
@@ -98,7 +99,7 @@ dependencies:
98
99
  version: '0'
99
100
  description: Document Rest APIs.
100
101
  email:
101
- - k.ameen88@gmail.com
102
+ - alameenkhader@gmail.com
102
103
  - nidhinsg@gmail.com
103
104
  executables: []
104
105
  extensions: []
@@ -111,9 +112,11 @@ files:
111
112
  - app/assets/javascripts/apidoco/apidoco_app.js
112
113
  - app/assets/javascripts/apidoco/application.js
113
114
  - app/assets/javascripts/apidoco/bootstrap/bootstrap.min.js
115
+ - app/assets/javascripts/apidoco/clipboard.min.js
114
116
  - app/assets/javascripts/apidoco/controllers/documentations_controller.js
115
117
  - app/assets/javascripts/apidoco/directives/angular_scroll.min.js
116
118
  - app/assets/javascripts/apidoco/directives/jq_json_viewer.js
119
+ - app/assets/javascripts/apidoco/directives/ngclipboard.js
117
120
  - app/assets/javascripts/apidoco/jquery.json-viewer.js
118
121
  - app/assets/javascripts/apidoco/jquery.min.js
119
122
  - app/assets/stylesheets/apidoco/application.css
@@ -194,7 +197,7 @@ files:
194
197
  - spec/generators/apidoco_generator_spec.rb
195
198
  - spec/rails_helper.rb
196
199
  - spec/spec_helper.rb
197
- homepage: https://github.com/alameenkhader/apidoco
200
+ homepage: https://github.com/72pulses/apidoco
198
201
  licenses:
199
202
  - MIT
200
203
  metadata: {}