Skip to content

Commit eae3173

Browse files
committed
Renamed.
Nothing more, really. Well, tweaked files to match new naming.
1 parent 63242bd commit eae3173

File tree

4 files changed

+18
-53
lines changed

4 files changed

+18
-53
lines changed

api/static/js/aja.min.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/static/js/jquery.rest.min.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

api/static/js/urcpp.js

Lines changed: 11 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,15 @@
1-
// See both:
2-
// * https://github.com/mattdesl/module-best-practices
3-
// * https://css-tricks.com/how-do-you-structure-javascript-the-module-pattern-edition/
4-
51
var urcpp = function (version) {
6-
var h = {
7-
client: null,
8-
9-
init: function (version) {
10-
console.log("Creating a version '" + version + "' client.");
11-
12-
var c = new $.RestClient('/urcpp/' + version + '/');
13-
// Establish all of our endpoints.
14-
c.add('get', { isSingle: true });
15-
c.add('set', { isSingle: true });
16-
c.get.add('facultydetails', { stripTrailingSlash: true});
17-
c.show();
18-
19-
h.client = c;
20-
},
21-
22-
// All functions should take a single dictionary (object)
23-
// as an argument. It would be good if we used consistent
24-
// keys for those arguments. For the moment, I'm going
25-
// to use good commenting practice to make sure the
26-
// programmer knows which keys to include...
27-
28-
// PARAMS
29-
// username: string
30-
// data: dictionary
31-
// PURPOSE
32-
// Gets faculty details.
33-
fd: function (params) {
34-
h.client.get.facultydetails.create (params.username, params.data).done (params.done);
2+
var h = {
3+
faculty: {
4+
details: function (username, fun) {
5+
aja()
6+
.method ('POST')
7+
.url ('/urcpp/' + version + '/faculty/details/' + username)
8+
.body ( { username: username })
9+
.on ('success', fun).go();
10+
}
3511
}
36-
};
37-
38-
h.init(version);
12+
}
3913

4014
return h;
41-
}
15+
};

api/static/test.html

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<head>
33
<title>The Title</title>
44
<script src="//code.jquery.com/jquery-1.11.3.min.js"></script>
5-
<script src = "/s/js/jquery.rest.min.js"> </script>
5+
<script src = "/s/js/aja.min.js"> </script>
66
<script src = "/s/js/urcpp.js"> </script>
77
</head>
88
<body>
@@ -26,20 +26,13 @@
2626
</div>
2727

2828
<script>
29-
// This creates a new version 1 API object
3029
api = urcpp('v1');
31-
// Then, we can invoke the "getfacultydetails"
32-
// method on that object, with 'jadudm' as the
33-
// first parameter and a dictionary as the post data.
30+
var show = function (d) {
31+
console.log (d);
32+
$("#echo").text(JSON.stringify (d));
33+
};
3434

35-
// We can also use that result to modify our webpage.
36-
api.fd (
37-
{ username: 'jadudm',
38-
data: { "foo" : "bar" },
39-
done: function (result) {
40-
console.log(result);
41-
$("#echo").text(JSON.stringify(result));
42-
}});
35+
api.faculty.details ('jadudm', show);
4336
</script>
4437
</body>
4538
</html>

0 commit comments

Comments
 (0)