try_api 0.1.4 → 0.1.5
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 +4 -4
- data/app/assets/javascripts/try_api/{application.js.coffee → application.js.coffee.erb} +12 -2
- data/app/assets/javascripts/try_api/curl.directive.js +139 -0
- data/app/assets/javascripts/try_api/image.directive.js +7 -12
- data/app/assets/javascripts/try_api/param.directive.js.coffee +15 -3
- data/app/assets/javascripts/try_api/paramsobject.directive.js.coffee +20 -0
- data/app/assets/javascripts/try_api/scrollspy.directive.js +3 -1
- data/app/assets/javascripts/try_api/url.directive.js.coffee +1 -1
- data/app/assets/stylesheets/try_api/application.css.sass +47 -22
- data/app/views/layouts/try_api/application.html.erb +1 -2
- data/app/views/try_api/pages/index.html +33 -18
- data/lib/try_api/version.rb +1 -1
- metadata +7 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb091dde6b40cbf507ce459fd4bafb4225574a75
|
4
|
+
data.tar.gz: 9898a53fb35652246ee75e8d6fb978b547c194dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34690c1a886da0f038bd5c0669182d648a417154779e8eb2600bb5a83ed728bdbfda9715b5a6520ec366e99eaa4a966b69ec810ebd73fc24c62c8d469a8bb571
|
7
|
+
data.tar.gz: 550882bfbccec64c051a1734b35416b93651700804903fcb45554780ccdafee12cde1cd9a3c56024534967320fb9710e8f73595ccad851f6f63afa1e3945ac20
|
@@ -1,7 +1,9 @@
|
|
1
1
|
#= require try_api/params.directive
|
2
2
|
#= require try_api/param.directive
|
3
3
|
#= require try_api/paramsarray.directive
|
4
|
+
#= require try_api/paramsobject.directive
|
4
5
|
#= require try_api/image.directive
|
6
|
+
#= require try_api/curl.directive
|
5
7
|
#= require try_api/url.directive
|
6
8
|
#= require try_api/scrollspy.directive
|
7
9
|
|
@@ -27,7 +29,6 @@ $ ->
|
|
27
29
|
|
28
30
|
|
29
31
|
TryApiApp = angular.module('TryApiApp', [
|
30
|
-
'ui.bootstrap'
|
31
32
|
'ngAnimate'
|
32
33
|
'ngCookies'
|
33
34
|
'TryApi'
|
@@ -135,13 +136,14 @@ TryApiApp.controller 'HomeController', [
|
|
135
136
|
.success method.response_handler
|
136
137
|
.error method.response_handler
|
137
138
|
|
138
|
-
$http.get('
|
139
|
+
$http.get('<%= TryApi::Engine.routes.url_helpers.projects_path %>').success (data) ->
|
139
140
|
$scope.project = data.project
|
140
141
|
$.each $scope.project.menu_items, () ->
|
141
142
|
menu_item = this
|
142
143
|
$.each menu_item.methods, ()->
|
143
144
|
method = this
|
144
145
|
method.pending = false
|
146
|
+
method.endpoint = $scope.project.endpoint;
|
145
147
|
method.response_handler = (data, status, headers, config) ->
|
146
148
|
method.pending = false
|
147
149
|
try # TODO catch different types of response
|
@@ -214,6 +216,14 @@ TryApiApp.controller 'HomeController', [
|
|
214
216
|
form.append parameter.name + '[]' + subparameter.name, subparameter.value || false
|
215
217
|
else
|
216
218
|
form.append parameter.name + '[]' + subparameter.name, subparameter.value || ''
|
219
|
+
if parameter.type == 'object'
|
220
|
+
$.each parameter.values, ->
|
221
|
+
subparameter = this
|
222
|
+
switch subparameter.type
|
223
|
+
when 'boolean'
|
224
|
+
form.append parameter.name + '[' + subparameter.name + ']', subparameter.value || false
|
225
|
+
else
|
226
|
+
form.append parameter.name + '[' + subparameter.name + ']', subparameter.value || ''
|
217
227
|
else
|
218
228
|
switch parameter.type
|
219
229
|
when 'boolean'
|
@@ -0,0 +1,139 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
angular.module('TryApi').directive('curl', ['$filter', function($filter) {
|
4
|
+
|
5
|
+
function link(scope, element, attributes, ctrl) {
|
6
|
+
|
7
|
+
scope.curlString = '';
|
8
|
+
|
9
|
+
scope.$watch(function(){
|
10
|
+
return JSON.stringify(scope.model);
|
11
|
+
}, function(){
|
12
|
+
let method = scope.model.method.toString().toUpperCase();
|
13
|
+
let headers = [];
|
14
|
+
let formData = scope.isFormData(scope.model.parameters);
|
15
|
+
|
16
|
+
if(formData) {
|
17
|
+
|
18
|
+
}else{
|
19
|
+
headers.push(" -H \"Content-Type: application/json\"");
|
20
|
+
}
|
21
|
+
|
22
|
+
if(scope.model.headers){
|
23
|
+
scope.model.headers.forEach(function(header){
|
24
|
+
headers.push(' -H "' + header.name + ': ' + (header.value || '') + '"')
|
25
|
+
})
|
26
|
+
}
|
27
|
+
|
28
|
+
scope.curlString = 'curl -X ' + method + ' ' + scope.model.endpoint + '/' + scope.model.submit_path + headers.join('');
|
29
|
+
|
30
|
+
if(scope.model.parameters && scope.model.parameters.length > 0) {
|
31
|
+
if (formData) {
|
32
|
+
scope.curlString += ' -c -include ' + scope.toFormDataKeys(scope.model.parameters);
|
33
|
+
} else {
|
34
|
+
scope.curlString += ' -d "' + JSON.stringify(scope.toJsonParameters(scope.model.parameters)).replace(/"/g, '\\"').replace(/,/g, ', ') + '"';
|
35
|
+
}
|
36
|
+
}
|
37
|
+
|
38
|
+
}, true)
|
39
|
+
|
40
|
+
scope.toFormDataKeys = function(parameters, prefix){
|
41
|
+
let result = '';
|
42
|
+
|
43
|
+
if(parameters && parameters.length > 0){
|
44
|
+
parameters.forEach(function(parameter){
|
45
|
+
|
46
|
+
let name = '';
|
47
|
+
|
48
|
+
if(prefix) {
|
49
|
+
name = prefix + '[' + parameter.name + ']';
|
50
|
+
}else{
|
51
|
+
name = parameter.name;
|
52
|
+
}
|
53
|
+
|
54
|
+
if(parameter.type == 'array'){
|
55
|
+
if(parameter.values && parameter.values.length > 0){
|
56
|
+
let i = 0;
|
57
|
+
parameter.values.forEach(function(value){
|
58
|
+
let temp_parameters = [];
|
59
|
+
for(let k in value){
|
60
|
+
temp_parameters.push(value[k]);
|
61
|
+
}
|
62
|
+
result += scope.toFormDataKeys(temp_parameters, name + '[]');
|
63
|
+
i++;
|
64
|
+
})
|
65
|
+
}
|
66
|
+
}else{
|
67
|
+
let value = '';
|
68
|
+
|
69
|
+
if(parameter.type == 'image'){
|
70
|
+
value = parameter.value ? '@' + parameter.value.name : '';
|
71
|
+
}else{
|
72
|
+
value = parameter.value || '';
|
73
|
+
}
|
74
|
+
|
75
|
+
result += ' -F "' + name + '=' + value + '"';
|
76
|
+
}
|
77
|
+
});
|
78
|
+
}
|
79
|
+
return result;
|
80
|
+
}
|
81
|
+
|
82
|
+
scope.toJsonParameters = function(parameters){
|
83
|
+
let result = {};
|
84
|
+
|
85
|
+
if(parameters && parameters.length > 0){
|
86
|
+
parameters.forEach(function(parameter){
|
87
|
+
if(parameter.type == 'array'){
|
88
|
+
if(parameter.values && parameter.values.length > 0){
|
89
|
+
result[parameter.name] = [];
|
90
|
+
parameter.values.forEach(function(value){
|
91
|
+
let temp_parameters = [];
|
92
|
+
for(let k in value){
|
93
|
+
temp_parameters.push(value[k]);
|
94
|
+
}
|
95
|
+
result[parameter.name].push(scope.toJsonParameters(temp_parameters));
|
96
|
+
})
|
97
|
+
}
|
98
|
+
}else{
|
99
|
+
result[parameter.name] = parameter.value;
|
100
|
+
}
|
101
|
+
});
|
102
|
+
}
|
103
|
+
return result;
|
104
|
+
}
|
105
|
+
|
106
|
+
scope.isFormData = function(parameters){
|
107
|
+
let result = false;
|
108
|
+
|
109
|
+
if(parameters && parameters.length > 0){
|
110
|
+
parameters.forEach(function(parameter){
|
111
|
+
if(parameter.type == 'array'){
|
112
|
+
if(parameter.values && parameter.values.length > 0){
|
113
|
+
parameter.values.forEach(function(value){
|
114
|
+
let temp_parameters = [];
|
115
|
+
for(let k in value){
|
116
|
+
temp_parameters.push(value[k]);
|
117
|
+
}
|
118
|
+
result = scope.toJsonParameters(temp_parameters);
|
119
|
+
})
|
120
|
+
}
|
121
|
+
}else if(parameter.type == 'image'){
|
122
|
+
result = true;
|
123
|
+
}
|
124
|
+
});
|
125
|
+
}
|
126
|
+
return result;
|
127
|
+
}
|
128
|
+
}
|
129
|
+
|
130
|
+
return {
|
131
|
+
link: link,
|
132
|
+
restrict: 'A',
|
133
|
+
require: 'ngModel',
|
134
|
+
scope: {
|
135
|
+
model: '=ngModel'
|
136
|
+
},
|
137
|
+
template: "{{ curlString }}"
|
138
|
+
};
|
139
|
+
}]);
|
@@ -12,21 +12,16 @@ angular.module('TryApi').directive('image', ['$filter', function($filter) {
|
|
12
12
|
scope.removeImage = function(e){
|
13
13
|
e.stopPropagation();
|
14
14
|
e.preventDefault();
|
15
|
-
scope.image.
|
15
|
+
scope.image.blob_url = null;
|
16
16
|
return false;
|
17
17
|
};
|
18
18
|
|
19
19
|
var addImage = function(image){
|
20
|
-
var base64 ='';
|
21
20
|
if(image.type.indexOf("image") > -1) {
|
22
|
-
|
23
|
-
|
24
|
-
scope
|
25
|
-
|
26
|
-
scope.image = {base64: e.target.result };
|
27
|
-
});
|
28
|
-
};
|
29
|
-
reader.readAsDataURL(image);
|
21
|
+
scope.$apply(function(){
|
22
|
+
scope.model = image;
|
23
|
+
scope.image = { blob_url: (window.URL || window.webkitURL).createObjectURL(image), filename: image.name };
|
24
|
+
});
|
30
25
|
}else{
|
31
26
|
|
32
27
|
}
|
@@ -81,9 +76,9 @@ angular.module('TryApi').directive('image', ['$filter', function($filter) {
|
|
81
76
|
},
|
82
77
|
template: "<div class='droppable-area'>" +
|
83
78
|
"<ul class='images-list' >" +
|
84
|
-
'<li class="plus" style="background-image: url(\'{{ image.
|
79
|
+
'<li class="plus" style="background-image: url(\'{{ image.blob_url || image.url }}\')">' +
|
85
80
|
"<label>" +
|
86
|
-
'<i class="fa fa-plus" ng-hide="image.
|
81
|
+
'<i class="fa fa-plus" ng-hide="image.blob_url"/>' +
|
87
82
|
'<input type="file" class="file-select" />' +
|
88
83
|
"</label>" +
|
89
84
|
"</li>" +
|
@@ -16,11 +16,11 @@ angular.module('TryApi').directive 'param', [
|
|
16
16
|
scope:
|
17
17
|
parameter: '=ngModel'
|
18
18
|
template: '' +
|
19
|
-
'<div class="col-md-4 text-right" ng-if=\'parameter.type != "array"\'>' +
|
19
|
+
'<div class="col-md-4 text-right" ng-if=\'parameter.type != "array" && parameter.type != "object"\'>' +
|
20
20
|
' <b>{{ parameter.name }}</b>' +
|
21
21
|
' <span class="label label-success">{{ parameter.type }}</span>' +
|
22
22
|
'</div>' +
|
23
|
-
'<div class="col-md-8" ng-if=\'parameter.type != "array"\'>' +
|
23
|
+
'<div class="col-md-8" ng-if=\'parameter.type != "array" && parameter.type != "object"\'>' +
|
24
24
|
' <div ng-switch="parameter.type">' +
|
25
25
|
' <input ng-switch-when="string" type="text" ng-model="parameter.value" placeholder=\'{{ parameter.required ? "required" : "optional"}}\'>' +
|
26
26
|
' <textarea ng-switch-when="text" ng-model="parameter.value" placeholder=\'{{ parameter.required ? "required" : "optional"}}\' style="max-width: 100%" />' +
|
@@ -47,6 +47,18 @@ angular.module('TryApi').directive 'param', [
|
|
47
47
|
' </div>' +
|
48
48
|
' </div>' +
|
49
49
|
' <div paramsarray ng-model="parameter"></div>' +
|
50
|
+
'</div>' +
|
51
|
+
'<div class="col-md-12" ng-if=\'parameter.type == "object"\'>' +
|
52
|
+
' <div class="row">' +
|
53
|
+
' <div class="col-md-4 text-right">' +
|
54
|
+
' <b>{{ parameter.name }}</b>' +
|
55
|
+
' <span class="text-muted label label-warning">{{ parameter.type }}</span>' +
|
56
|
+
' </div>' +
|
57
|
+
' <div class="col-md-8">' +
|
58
|
+
' <div class="text-muted small" ng-bind-html="getHtml(parameter.description)"></div>' +
|
59
|
+
' </div>' +
|
60
|
+
' </div>' +
|
61
|
+
' <div paramsobject ng-model="parameter"></div>' +
|
50
62
|
'</div>'
|
51
63
|
}
|
52
|
-
]
|
64
|
+
]
|
@@ -0,0 +1,20 @@
|
|
1
|
+
angular.module('TryApi').directive 'paramsobject', [
|
2
|
+
'$filter'
|
3
|
+
($filter) ->
|
4
|
+
|
5
|
+
link = (scope, element, attrs, ctrl) ->
|
6
|
+
|
7
|
+
scope.parameter.values = jQuery.extend(true, {}, scope.parameter.parameters)
|
8
|
+
|
9
|
+
return {
|
10
|
+
link: link
|
11
|
+
restrict: 'A'
|
12
|
+
require: 'ngModel'
|
13
|
+
scope:
|
14
|
+
parameter: '=ngModel'
|
15
|
+
template: '' +
|
16
|
+
'<div style="border: 1px solid lightgray; margin: 1px 1px 1px 10px">' +
|
17
|
+
' <div params ng-model="parameter.values"></div>' +
|
18
|
+
'</div>'
|
19
|
+
}
|
20
|
+
]
|
@@ -46,7 +46,9 @@ angular.module('tryApiScrollSpy.directives', [])
|
|
46
46
|
|
47
47
|
var activate = function(scope, $element, attrs) {
|
48
48
|
$(attrs.target + ' .active').removeClass('active');
|
49
|
-
$element
|
49
|
+
if($element){
|
50
|
+
$element.addClass('active');
|
51
|
+
}
|
50
52
|
};
|
51
53
|
|
52
54
|
var process = function(scope, element, attrs) {
|
@@ -25,7 +25,7 @@ angular.module('TryApi').directive 'url', [
|
|
25
25
|
, true
|
26
26
|
|
27
27
|
scope.inputStyle = (part) ->
|
28
|
-
charWidth =
|
28
|
+
charWidth = 11.5;
|
29
29
|
return {
|
30
30
|
"width": ((part.value).length + 1) * charWidth + "px",
|
31
31
|
"min-width": ((part.placeholder).length) * charWidth + "px"
|
@@ -2,6 +2,8 @@ body
|
|
2
2
|
margin: 0
|
3
3
|
background-color: #f3f3f4
|
4
4
|
font-family: Arial, Helvetica, sans-serif
|
5
|
+
min-width: 700px
|
6
|
+
overflow: auto
|
5
7
|
|
6
8
|
input, textarea
|
7
9
|
border: 0
|
@@ -10,7 +12,6 @@ body
|
|
10
12
|
&:not(.url-input)
|
11
13
|
width: 100%
|
12
14
|
|
13
|
-
|
14
15
|
::-webkit-input-placeholder
|
15
16
|
color: #19B698
|
16
17
|
::-moz-placeholder
|
@@ -21,11 +22,16 @@ body
|
|
21
22
|
color: #19B698
|
22
23
|
|
23
24
|
pre
|
24
|
-
|
25
|
+
line-height: 1.25
|
26
|
+
border-radius: 5px
|
27
|
+
box-shadow: 0 0 200px rgba(0,0,0,.33) inset
|
25
28
|
margin: 0
|
26
|
-
|
27
|
-
border:
|
28
|
-
|
29
|
+
border-top: 1px solid #000
|
30
|
+
border-bottom: 1px solid #404040
|
31
|
+
white-space: pre-wrap
|
32
|
+
word-break: normal
|
33
|
+
word-spacing: normal
|
34
|
+
background-color: black
|
29
35
|
|
30
36
|
button
|
31
37
|
outline: none !important
|
@@ -99,13 +105,18 @@ body
|
|
99
105
|
padding-bottom: 60px
|
100
106
|
.second-level-menu-items
|
101
107
|
list-style-type: none
|
102
|
-
font-size:
|
103
|
-
padding:
|
108
|
+
font-size: 12px
|
109
|
+
padding: 4px 9px
|
110
|
+
li
|
111
|
+
a
|
112
|
+
color: rgb(61, 64, 66)
|
113
|
+
font-size: 12.5px
|
104
114
|
|
105
115
|
&-item
|
106
116
|
a
|
107
|
-
color: rgb(61, 64, 66)
|
108
117
|
text-decoration: none
|
118
|
+
font-size: 14px
|
119
|
+
color: black
|
109
120
|
&:hover
|
110
121
|
text-decoration: underline
|
111
122
|
|
@@ -120,38 +131,54 @@ body
|
|
120
131
|
border-bottom: 1px solid lightgray
|
121
132
|
&-try
|
122
133
|
background-color: white
|
123
|
-
padding:
|
124
|
-
|
134
|
+
padding: 15px 15px
|
135
|
+
@media (max-width: 1000px)
|
136
|
+
width: 100%
|
137
|
+
min-width: 500px
|
125
138
|
&-heading
|
126
139
|
color: rgb(137, 140, 143)
|
127
140
|
font-weight: normal
|
128
|
-
|
141
|
+
.method-title
|
142
|
+
font-size: 18px
|
143
|
+
color: black
|
144
|
+
font-weight: 500
|
145
|
+
.method-url
|
146
|
+
font-size: 17px
|
147
|
+
color: black
|
148
|
+
.params-label
|
149
|
+
color: gray
|
150
|
+
text-align: center
|
151
|
+
text-transform: uppercase
|
152
|
+
margin-top: 14px
|
153
|
+
border-bottom: 1px solid lightgray
|
154
|
+
font-size: 13px
|
129
155
|
&-example
|
130
|
-
background-color: #
|
156
|
+
background-color: #23241f
|
131
157
|
color: #b1bdc4
|
132
158
|
padding: 10px 15px
|
159
|
+
@media (max-width: 1000px)
|
160
|
+
width: 100%
|
161
|
+
min-width: 500px
|
133
162
|
&-code, code
|
134
163
|
color: #b1bdc4
|
135
164
|
margin: 0
|
136
165
|
padding: 20px 40px
|
137
|
-
background: #
|
166
|
+
background: #23241f
|
138
167
|
border-radius: 5px
|
139
168
|
font-family: Source Code Pro,Menlo,monospace
|
140
169
|
font-size: 13px
|
141
170
|
line-height: 1.5em
|
142
171
|
font-weight: 500
|
143
|
-
|
144
|
-
|
145
|
-
|
172
|
+
&-menu
|
173
|
+
text-align: right
|
174
|
+
.label
|
175
|
+
cursor: pointer
|
146
176
|
|
147
177
|
&-response
|
148
178
|
margin: 2px 0
|
149
179
|
&-header
|
150
|
-
|
180
|
+
margin-top: 10px
|
151
181
|
padding: 3px
|
152
|
-
cursor: pointer
|
153
|
-
border-top-right-radius: 5px
|
154
|
-
border-top-left-radius: 5px
|
155
182
|
position: relative
|
156
183
|
i.fa
|
157
184
|
position: absolute
|
@@ -185,9 +212,7 @@ body
|
|
185
212
|
font-size: 16px
|
186
213
|
color: rgb(137, 140, 143)
|
187
214
|
|
188
|
-
|
189
215
|
.parameter
|
190
|
-
padding-bottom: 5px
|
191
216
|
padding-top: 5px
|
192
217
|
|
193
218
|
.nav > li > a
|
@@ -9,7 +9,6 @@
|
|
9
9
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/jQuery-slimScroll/1.3.8/jquery.slimscroll.min.js"></script>
|
10
10
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.8/angular.min.js"></script>
|
11
11
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.8/angular-animate.min.js"></script>
|
12
|
-
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/2.1.3/ui-bootstrap.min.js"></script>
|
13
12
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.6.0/highlight.min.js"></script>
|
14
13
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-highlightjs/0.6.2/angular-highlightjs.min.js"></script>
|
15
14
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/spin.js/2.3.2/spin.min.js"></script>
|
@@ -18,7 +17,7 @@
|
|
18
17
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.8/angular-cookies.min.js"></script>
|
19
18
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.min.css"/>
|
20
19
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha/css/bootstrap.min.css"/>
|
21
|
-
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.
|
20
|
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.10.0/styles/atelier-lakeside-dark.min.css"/>
|
22
21
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Ladda/1.0.0/ladda.min.css"/>
|
23
22
|
|
24
23
|
<%= stylesheet_link_tag "try_api/application", :media => "all", :async => false %>
|
@@ -38,22 +38,28 @@
|
|
38
38
|
</div>
|
39
39
|
</div>
|
40
40
|
<div class="row method is-flex" id="{{ method.description ? '' : ('section' + menu_item.id + method.id) }}" ng-if="method.method != 'web_socket'">
|
41
|
-
<div class="col-md-6 method-try"
|
42
|
-
<
|
41
|
+
<div class="col-md-6 method-try">
|
42
|
+
<div class="method-title">{{ method.title }}</div>
|
43
|
+
<div class="method-url">
|
43
44
|
<span class="label label-success" style="text-transform: uppercase">{{ method.method }}</span>
|
44
45
|
<span url=true ng-model="method.submit_path" pattern="method.local_path"></span>
|
45
|
-
</
|
46
|
-
<div ng-if="method.headers.length > 0"
|
46
|
+
</div>
|
47
|
+
<div ng-if="method.headers.length > 0">
|
48
|
+
<div class="params-label">Headers</div>
|
47
49
|
<div class="row parameter" ng-repeat="header in method.headers">
|
48
|
-
<div class="col-md-4 text-right"
|
49
|
-
|
50
|
+
<div class="col-md-4 text-right">
|
51
|
+
<b>{{header.name }}</b>
|
52
|
+
</div>
|
53
|
+
<div class="col-md-8">
|
54
|
+
<input ng-model="header.value" type="text"/>
|
50
55
|
<div class="text-muted small">
|
51
56
|
<div ng-trust-html="getHtml(header.description)"></div>
|
52
57
|
</div>
|
53
58
|
</div>
|
54
59
|
</div>
|
55
60
|
</div>
|
56
|
-
<div ng-if="method.parameters.length > 0"
|
61
|
+
<div ng-if="method.parameters.length > 0">
|
62
|
+
<div class="params-label">Parameters</div>
|
57
63
|
<div ng-model="method.parameters" params=""></div>
|
58
64
|
</div>
|
59
65
|
<br/>
|
@@ -76,16 +82,21 @@
|
|
76
82
|
<div hljs="" hljs-language="json" hljs-source="method.response.headers"></div>
|
77
83
|
</div>
|
78
84
|
</div>
|
79
|
-
<div class="col-md-6 method-example"
|
80
|
-
<div ng-
|
81
|
-
<
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
85
|
+
<div class="col-md-6 method-example">
|
86
|
+
<div class="method-example-menu" ng-init="method.menu = 'resp'">
|
87
|
+
<span class="label" ng-class="{'label-success': method.menu == 'resp'}" ng-click="method.menu = 'resp'">Response</span>
|
88
|
+
<span class="label" ng-class="{'label-success': method.menu == 'curl'}" ng-click="method.menu = 'curl'">curl</span>
|
89
|
+
</div>
|
90
|
+
|
91
|
+
<div ng-show="method.menu == 'curl'">
|
92
|
+
<div curl ng-model="method"></div>
|
93
|
+
</div>
|
94
|
+
<div ng-repeat="example in method.example_responses" class="method-example-response" ng-show="method.menu == 'resp'">
|
95
|
+
<div class="method-example-response-header">
|
96
|
+
{{ example.code }}
|
97
|
+
{{ example.description }}
|
87
98
|
</div>
|
88
|
-
<div class="method-example-response-body" hljs="" hljs-language="{{ example.type }}" hljs-source="example.response"
|
99
|
+
<div class="method-example-response-body" hljs="" hljs-language="{{ example.type }}" hljs-source="example.response">
|
89
100
|
|
90
101
|
</div>
|
91
102
|
</div>
|
@@ -142,8 +153,12 @@
|
|
142
153
|
<div class="row method is-flex">
|
143
154
|
<div class="col-md-6 method-try"></div>
|
144
155
|
<div class="col-md-6 method-example">
|
145
|
-
<div class="text-right"
|
146
|
-
|
156
|
+
<div class="text-right">
|
157
|
+
<strong>
|
158
|
+
Created using
|
159
|
+
<a href="https://github.com/mskubenich/try_api">try_api <i class="fa fa-github"></i></a>
|
160
|
+
</strong>
|
161
|
+
</div>
|
147
162
|
</div>
|
148
163
|
</div>
|
149
164
|
</div>
|
data/lib/try_api/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: try_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Michael Skubenych
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-04-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -27,18 +27,20 @@ dependencies:
|
|
27
27
|
description: 'Generates UI for rails apps with APIs. You can easily test, share and
|
28
28
|
play with you''r APIs. Enjoy ) '
|
29
29
|
email:
|
30
|
-
-
|
30
|
+
- michael.skubenych@gmail.com
|
31
31
|
executables: []
|
32
32
|
extensions: []
|
33
33
|
extra_rdoc_files: []
|
34
34
|
files:
|
35
35
|
- MIT-LICENSE
|
36
36
|
- Rakefile
|
37
|
-
- app/assets/javascripts/try_api/application.js.coffee
|
37
|
+
- app/assets/javascripts/try_api/application.js.coffee.erb
|
38
|
+
- app/assets/javascripts/try_api/curl.directive.js
|
38
39
|
- app/assets/javascripts/try_api/image.directive.js
|
39
40
|
- app/assets/javascripts/try_api/param.directive.js.coffee
|
40
41
|
- app/assets/javascripts/try_api/params.directive.js.coffee
|
41
42
|
- app/assets/javascripts/try_api/paramsarray.directive.js.coffee
|
43
|
+
- app/assets/javascripts/try_api/paramsobject.directive.js.coffee
|
42
44
|
- app/assets/javascripts/try_api/scrollspy.directive.js
|
43
45
|
- app/assets/javascripts/try_api/url.directive.js.coffee
|
44
46
|
- app/assets/stylesheets/try_api/application.css.sass
|