Skip to content

Commit 004a17b

Browse files
committed
Refactoring
1 parent f0c97de commit 004a17b

File tree

23 files changed

+1666
-225
lines changed

23 files changed

+1666
-225
lines changed

docs/.vuepress/components/RestReferenceEntry.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
};
8989
},
9090
async beforeMount() {
91-
console.clear();
91+
// console.clear();
9292
9393
const site = this.$site;
9494
const pages = site.pages;
@@ -99,7 +99,7 @@
9999
100100
const schemaUrl = function() {
101101
let schema = props.resource.split('.')[0];
102-
console.log('schema: ', schema);
102+
// console.log('schema: ', schema);
103103
if (schema === 'merchant') {
104104
return 'merchant';
105105
} else if (schema === 'oauth2') {
@@ -176,11 +176,11 @@
176176
177177
// console.log('pages.frontmatter.schema: ', site.pages.frontmatter);
178178
if (pages.frontmatter.operationId === a.operationId) {
179-
console.group('Found:', a.operationId);
179+
// console.group('Found:', a.operationId);
180180
// console.log('operationId: ', a.operationId);
181-
console.log('pages.title: ', pages.title);
182-
console.log('pages.path: ', pages.path);
183-
console.log(a);
181+
// console.log('pages.title: ', pages.title);
182+
// console.log('pages.path: ', pages.path);
183+
// console.log(a);
184184
console.groupEnd();
185185
186186
data.resourceOverviewUrl = pages.frontmatter.schema;
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
export default (callback) => {
2+
// console.clear();
3+
4+
const site = this.$site;
5+
const page = this.$page;
6+
7+
const frontmatter = this.$frontmatter;
8+
9+
const props = this.$props;
10+
const data = this.$data;
11+
12+
let reference;
13+
let currentMethods;
14+
15+
function log(msg, ref) {
16+
console.log(msg, ": ", ref);
17+
}
18+
19+
const operations = ["post", "get", "put", "delete"];
20+
21+
if (page.reference) {
22+
reference = page.reference;
23+
// log("reference", reference);
24+
} else if (site.pages[0].reference) {
25+
reference = site.pages[0].reference;
26+
// log("reference", reference);
27+
} else {
28+
console.warn(
29+
"Neither $page.reference or $site.pages[0].reference found..."
30+
);
31+
}
32+
33+
frontmatter.title = "REST Resource: " + frontmatter.title;
34+
35+
// console.log(frontmatter.api);
36+
37+
_.filter(reference, function (api, name) {
38+
// console.log(api.info);
39+
40+
if (frontmatter.api === name) {
41+
// log("reference", reference[name]);
42+
// log("paths", reference[name].paths);
43+
44+
_.filter(reference[name].paths, function (a, b) {
45+
// log("a", b);
46+
47+
_.filter(a, function (c, d) {
48+
// log("d", d);
49+
operations.forEach((operation) => {
50+
if (d === operation) {
51+
// log("c", c);
52+
53+
let schema = c.operationId.split(/\.(?=[^\.]+$)/)[0];
54+
// log("schema", schema);
55+
// log("frontmatter.schema", frontmatter.schema);
56+
if (schema === frontmatter.schema) {
57+
// log("schema", schema);
58+
59+
let method = c.operationId.split(/\.(?=[^\.]+$)/)[1];
60+
c.method = method;
61+
// log("method", method);
62+
63+
let excerpt = c.description
64+
.replace(/([.?!])\s*(?=[A-Z])/g, "$1|")
65+
.split("|")[0];
66+
// console.log(excerpt);
67+
68+
c.excerpt = excerpt;
69+
70+
// log("c", c);
71+
72+
data.methods.push(c);
73+
currentMethods.push(c);
74+
log("currentMethods", currentMethods);
75+
}
76+
}
77+
});
78+
});
79+
});
80+
81+
}
82+
});
83+
84+
setTimeout(() => {
85+
callback(null, currentMethods);
86+
}, 3000);
87+
};

docs/.vuepress/styles/index.styl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@
2323
span
2424
font-weight: 500;
2525

26+
footer.copyright
27+
min-height: 2rem;
28+
margin-top: 0;
29+
padding: 2rem;
30+
overflow: auto;
31+
2632
a.noLink:hover
2733
text-decoration: none !important;
2834

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<template>
2+
<footer class="copyright">
3+
<center>
4+
<small class="inner">
5+
Except as otherwise noted, the content of this page is licensed under
6+
the
7+
<a target="_blank" href="https://creativecommons.org/licenses/by/4.0/"
8+
>Creative Commons Attribution 4.0 License</a
9+
>
10+
<span
11+
><svg
12+
xmlns="http://www.w3.org/2000/svg"
13+
aria-hidden="true"
14+
focusable="false"
15+
x="0px"
16+
y="0px"
17+
viewBox="0 0 100 100"
18+
width="15"
19+
height="15"
20+
class="icon outbound"
21+
>
22+
<path
23+
fill="currentColor"
24+
d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"
25+
></path>
26+
<polygon
27+
fill="currentColor"
28+
points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"
29+
></polygon>
30+
</svg>
31+
<span class="sr-only">(opens new window)</span></span
32+
>, and code samples are licensedunder the
33+
<a target="_blank" href="https://www.apache.org/licenses/LICENSE-2.0"
34+
>Apache 2.0 License</a
35+
><span
36+
><svg
37+
xmlns="http://www.w3.org/2000/svg"
38+
aria-hidden="true"
39+
focusable="false"
40+
x="0px"
41+
y="0px"
42+
viewBox="0 0 100 100"
43+
width="15"
44+
height="15"
45+
class="icon outbound"
46+
>
47+
<path
48+
fill="currentColor"
49+
d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"
50+
></path>
51+
<polygon
52+
fill="currentColor"
53+
points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"
54+
></polygon>
55+
</svg>
56+
<span class="sr-only">(opens new window)</span></span
57+
> For details, see the
58+
<router-link :to="'/terms/site-policies'"
59+
>Settle for Developers Site Policies</router-link
60+
>.
61+
</small>
62+
</center>
63+
</footer>
64+
</template>

0 commit comments

Comments
 (0)