-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.js
107 lines (96 loc) · 2.63 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/*
Must set following env variables before running
see sturents.com/software/developer
export STURENTS_PUBLIC_KEY=
export STURENTS_API_KEY=
export LANDLORD_ID=
Then we import the StuRents library
*/
var sturents = require('./index.js');
/**
Example of how to call fetchHouses
*/
console.log('Fetching all houses');
sturents.fetchHouses(function(response){
var houses = response.branches[0].properties;
console.log('Total properties found ' + houses.length);
houses.forEach(function(house){
console.log(house.reference);
});
});
/**
Example of add house
*/
console.log('Adding a house');
var request = {
"reference" : "Property_reference_1234", // Must be unique across my properties, will use this for updating this property
"available_from": "2017-09-01",
"beds": "1",
"rooms_let_individually": "false",
"quantity": "",
"property_type": "Residential",
"description": "Some description of the house",
"facilities": ["LCD TV", "Microwave", "Parking", "Complimentary Broadband & WiFi"],
"address": {
"property_name": "",
"property_number": "1",
"road_name": "Hilton Road",
"city": "London",
"postcode": "EC2 7AF",
"uprn": ""
},
"coordinates": {
"lat": "",
"lng": ""
},
"contract": {
"price": {
"amount": 80,
"amount_per": "person",
"time_period": "person",
"utilities": {
"water": true,
"gas": true,
"electricity": true,
"broadband": false,
"phone": false,
"contents_insurance": false
}
},
"min_contract_weeks": "",
"deposit": {
"amount": 250,
"amount_per": "person"
}
},
"media": {
"photos": [{
"photo": "http:\/\/images.website.com\/4eb81da2a4b33a0635f752749529f0fb\/large\/1185.jpg",
"thumb": "http:\/\/images.website.com\/4eb81da2a4b33a0635f752749529f0fb\/thumbnails\/1185.jpg",
"type": "url"
},
{
"photo": "http:\/\/images.website.com\/4eb81da2a4b33a0635f752749529f0fb\/large\/1185.jpg",
"thumb": "http:\/\/images.website.com\/4eb81da2a4b33a0635f752749529f0fb\/thumbnails\/1185.jpg",
"type": "url"
}],
"videos": [],
"floorplans": []
},
"energy_performance": {
'epc_reference': '',
'epc_certificate' : '',
},
"accreditations": [],
"incomplete": "0",
"eligibility": {
'undergraduate_student' : true,
'postgraduate_student' : true,
'professional' : false,
'trainee' : false,
'dss' : false,
'pets_permitted' : false,
'smoking_permitted' : false
}
};
sturents.addHouse(request);