-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.js
56 lines (44 loc) · 1.36 KB
/
example.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
var sys = require('sys'),
hyperpublic = require('./lib/hyperpublic');
var callback = function (msg) {
return function (data, code) {
console.log(msg);
console.log('------------------------');
console.log(sys.inspect(data));
console.log('------------------------\n');
};
}
var client_id = '';
var client_secret = '';
var api = new hyperpublic.API(client_id, client_secret);
api.people.create({
"email":"jonathan@hyperpublic.com",
"name":"Jonathan",
"password": "my_password",
"tags": "test"
}, callback('/people/{query}'));
api.things.create({
"display_name": "macbook",
"tags": "sup",
"image_url": "http://developers.hyperpublic.com/images/logo.png",
}, callback('/things/{create}'));
api.people.create({
"display_name": "mcdonalods",
"tags": "fries",
"image_url": "http://developers.hyperpublic.com/images/logo.png",
}, callback('/people/{create}'));
api.people.show(4, callback('/people/{id}'));
api.people.find({
'zipcode': '11211',
'limit': '2'
}, callback('/people/{query}'));
api.things.show(722, callback('/things/{id}'));
api.things.find({
'zipcode': '11211',
'limit': '2'
}, callback('/things/{query}'));
api.places.show(100, callback('/places/{id}'))
api.places.find({
'zipcode': '11211',
'limit': '2'
}, callback('/places/{query}'));;