the_garage 2.8.0 → 2.8.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b48c2510bfd1fe5926e9fdd4adac78374bb9ed83b46db0b9202e1b6028645974
|
4
|
+
data.tar.gz: 1d92f344d618e25f1eef2d7e7778edaa4f3e2a0e1f236a19d476b19a893fc012
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 063d9f1cdf9744ec2fb4d18f6697e44f390bccc259a8c4ff36839992732e4578916ef1691949c8dc8f67872de161bd97e12c049dbd69b81fd5b5e599c8f4faae
|
7
|
+
data.tar.gz: e76b35e33c9332afbe6ff7b16ec6b96c23e41c9bd85605e58e2532729e4389ca6090599a32ad67c9e45d8e6c03fade453d8d3e861f87445be45ae30c0b5f53cb
|
@@ -0,0 +1,103 @@
|
|
1
|
+
jQuery(function(){
|
2
|
+
$(".get-oauth-token").colorbox({
|
3
|
+
transition: "none",
|
4
|
+
href: "#oauth-dialog",
|
5
|
+
inline: true
|
6
|
+
});
|
7
|
+
|
8
|
+
$(".modal-close").click(function(ev) {
|
9
|
+
$.colorbox.close();
|
10
|
+
ev.preventDefault();
|
11
|
+
});
|
12
|
+
|
13
|
+
var addNewParamField = function(container) {
|
14
|
+
const nextId = "parameter-" + $('.parameter', container).length;
|
15
|
+
const copy = $('.template .parameter').clone().attr('id', nextId);
|
16
|
+
$('.close-field', copy).click(ev => $('#' + nextId).detach());
|
17
|
+
$('.add-field', copy).click(ev => addNewParamField(container));
|
18
|
+
copy.show().appendTo(container);
|
19
|
+
};
|
20
|
+
|
21
|
+
const buildData = function(container) {
|
22
|
+
const data = {};
|
23
|
+
$('.parameter', container).each(function(index) {
|
24
|
+
const name = $('.name', this).val();
|
25
|
+
const value = $('.value', this).val();
|
26
|
+
return data[name] = value;
|
27
|
+
});
|
28
|
+
return data;
|
29
|
+
};
|
30
|
+
|
31
|
+
$('.console #method').change(function(ev) {
|
32
|
+
if (($(this).val() === 'POST') || ($(this).val() === 'PUT')) {
|
33
|
+
if ($('.parameters .parameter').length === 0) {
|
34
|
+
addNewParamField($('.parameters'));
|
35
|
+
}
|
36
|
+
} else {
|
37
|
+
$('.parameters').empty();
|
38
|
+
}
|
39
|
+
});
|
40
|
+
|
41
|
+
const buildHyperlinks = function(json) {
|
42
|
+
const html = $('<div/>').text(json).html().replace(/"href": "(\/.*?)"/g, "\"href\": \"<a>$1</a>\"");
|
43
|
+
const dom = $(`<div>${html}</div>`);
|
44
|
+
$('a', dom).each(function(i) {
|
45
|
+
return $(this).attr('href', `${location.pathname}?location=${encodeURIComponent($(this).text())}&method=GET`);
|
46
|
+
});
|
47
|
+
return dom.html();
|
48
|
+
};
|
49
|
+
|
50
|
+
$('.console .send-request').click(function(ev) {
|
51
|
+
$('#api-headers').text('');
|
52
|
+
$('#api-response').text('');
|
53
|
+
|
54
|
+
console.log(buildData($('.parameters')));
|
55
|
+
$.ajax({
|
56
|
+
type: $('#method').val(),
|
57
|
+
url: $('#base').val() + $('#location').val(),
|
58
|
+
headers: {'Authorization': 'Bearer ' + $('#access_token').val()},
|
59
|
+
cache: false,
|
60
|
+
data: buildData($('.parameters')),
|
61
|
+
dataType: 'json',
|
62
|
+
complete() {
|
63
|
+
const queryString = $.param({'location': $('#location').val(), 'method': $('#method').val()});
|
64
|
+
const newFullpath = `${location.pathname}?${queryString}`;
|
65
|
+
history.pushState('', '', newFullpath);
|
66
|
+
$("#oauth-dialog #return_to").val(newFullpath);
|
67
|
+
},
|
68
|
+
success(data, textStatus, xhr) {
|
69
|
+
$('#api-headers').text(`${xhr.status} ${xhr.statusText}\n` + xhr.getAllResponseHeaders());
|
70
|
+
$('#api-response').html(buildHyperlinks(JSON.stringify(data, undefined, 2)));
|
71
|
+
},
|
72
|
+
error(xhr, textStatus, error) {
|
73
|
+
$('#api-headers').text(`${xhr.status} ${xhr.statusText}\n` + xhr.getAllResponseHeaders());
|
74
|
+
$('#api-response').text(xhr.responseText);
|
75
|
+
}
|
76
|
+
});
|
77
|
+
ev.preventDefault();
|
78
|
+
});
|
79
|
+
|
80
|
+
if (($('.console #token').val() !== '') && ($('.console #location').val() !== '') && ($('.console #method').val() === 'GET')) {
|
81
|
+
$('.send-request').click();
|
82
|
+
}
|
83
|
+
|
84
|
+
if ($('.oauth-callback-redirect').size() > 0) {
|
85
|
+
const token = window.location.hash.match(/\#access_token=(\w+)/)[1];
|
86
|
+
if (token) {
|
87
|
+
$('#access_token').val(token);
|
88
|
+
$('form.oauth-callback-redirect').submit();
|
89
|
+
}
|
90
|
+
}
|
91
|
+
|
92
|
+
$('#oauth-dialog .token-scope-check-all').click(function(ev) {
|
93
|
+
$('.token-scope-checkbox').prop('checked', this.checked);
|
94
|
+
});
|
95
|
+
|
96
|
+
return $('#oauth-dialog .token-scope-checkbox').click(function(ev) {
|
97
|
+
if ($('.token-scope-checkbox:not(:checked)').length === 0) {
|
98
|
+
$('.token-scope-check-all').prop('checked', true);
|
99
|
+
} else if (!this.checked) {
|
100
|
+
$('.token-scope-check-all').prop('checked', false);
|
101
|
+
}
|
102
|
+
});
|
103
|
+
});
|
data/lib/garage/docs/engine.rb
CHANGED
data/lib/garage/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: the_garage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.8.
|
4
|
+
version: 2.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tatsuhiko Miyagawa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -136,20 +136,6 @@ dependencies:
|
|
136
136
|
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
|
-
- !ruby/object:Gem::Dependency
|
140
|
-
name: coffee-rails
|
141
|
-
requirement: !ruby/object:Gem::Requirement
|
142
|
-
requirements:
|
143
|
-
- - ">="
|
144
|
-
- !ruby/object:Gem::Version
|
145
|
-
version: '0'
|
146
|
-
type: :runtime
|
147
|
-
prerelease: false
|
148
|
-
version_requirements: !ruby/object:Gem::Requirement
|
149
|
-
requirements:
|
150
|
-
- - ">="
|
151
|
-
- !ruby/object:Gem::Version
|
152
|
-
version: '0'
|
153
139
|
- !ruby/object:Gem::Dependency
|
154
140
|
name: http_accept_language
|
155
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -175,7 +161,7 @@ files:
|
|
175
161
|
- README.md
|
176
162
|
- Rakefile
|
177
163
|
- app/assets/javascripts/garage/application.js
|
178
|
-
- app/assets/javascripts/garage/docs/console.js
|
164
|
+
- app/assets/javascripts/garage/docs/console.js
|
179
165
|
- app/assets/javascripts/garage/docs/jquery.colorbox.js
|
180
166
|
- app/assets/stylesheets/garage/application.css
|
181
167
|
- app/assets/stylesheets/garage/colorbox.scss
|
@@ -1,84 +0,0 @@
|
|
1
|
-
jQuery ()->
|
2
|
-
$(".get-oauth-token").colorbox(
|
3
|
-
transition: "none"
|
4
|
-
href: "#oauth-dialog"
|
5
|
-
inline: true
|
6
|
-
)
|
7
|
-
|
8
|
-
$(".modal-close").click (ev) ->
|
9
|
-
$.colorbox.close()
|
10
|
-
ev.preventDefault()
|
11
|
-
|
12
|
-
addNewParamField = (container) ->
|
13
|
-
nextId = "parameter-" + $('.parameter', container).length
|
14
|
-
copy = $('.template .parameter').clone().attr('id', nextId)
|
15
|
-
$('.close-field', copy).click (ev) ->
|
16
|
-
$('#' + nextId).detach()
|
17
|
-
$('.add-field', copy).click (ev) ->
|
18
|
-
addNewParamField(container)
|
19
|
-
copy.show().appendTo(container)
|
20
|
-
|
21
|
-
buildData = (container) ->
|
22
|
-
data = {}
|
23
|
-
$('.parameter', container).each (index) ->
|
24
|
-
name = $('.name', this).val()
|
25
|
-
value = $('.value', this).val()
|
26
|
-
data[name] = value
|
27
|
-
data
|
28
|
-
|
29
|
-
$('.console #method').change (ev) ->
|
30
|
-
if $(this).val() == 'POST' or $(this).val() == 'PUT'
|
31
|
-
if $('.parameters .parameter').length == 0
|
32
|
-
addNewParamField($('.parameters'))
|
33
|
-
else
|
34
|
-
$('.parameters').empty()
|
35
|
-
|
36
|
-
buildHyperlinks = (json) ->
|
37
|
-
html = $('<div/>').text(json).html().replace /"href": "(\/.*?)"/g, "\"href\": \"<a>$1</a>\""
|
38
|
-
dom = $("<div>#{html}</div>")
|
39
|
-
$('a', dom).each (i) ->
|
40
|
-
$(this).attr('href', "#{location.pathname}?location=#{encodeURIComponent($(this).text())}&method=GET")
|
41
|
-
dom.html()
|
42
|
-
|
43
|
-
$('.console .send-request').click (ev) ->
|
44
|
-
$('#api-headers').text ''
|
45
|
-
$('#api-response').text ''
|
46
|
-
|
47
|
-
console.log buildData($('.parameters'))
|
48
|
-
$.ajax
|
49
|
-
type: $('#method').val(),
|
50
|
-
url: $('#base').val() + $('#location').val(),
|
51
|
-
headers: {'Authorization': 'Bearer ' + $('#access_token').val()},
|
52
|
-
cache: false,
|
53
|
-
data: buildData($('.parameters')),
|
54
|
-
dataType: 'json',
|
55
|
-
complete: ->
|
56
|
-
queryString = $.param({'location': $('#location').val(), 'method': $('#method').val()})
|
57
|
-
newFullpath = "#{location.pathname}?#{queryString}"
|
58
|
-
history.pushState('', '', newFullpath)
|
59
|
-
$("#oauth-dialog #return_to").val(newFullpath)
|
60
|
-
success: (data, textStatus, xhr) ->
|
61
|
-
$('#api-headers').text("#{xhr.status} #{xhr.statusText}\n" + xhr.getAllResponseHeaders())
|
62
|
-
$('#api-response').html buildHyperlinks(JSON.stringify(data, undefined, 2))
|
63
|
-
error: (xhr, textStatus, error) ->
|
64
|
-
$('#api-headers').text("#{xhr.status} #{xhr.statusText}\n" + xhr.getAllResponseHeaders())
|
65
|
-
$('#api-response').text xhr.responseText
|
66
|
-
ev.preventDefault()
|
67
|
-
|
68
|
-
if $('.console #token').val() != '' && $('.console #location').val() != '' && $('.console #method').val() == 'GET'
|
69
|
-
$('.send-request').click()
|
70
|
-
|
71
|
-
if $('.oauth-callback-redirect').size() > 0
|
72
|
-
token = window.location.hash.match(/\#access_token=(\w+)/)[1]
|
73
|
-
if token
|
74
|
-
$('#access_token').val(token)
|
75
|
-
$('form.oauth-callback-redirect').submit()
|
76
|
-
|
77
|
-
$('#oauth-dialog .token-scope-check-all').click (ev) ->
|
78
|
-
$('.token-scope-checkbox').prop('checked', this.checked)
|
79
|
-
|
80
|
-
$('#oauth-dialog .token-scope-checkbox').click (ev) ->
|
81
|
-
if $('.token-scope-checkbox:not(:checked)').length == 0
|
82
|
-
$('.token-scope-check-all').prop('checked', true)
|
83
|
-
else if not this.checked
|
84
|
-
$('.token-scope-check-all').prop('checked', false)
|