add ByMe
@ -31,6 +31,7 @@ gulp.task('styles', function() {
|
||||
|
||||
gulp.task('copy', function() {
|
||||
gulp.src(['src/img/**/*']).pipe(gulp.dest('live/img'));
|
||||
gulp.src(['src/gfx/**/*']).pipe(gulp.dest('live/gfx'));
|
||||
gulp.src(['src/browserconfig.xml', 'src/site.webmanifest', 'src/service-worker.js', 'src/bridger.js']).pipe(gulp.dest('live'));
|
||||
gulp.src(['src/v1/index.html']).pipe(gulp.dest('live'));
|
||||
});
|
||||
|
186
notes/cruachan.json
Normal file
@ -0,0 +1,186 @@
|
||||
{
|
||||
"response": {
|
||||
"result": [
|
||||
{
|
||||
"cards": [
|
||||
{
|
||||
"card_id": "4b5b8c71-58d2-3f26-abce-318e3d3a01d6",
|
||||
"rendering_engine": "custom",
|
||||
"type": "MORNING_NIGHT",
|
||||
"type_display_name": "Set Alarm",
|
||||
"ttl": 1519771568,
|
||||
"layout": {
|
||||
"template": "morning_night"
|
||||
},
|
||||
"data": {},
|
||||
"modules": {},
|
||||
"reason": "",
|
||||
"notify": false,
|
||||
"ranking_arguments": {
|
||||
"USER_LOCATION:OTHER": 1.0,
|
||||
"USER_SPEED:STILL": 1.0,
|
||||
"TIME_OF_DAY_RANGE:NIGHT": 1.0,
|
||||
"STREAM_TYPE:MAIN": 1.0,
|
||||
"rule_score": 3.0,
|
||||
"TIER": 3.0,
|
||||
"score": 0.5
|
||||
},
|
||||
"instrumentation": {
|
||||
"rid": "a2u4t81d96f5g",
|
||||
"bucket": "ga"
|
||||
}
|
||||
},
|
||||
{
|
||||
"card_id": "83a014c3-c0a4-3242-b5a8-79d011b677d6",
|
||||
"rendering_engine": "custom",
|
||||
"type": "WEATHER",
|
||||
"type_display_name": "Weather",
|
||||
"ttl": 1519771568,
|
||||
"layout": {
|
||||
"template": "weather"
|
||||
},
|
||||
"data": {},
|
||||
"modules": {},
|
||||
"reason": "",
|
||||
"notify": false,
|
||||
"ranking_arguments": {
|
||||
"TIME_OF_DAY_RANGE:NIGHT": 1.0,
|
||||
"STREAM_TYPE:MAIN": 1.0,
|
||||
"rule_score": 3.0,
|
||||
"TIER": 3.0,
|
||||
"score": 0.25
|
||||
},
|
||||
"instrumentation": {
|
||||
"rid": "a2u4t81d96f5g",
|
||||
"bucket": "ga"
|
||||
}
|
||||
},
|
||||
{
|
||||
"card_id": "c81eac4b-4553-3d60-85a6-178968bd5065",
|
||||
"rendering_engine": "custom",
|
||||
"type": "NEWS_DIGEST",
|
||||
"type_display_name": "News Digest",
|
||||
"ttl": 1519771568,
|
||||
"layout": {
|
||||
"template": "news_digest"
|
||||
},
|
||||
"data": {},
|
||||
"modules": {},
|
||||
"reason": "",
|
||||
"notify": false,
|
||||
"ranking_arguments": {
|
||||
"TIME_OF_DAY_RANGE:NIGHT": 1.0,
|
||||
"STREAM_TYPE:MAIN": 1.0,
|
||||
"rule_score": 2.0,
|
||||
"TIER": 2.0,
|
||||
"score": 0.25
|
||||
},
|
||||
"instrumentation": {
|
||||
"rid": "a2u4t81d96f5g",
|
||||
"bucket": "ga"
|
||||
}
|
||||
},
|
||||
{
|
||||
"card_id": "bcacee7a-d79a-3e4e-a5b8-77c5b6480a8c",
|
||||
"rendering_engine": "custom",
|
||||
"type": "CALENDAR",
|
||||
"type_display_name": "Calendar",
|
||||
"ttl": 1519771568,
|
||||
"layout": {
|
||||
"template": "calendar"
|
||||
},
|
||||
"data": {},
|
||||
"modules": {},
|
||||
"reason": "",
|
||||
"notify": false,
|
||||
"ranking_arguments": {
|
||||
"USER_LOCATION:OTHER": 1.0,
|
||||
"TIME_OF_DAY_RANGE:NIGHT": 1.0,
|
||||
"STREAM_TYPE:MAIN": 1.0,
|
||||
"rule_score": 2.0,
|
||||
"TIER": 2.0,
|
||||
"score": 0.25
|
||||
},
|
||||
"instrumentation": {
|
||||
"rid": "a2u4t81d96f5g",
|
||||
"bucket": "ga"
|
||||
}
|
||||
},
|
||||
{
|
||||
"card_id": "9953c0e9-5b77-3162-bcf4-e19fcd1f541f",
|
||||
"rendering_engine": "custom",
|
||||
"type": "VENUE_INFO",
|
||||
"type_display_name": "Venues",
|
||||
"ttl": 1519602368,
|
||||
"layout": {
|
||||
"template": "venue_info"
|
||||
},
|
||||
"data": {
|
||||
"name": "Cruachan Power Station",
|
||||
"category": "Scenic Lookout",
|
||||
"iconUrl": "https://ss3.4sqi.net/img/categories_v2/building/default_64.png",
|
||||
"id": "4c233b549a67a5937ea7dd87",
|
||||
"provider": "foursquare",
|
||||
"tips": [
|
||||
"Bring your O2 or Vodafone phone so you can actually get a signal to check in!",
|
||||
"a good exscuse for a check in!"
|
||||
],
|
||||
"images": [
|
||||
"https://igx.4sqi.net/img/general/612x612/16198007__KficeTL_D2tiqT7Zgu3wJyiL0485yVS_uNYAtCHOxw.jpg",
|
||||
"https://igx.4sqi.net/img/general/612x612/16198007_gXoDHf06UwW-n-hUe8ul5udJut2DDZ7GocGN0Akn6IA.jpg",
|
||||
"https://igx.4sqi.net/img/general/640x480/cWA5MDOAyYCEqszteU7y4Fgq3W9ngKrNaXNIF3VraEc.jpg",
|
||||
"https://igx.4sqi.net/img/general/537x720/4442790_8SNrTl-wGnc9c6Ds7bHdcZeqbT9T-ScMw36KErzLDhU.jpg",
|
||||
"https://igx.4sqi.net/img/general/720x960/4353161_Rr_HCB-pEhemJxkBAmH5wWN68rju4MhbtEahLFa8trk.jpg"
|
||||
],
|
||||
"address": "A85",
|
||||
"city": "Dalmally",
|
||||
"state": "",
|
||||
"zip": "PA33 1AN",
|
||||
"twitter": {
|
||||
"handle": null,
|
||||
"viewIntent": null,
|
||||
"tweetIntent": null
|
||||
},
|
||||
"yelp": {
|
||||
"url": "https://m.yelp.com/biz/cruachan-power-station-visitor-centre-dalmally?adjust_creative=ogmBMO91tbdmscbTIaQEdA&utm_campaign=yelp_api&utm_medium=api_v2_search&utm_source=ogmBMO91tbdmscbTIaQEdA",
|
||||
"rating": 4.5,
|
||||
"reviewCount": 2,
|
||||
"viewIntent": "https://m.yelp.com/biz/cruachan-power-station-visitor-centre-dalmally?adjust_creative=ogmBMO91tbdmscbTIaQEdA&utm_campaign=yelp_api&utm_medium=api_v2_search&utm_source=ogmBMO91tbdmscbTIaQEdA#Intent;action=android.intent.action.VIEW;end"
|
||||
}
|
||||
},
|
||||
"modules": {},
|
||||
"reason": "",
|
||||
"notify": false,
|
||||
"ranking_arguments": {
|
||||
"poi_latitude": 56.39449115920086,
|
||||
"poi_longitude": -5.1161516920810755,
|
||||
"USER_LOCATION:OTHER": 1.0,
|
||||
"req_longitude": -5.11662,
|
||||
"req_latitude": 56.3946,
|
||||
"STREAM_TYPE:MAIN": 1.0,
|
||||
"USER_LOCATION_POI_CONFIDENCE:HIGH": 1.0,
|
||||
"rule_score": 0.0,
|
||||
"TIER": 0.0,
|
||||
"USER_DIST_FROM_REQ_LOC:WITHIN_100M": 1.0,
|
||||
"score": 0.25
|
||||
},
|
||||
"instrumentation": {
|
||||
"rid": "a2u4t81d96f5g",
|
||||
"bucket": "ga"
|
||||
}
|
||||
},
|
||||
{
|
||||
"card_id": "eea4f59a-e8a2-3e12-a917-96e254c416d5",
|
||||
"rendering_engine": "custom",
|
||||
"type": "VENUE_CHOOSER",
|
||||
"type_display_name": "Around Me",
|
||||
"ttl": 1519602368,
|
||||
"layout": {
|
||||
"template": "venue_chooser"
|
||||
},
|
||||
"data": {
|
||||
"venues": [
|
||||
{
|
||||
"name": "Lochawe",
|
||||
"category": "River",
|
||||
"iconUrl": "https://ss3.4sqi
|
66
notes/cruachan_explorfs.json
Normal file
@ -0,0 +1,66 @@
|
||||
{
|
||||
"id": "4c233b549a67a5937ea7dd87",
|
||||
"name": "Cruachan Power Station",
|
||||
"contact": {
|
||||
"phone": "+441866822618",
|
||||
"formattedPhone": "+44 1866 822618"
|
||||
},
|
||||
"location": {
|
||||
"address": "A85",
|
||||
"lat": 56.39449115920086,
|
||||
"lng": -5.1161516920810755,
|
||||
"labeledLatLngs": [
|
||||
{
|
||||
"label": "display",
|
||||
"lat": 56.39449115920086,
|
||||
"lng": -5.1161516920810755
|
||||
}
|
||||
],
|
||||
"distance": 30,
|
||||
"postalCode": "PA33 1AN",
|
||||
"cc": "GB",
|
||||
"city": "Dalmally",
|
||||
"country": "United Kingdom",
|
||||
"formattedAddress": [
|
||||
"A85",
|
||||
"Dalmally",
|
||||
"PA33 1AN",
|
||||
"United Kingdom"
|
||||
]
|
||||
},
|
||||
"categories": [
|
||||
{
|
||||
"id": "4bf58dd8d48988d130941735",
|
||||
"name": "Building",
|
||||
"pluralName": "Buildings",
|
||||
"shortName": "Building",
|
||||
"icon": {
|
||||
"prefix": "https://ss3.4sqi.net/img/categories_v2/building/default_",
|
||||
"suffix": ".png"
|
||||
},
|
||||
"primary": true
|
||||
}
|
||||
],
|
||||
"verified": false,
|
||||
"stats": {
|
||||
"tipCount": 2,
|
||||
"usersCount": 98,
|
||||
"checkinsCount": 100
|
||||
},
|
||||
"url": "http://www.visitcruachan.co.uk",
|
||||
"venueRatingBlacklisted": true,
|
||||
"beenHere": {
|
||||
"count": 0,
|
||||
"marked": false,
|
||||
"lastCheckinExpiredAt": 0
|
||||
},
|
||||
"photos": {
|
||||
"count": 0,
|
||||
"groups": []
|
||||
},
|
||||
"hereNow": {
|
||||
"count": 0,
|
||||
"summary": "Nobody here",
|
||||
"groups": []
|
||||
}
|
||||
}
|
391
notes/cruachan_fs.json
Normal file
@ -0,0 +1,391 @@
|
||||
{
|
||||
"meta": {
|
||||
"code": 200,
|
||||
"requestId": "5a9346554c1f674701ccd91c"
|
||||
},
|
||||
"response": {
|
||||
"venue": {
|
||||
"id": "4c233b549a67a5937ea7dd87",
|
||||
"name": "Cruachan Power Station",
|
||||
"contact": {
|
||||
"phone": "+441866822618",
|
||||
"formattedPhone": "+44 1866 822618"
|
||||
},
|
||||
"location": {
|
||||
"address": "A85",
|
||||
"lat": 56.39449115920086,
|
||||
"lng": -5.1161516920810755,
|
||||
"labeledLatLngs": [
|
||||
{
|
||||
"label": "display",
|
||||
"lat": 56.39449115920086,
|
||||
"lng": -5.1161516920810755
|
||||
}
|
||||
],
|
||||
"postalCode": "PA33 1AN",
|
||||
"cc": "GB",
|
||||
"city": "Dalmally",
|
||||
"country": "United Kingdom",
|
||||
"formattedAddress": [
|
||||
"A85",
|
||||
"Dalmally",
|
||||
"PA33 1AN",
|
||||
"United Kingdom"
|
||||
]
|
||||
},
|
||||
"canonicalUrl": "https://foursquare.com/v/cruachan-power-station/4c233b549a67a5937ea7dd87",
|
||||
"categories": [
|
||||
{
|
||||
"id": "4bf58dd8d48988d130941735",
|
||||
"name": "Building",
|
||||
"pluralName": "Buildings",
|
||||
"shortName": "Building",
|
||||
"icon": {
|
||||
"prefix": "https://ss3.4sqi.net/img/categories_v2/building/default_",
|
||||
"suffix": ".png"
|
||||
},
|
||||
"primary": true
|
||||
},
|
||||
{
|
||||
"id": "4bf58dd8d48988d165941735",
|
||||
"name": "Scenic Lookout",
|
||||
"pluralName": "Scenic Lookouts",
|
||||
"shortName": "Scenic Lookout",
|
||||
"icon": {
|
||||
"prefix": "https://ss3.4sqi.net/img/categories_v2/parks_outdoors/sceniclookout_",
|
||||
"suffix": ".png"
|
||||
}
|
||||
}
|
||||
],
|
||||
"verified": false,
|
||||
"stats": {
|
||||
"tipCount": 2,
|
||||
"usersCount": 146,
|
||||
"checkinsCount": 100,
|
||||
"visitsCount": 150
|
||||
},
|
||||
"url": "http://www.visitcruachan.co.uk",
|
||||
"likes": {
|
||||
"count": 3,
|
||||
"groups": [
|
||||
{
|
||||
"type": "others",
|
||||
"count": 3,
|
||||
"items": [
|
||||
{
|
||||
"id": "148882502",
|
||||
"firstName": "James",
|
||||
"lastName": "Braid",
|
||||
"gender": "none",
|
||||
"photo": {
|
||||
"prefix": "https://igx.4sqi.net/img/user/",
|
||||
"suffix": "/blank_boy.png",
|
||||
"default": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "21137780",
|
||||
"firstName": "Simon",
|
||||
"lastName": "Gregory",
|
||||
"gender": "male",
|
||||
"photo": {
|
||||
"prefix": "https://igx.4sqi.net/img/user/",
|
||||
"suffix": "/NZ5Z5VJMRRNPKIPL.jpg"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"summary": "3 Likes"
|
||||
},
|
||||
"dislike": false,
|
||||
"ok": false,
|
||||
"venueRatingBlacklisted": true,
|
||||
"beenHere": {
|
||||
"count": 0,
|
||||
"unconfirmedCount": 0,
|
||||
"marked": false,
|
||||
"lastCheckinExpiredAt": 0
|
||||
},
|
||||
"specials": {
|
||||
"count": 0,
|
||||
"items": []
|
||||
},
|
||||
"photos": {
|
||||
"count": 5,
|
||||
"groups": [
|
||||
{
|
||||
"type": "venue",
|
||||
"name": "Venue photos",
|
||||
"count": 5,
|
||||
"items": [
|
||||
{
|
||||
"id": "51878588498e053c231b5333",
|
||||
"createdAt": 1367836040,
|
||||
"source": {
|
||||
"name": "Instagram",
|
||||
"url": "http://instagram.com"
|
||||
},
|
||||
"prefix": "https://igx.4sqi.net/img/general/",
|
||||
"suffix": "/16198007__KficeTL_D2tiqT7Zgu3wJyiL0485yVS_uNYAtCHOxw.jpg",
|
||||
"width": 612,
|
||||
"height": 612,
|
||||
"user": {
|
||||
"id": "16198007",
|
||||
"firstName": "houdi",
|
||||
"gender": "male",
|
||||
"photo": {
|
||||
"prefix": "https://igx.4sqi.net/img/user/",
|
||||
"suffix": "/C1OQYP3FHOP2YJYM.jpg"
|
||||
}
|
||||
},
|
||||
"visibility": "public"
|
||||
},
|
||||
{
|
||||
"id": "5187853e498ee4fb7757a79e",
|
||||
"createdAt": 1367835966,
|
||||
"source": {
|
||||
"name": "Instagram",
|
||||
"url": "http://instagram.com"
|
||||
},
|
||||
"prefix": "https://igx.4sqi.net/img/general/",
|
||||
"suffix": "/16198007_gXoDHf06UwW-n-hUe8ul5udJut2DDZ7GocGN0Akn6IA.jpg",
|
||||
"width": 612,
|
||||
"height": 612,
|
||||
"user": {
|
||||
"id": "16198007",
|
||||
"firstName": "houdi",
|
||||
"gender": "male",
|
||||
"photo": {
|
||||
"prefix": "https://igx.4sqi.net/img/user/",
|
||||
"suffix": "/C1OQYP3FHOP2YJYM.jpg"
|
||||
}
|
||||
},
|
||||
"visibility": "public"
|
||||
},
|
||||
{
|
||||
"id": "4fd9da1ee4b0ea76a6c80417",
|
||||
"createdAt": 1339677214,
|
||||
"source": {
|
||||
"name": "Foursquare for Android",
|
||||
"url": "https://foursquare.com/download/#/android"
|
||||
},
|
||||
"prefix": "https://igx.4sqi.net/img/general/",
|
||||
"suffix": "/cWA5MDOAyYCEqszteU7y4Fgq3W9ngKrNaXNIF3VraEc.jpg",
|
||||
"width": 640,
|
||||
"height": 480,
|
||||
"user": {
|
||||
"id": "2597712",
|
||||
"firstName": "Nia",
|
||||
"lastName": "Wearn",
|
||||
"gender": "female",
|
||||
"photo": {
|
||||
"prefix": "https://igx.4sqi.net/img/user/",
|
||||
"suffix": "/QWON2DY3SGFP0JIN.jpg"
|
||||
}
|
||||
},
|
||||
"visibility": "public"
|
||||
},
|
||||
{
|
||||
"id": "50ceeb05e4b01c69f47dd479",
|
||||
"createdAt": 1355737861,
|
||||
"source": {
|
||||
"name": "Foursquare for iOS",
|
||||
"url": "https://foursquare.com/download/#/iphone"
|
||||
},
|
||||
"prefix": "https://igx.4sqi.net/img/general/",
|
||||
"suffix": "/4442790_8SNrTl-wGnc9c6Ds7bHdcZeqbT9T-ScMw36KErzLDhU.jpg",
|
||||
"width": 537,
|
||||
"height": 720,
|
||||
"user": {
|
||||
"id": "4442790",
|
||||
"firstName": "Rachel",
|
||||
"lastName": "Brown",
|
||||
"gender": "female",
|
||||
"photo": {
|
||||
"prefix": "https://igx.4sqi.net/img/user/",
|
||||
"suffix": "/40RRMDM10221RS0R.jpg"
|
||||
}
|
||||
},
|
||||
"visibility": "public"
|
||||
},
|
||||
{
|
||||
"id": "5374b0f9498e9e41f159e8fe",
|
||||
"createdAt": 1400156409,
|
||||
"source": {
|
||||
"name": "Foursquare for iOS",
|
||||
"url": "https://foursquare.com/download/#/iphone"
|
||||
},
|
||||
"prefix": "https://igx.4sqi.net/img/general/",
|
||||
"suffix": "/4353161_Rr_HCB-pEhemJxkBAmH5wWN68rju4MhbtEahLFa8trk.jpg",
|
||||
"width": 720,
|
||||
"height": 960,
|
||||
"user": {
|
||||
"id": "4353161",
|
||||
"firstName": "sunita",
|
||||
"lastName": "panich",
|
||||
"gender": "none",
|
||||
"photo": {
|
||||
"prefix": "https://igx.4sqi.net/img/user/",
|
||||
"suffix": "/I3HAQMV2YTOMNU50.jpg"
|
||||
}
|
||||
},
|
||||
"visibility": "public"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"reasons": {
|
||||
"count": 0,
|
||||
"items": []
|
||||
},
|
||||
"hereNow": {
|
||||
"count": 0,
|
||||
"summary": "Nobody here",
|
||||
"groups": []
|
||||
},
|
||||
"createdAt": 1277377364,
|
||||
"tips": {
|
||||
"count": 2,
|
||||
"groups": [
|
||||
{
|
||||
"type": "others",
|
||||
"name": "All tips",
|
||||
"count": 2,
|
||||
"items": [
|
||||
{
|
||||
"id": "4d93304df7e8dcb3e594cb12",
|
||||
"createdAt": 1301491789,
|
||||
"text": "Bring your O2 or Vodafone phone so you can actually get a signal to check in!",
|
||||
"type": "user",
|
||||
"canonicalUrl": "https://foursquare.com/item/4d93304df7e8dcb3e594cb12",
|
||||
"likes": {
|
||||
"count": 0,
|
||||
"groups": []
|
||||
},
|
||||
"logView": true,
|
||||
"agreeCount": 0,
|
||||
"disagreeCount": 0,
|
||||
"todo": {
|
||||
"count": 0
|
||||
},
|
||||
"user": {
|
||||
"id": "530470",
|
||||
"firstName": "Rob",
|
||||
"lastName": "Fisher",
|
||||
"gender": "male",
|
||||
"photo": {
|
||||
"prefix": "https://igx.4sqi.net/img/user/",
|
||||
"suffix": "/XAZKL04TO3CU0BCG.jpg"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "4d650ad689238cfa81459436",
|
||||
"createdAt": 1298467542,
|
||||
"text": "a good exscuse for a check in!",
|
||||
"type": "user",
|
||||
"canonicalUrl": "https://foursquare.com/item/4d650ad689238cfa81459436",
|
||||
"likes": {
|
||||
"count": 0,
|
||||
"groups": []
|
||||
},
|
||||
"logView": true,
|
||||
"agreeCount": 0,
|
||||
"disagreeCount": 0,
|
||||
"todo": {
|
||||
"count": 0
|
||||
},
|
||||
"user": {
|
||||
"id": "4808723",
|
||||
"firstName": "Anna",
|
||||
"lastName": "Hastings",
|
||||
"gender": "female",
|
||||
"photo": {
|
||||
"prefix": "https://igx.4sqi.net/img/user/",
|
||||
"suffix": "/LM5A3CIS2TT1UHXX.jpg"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"shortUrl": "http://4sq.com/b9RihM",
|
||||
"timeZone": "Europe/London",
|
||||
"listed": {
|
||||
"count": 1,
|
||||
"groups": [
|
||||
{
|
||||
"type": "others",
|
||||
"name": "Lists from other people",
|
||||
"count": 1,
|
||||
"items": [
|
||||
{
|
||||
"id": "51ffd2de498e3955660fd8b7",
|
||||
"name": "Holiday",
|
||||
"description": "",
|
||||
"type": "others",
|
||||
"user": {
|
||||
"id": "48298321",
|
||||
"firstName": "Hans",
|
||||
"lastName": "Peeters",
|
||||
"gender": "male",
|
||||
"photo": {
|
||||
"prefix": "https://igx.4sqi.net/img/user/",
|
||||
"suffix": "/OTQ3XLHGRYPQIQGR.jpg"
|
||||
}
|
||||
},
|
||||
"editable": false,
|
||||
"public": true,
|
||||
"collaborative": false,
|
||||
"url": "/mstrhans/list/holiday",
|
||||
"canonicalUrl": "https://foursquare.com/mstrhans/list/holiday",
|
||||
"createdAt": 1375720158,
|
||||
"updatedAt": 1377538112,
|
||||
"followers": {
|
||||
"count": 1
|
||||
},
|
||||
"listItems": {
|
||||
"count": 43,
|
||||
"items": [
|
||||
{
|
||||
"id": "v4c233b549a67a5937ea7dd87",
|
||||
"createdAt": 1376225268
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"pageUpdates": {
|
||||
"count": 0,
|
||||
"items": []
|
||||
},
|
||||
"inbox": {
|
||||
"count": 0,
|
||||
"items": []
|
||||
},
|
||||
"venueChains": [],
|
||||
"attributes": {
|
||||
"groups": []
|
||||
},
|
||||
"bestPhoto": {
|
||||
"id": "51878588498e053c231b5333",
|
||||
"createdAt": 1367836040,
|
||||
"source": {
|
||||
"name": "Instagram",
|
||||
"url": "http://instagram.com"
|
||||
},
|
||||
"prefix": "https://igx.4sqi.net/img/general/",
|
||||
"suffix": "/16198007__KficeTL_D2tiqT7Zgu3wJyiL0485yVS_uNYAtCHOxw.jpg",
|
||||
"width": 612,
|
||||
"height": 612,
|
||||
"visibility": "public"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
73
notes/garage_fssearch.json
Normal file
@ -0,0 +1,73 @@
|
||||
{
|
||||
"id": "4d603bf5865a224be0b2a885",
|
||||
"name": "Morrisons Petrol Station",
|
||||
"contact": {
|
||||
"phone": "+441389742466",
|
||||
"formattedPhone": "+44 1389 742466",
|
||||
"twitter": "morrisonsoffers",
|
||||
"facebook": "132649753459881",
|
||||
"facebookUsername": "Morrisons",
|
||||
"facebookName": "Morrisons"
|
||||
},
|
||||
"location": {
|
||||
"address": "55 Glasgow Rd",
|
||||
"lat": 55.94299971824836,
|
||||
"lng": -4.5619118213653564,
|
||||
"labeledLatLngs": [
|
||||
{
|
||||
"label": "display",
|
||||
"lat": 55.94299971824836,
|
||||
"lng": -4.5619118213653564
|
||||
}
|
||||
],
|
||||
"distance": 21,
|
||||
"postalCode": "G82 1RB",
|
||||
"cc": "GB",
|
||||
"city": "Dumbarton",
|
||||
"state": "West Dunbartonshire",
|
||||
"country": "United Kingdom",
|
||||
"formattedAddress": [
|
||||
"55 Glasgow Rd",
|
||||
"Dumbarton",
|
||||
"West Dunbartonshire",
|
||||
"G82 1RB",
|
||||
"United Kingdom"
|
||||
]
|
||||
},
|
||||
"categories": [
|
||||
{
|
||||
"id": "4bf58dd8d48988d113951735",
|
||||
"name": "Gas Station",
|
||||
"pluralName": "Gas Stations",
|
||||
"shortName": "Gas Station",
|
||||
"icon": {
|
||||
"prefix": "https://ss3.4sqi.net/img/categories_v2/shops/gas_",
|
||||
"suffix": ".png"
|
||||
},
|
||||
"primary": true
|
||||
}
|
||||
],
|
||||
"verified": true,
|
||||
"stats": {
|
||||
"tipCount": 0,
|
||||
"usersCount": 27,
|
||||
"checkinsCount": 39
|
||||
},
|
||||
"url": "https://my.morrisons.com/storefinder/1169",
|
||||
"allowMenuUrlEdit": true,
|
||||
"beenHere": {
|
||||
"lastCheckinExpiredAt": 0
|
||||
},
|
||||
"specials": {
|
||||
"count": 0,
|
||||
"items": []
|
||||
},
|
||||
"hereNow": {
|
||||
"count": 0,
|
||||
"summary": "Nobody here",
|
||||
"groups": []
|
||||
},
|
||||
"referralId": "v-1519602611",
|
||||
"venueChains": [],
|
||||
"hasPerk": false
|
||||
}
|
188
notes/rightbyme.json
Normal file
@ -0,0 +1,188 @@
|
||||
{
|
||||
"response": {
|
||||
"result": [
|
||||
{
|
||||
"cards": [
|
||||
{
|
||||
"card_id": "4b5b8c71-58d2-3f26-abce-318e3d3a01d6",
|
||||
"rendering_engine": "custom",
|
||||
"type": "MORNING_NIGHT",
|
||||
"type_display_name": "Set Alarm",
|
||||
"ttl": 1519683951,
|
||||
"layout": {
|
||||
"template": "morning_night"
|
||||
},
|
||||
"data": {},
|
||||
"modules": {},
|
||||
"reason": "",
|
||||
"notify": false,
|
||||
"ranking_arguments": {
|
||||
"USER_LOCATION:OTHER": 1.0,
|
||||
"USER_SPEED:STILL": 1.0,
|
||||
"TIME_OF_DAY_RANGE:NIGHT": 1.0,
|
||||
"STREAM_TYPE:MAIN": 1.0,
|
||||
"rule_score": 3.0,
|
||||
"TIER": 3.0,
|
||||
"score": 0.5
|
||||
},
|
||||
"instrumentation": {
|
||||
"rid": "64q97upd93pje",
|
||||
"bucket": "ga"
|
||||
}
|
||||
},
|
||||
{
|
||||
"card_id": "83a014c3-c0a4-3242-b5a8-79d011b677d6",
|
||||
"rendering_engine": "custom",
|
||||
"type": "WEATHER",
|
||||
"type_display_name": "Weather",
|
||||
"ttl": 1519683951,
|
||||
"layout": {
|
||||
"template": "weather"
|
||||
},
|
||||
"data": {},
|
||||
"modules": {},
|
||||
"reason": "",
|
||||
"notify": false,
|
||||
"ranking_arguments": {
|
||||
"TIME_OF_DAY_RANGE:NIGHT": 1.0,
|
||||
"STREAM_TYPE:MAIN": 1.0,
|
||||
"rule_score": 3.0,
|
||||
"TIER": 3.0,
|
||||
"score": 0.25
|
||||
},
|
||||
"instrumentation": {
|
||||
"rid": "64q97upd93pje",
|
||||
"bucket": "ga"
|
||||
}
|
||||
},
|
||||
{
|
||||
"card_id": "c81eac4b-4553-3d60-85a6-178968bd5065",
|
||||
"rendering_engine": "custom",
|
||||
"type": "NEWS_DIGEST",
|
||||
"type_display_name": "News Digest",
|
||||
"ttl": 1519683951,
|
||||
"layout": {
|
||||
"template": "news_digest"
|
||||
},
|
||||
"data": {},
|
||||
"modules": {},
|
||||
"reason": "",
|
||||
"notify": false,
|
||||
"ranking_arguments": {
|
||||
"TIME_OF_DAY_RANGE:NIGHT": 1.0,
|
||||
"STREAM_TYPE:MAIN": 1.0,
|
||||
"rule_score": 2.0,
|
||||
"TIER": 2.0,
|
||||
"score": 0.25
|
||||
},
|
||||
"instrumentation": {
|
||||
"rid": "64q97upd93pje",
|
||||
"bucket": "ga"
|
||||
}
|
||||
},
|
||||
{
|
||||
"card_id": "bcacee7a-d79a-3e4e-a5b8-77c5b6480a8c",
|
||||
"rendering_engine": "custom",
|
||||
"type": "CALENDAR",
|
||||
"type_display_name": "Calendar",
|
||||
"ttl": 1519683951,
|
||||
"layout": {
|
||||
"template": "calendar"
|
||||
},
|
||||
"data": {},
|
||||
"modules": {},
|
||||
"reason": "",
|
||||
"notify": false,
|
||||
"ranking_arguments": {
|
||||
"USER_LOCATION:OTHER": 1.0,
|
||||
"TIME_OF_DAY_RANGE:NIGHT": 1.0,
|
||||
"STREAM_TYPE:MAIN": 1.0,
|
||||
"rule_score": 2.0,
|
||||
"TIER": 2.0,
|
||||
"score": 0.25
|
||||
},
|
||||
"instrumentation": {
|
||||
"rid": "64q97upd93pje",
|
||||
"bucket": "ga"
|
||||
}
|
||||
},
|
||||
{
|
||||
"card_id": "9953c0e9-5b77-3162-bcf4-e19fcd1f541f",
|
||||
"rendering_engine": "custom",
|
||||
"type": "VENUE_INFO",
|
||||
"type_display_name": "Venues",
|
||||
"ttl": 1519514751,
|
||||
"layout": {
|
||||
"template": "venue_info"
|
||||
},
|
||||
"data": {
|
||||
"name": "Tesco",
|
||||
"category": "Grocery Store",
|
||||
"iconUrl": "https://ss3.4sqi.net/img/categories_v2/shops/food_grocery_64.png",
|
||||
"id": "4c5ff51213791b8d0d5c4eaf",
|
||||
"provider": "foursquare",
|
||||
"tips": [
|
||||
"Prepare to be deafened by relief calls over the loudspeaker"
|
||||
],
|
||||
"images": [],
|
||||
"address": "23-25 Sinclair Street",
|
||||
"city": "Helensburgh",
|
||||
"state": "Argyll and Bute",
|
||||
"zip": "G84 8SR",
|
||||
"twitter": {
|
||||
"handle": "uktescooffers",
|
||||
"viewIntent": "https://twitter.com/uktescooffers#Intent;action=android.intent.action.VIEW;package=com.twitter.android;end",
|
||||
"tweetIntent": "#Intent;action=android.intent.action.SEND;component=com.twitter.android/.PostActivity;S.android.intent.extra.TEXT=@uktescooffers;end"
|
||||
},
|
||||
"yelp": {
|
||||
"url": "https://m.yelp.com/biz/tesco-stores-helensburgh?adjust_creative=ogmBMO91tbdmscbTIaQEdA&utm_campaign=yelp_api&utm_medium=api_v2_search&utm_source=ogmBMO91tbdmscbTIaQEdA",
|
||||
"rating": 3.5,
|
||||
"reviewCount": 4,
|
||||
"viewIntent": "https://m.yelp.com/biz/tesco-stores-helensburgh?adjust_creative=ogmBMO91tbdmscbTIaQEdA&utm_campaign=yelp_api&utm_medium=api_v2_search&utm_source=ogmBMO91tbdmscbTIaQEdA#Intent;action=android.intent.action.VIEW;end"
|
||||
}
|
||||
},
|
||||
"modules": {},
|
||||
"reason": "",
|
||||
"notify": false,
|
||||
"ranking_arguments": {
|
||||
"poi_latitude": 56.00348039818216,
|
||||
"poi_longitude": -4.733884334564209,
|
||||
"USER_LOCATION:OTHER": 1.0,
|
||||
"req_longitude": -4.7335567,
|
||||
"req_latitude": 56.003506,
|
||||
"STREAM_TYPE:MAIN": 1.0,
|
||||
"USER_LOCATION_POI_CONFIDENCE:HIGH": 1.0,
|
||||
"rule_score": 0.0,
|
||||
"TIER": 0.0,
|
||||
"USER_DIST_FROM_REQ_LOC:WITHIN_100M": 1.0,
|
||||
"score": 0.25
|
||||
},
|
||||
"instrumentation": {
|
||||
"rid": "64q97upd93pje",
|
||||
"bucket": "ga"
|
||||
}
|
||||
},
|
||||
{
|
||||
"card_id": "eea4f59a-e8a2-3e12-a917-96e254c416d5",
|
||||
"rendering_engine": "custom",
|
||||
"type": "VENUE_CHOOSER",
|
||||
"type_display_name": "Around Me",
|
||||
"ttl": 1519514751,
|
||||
"layout": {
|
||||
"template": "venue_chooser"
|
||||
},
|
||||
"data": {
|
||||
"venues": [
|
||||
{
|
||||
"name": "Helensburgh",
|
||||
"category": "Town",
|
||||
"iconUrl": "https://ss3.4sqi.net/img/categories_v2/parks_outdoors/neighborhood_64.png",
|
||||
"id": "4ba2614bf964a52015f337e3",
|
||||
"provider": "foursquare",
|
||||
"eid": "{\"card\":\"venue\",\"id\":\"4ba2614bf964a52015f337e3\"}"
|
||||
},
|
||||
{
|
||||
"name": "Mr Kebab",
|
||||
"category": "Fast Food Restaurant",
|
||||
"iconUrl": "https://ss3.4sqi.net/img/categories_v2/food/fastfood_64.png",
|
||||
"id": "4
|
402
notes/rightbyme.txt
Normal file
@ -0,0 +1,402 @@
|
||||
// https://api.foursquare.com/v2/venues/search?ll=56.003506,-4.733558&radius=5&limit=1&client_id=IXXFUGW3NC3DEVS2V5EU4NV4CL5E12AYGUPIR2D3U3B5DX4B&client_secret=MZRIJDCEKUMVERA1OKVAIZI0TYAEBD3W2A2AGPTPI5TOLL1D&v=20180224
|
||||
/*
|
||||
|
||||
{
|
||||
"meta": {
|
||||
"code": 200,
|
||||
"requestId": "5a91f3064c1f6746973ceddd"
|
||||
},
|
||||
"response": {
|
||||
"confident": false,
|
||||
"venues": [
|
||||
{
|
||||
"allowMenuUrlEdit": true,
|
||||
"beenHere": {
|
||||
"lastCheckinExpiredAt": 0
|
||||
},
|
||||
"categories": [
|
||||
{
|
||||
"icon": {
|
||||
"prefix": "https://ss3.4sqi.net/img/categories_v2/shops/food_grocery_",
|
||||
"suffix": ".png"
|
||||
},
|
||||
"id": "4bf58dd8d48988d118951735",
|
||||
"name": "Grocery Store",
|
||||
"pluralName": "Grocery Stores",
|
||||
"primary": true,
|
||||
"shortName": "Grocery Store"
|
||||
}
|
||||
],
|
||||
"contact": {
|
||||
"formattedPhone": "+44 845 677 9348",
|
||||
"phone": "+448456779348",
|
||||
"twitter": "uktescooffers"
|
||||
},
|
||||
"hasPerk": false,
|
||||
"hereNow": {
|
||||
"count": 0,
|
||||
"groups": [
|
||||
],
|
||||
"summary": "Nobody here"
|
||||
},
|
||||
"id": "4c5ff51213791b8d0d5c4eaf",
|
||||
"location": {
|
||||
"address": "23-25 Sinclair Street",
|
||||
"cc": "GB",
|
||||
"city": "Helensburgh",
|
||||
"country": "United Kingdom",
|
||||
"distance": 20,
|
||||
"formattedAddress": [
|
||||
"23-25 Sinclair Street",
|
||||
"Helensburgh",
|
||||
"Argyll and Bute",
|
||||
"G84 8SR",
|
||||
"United Kingdom"
|
||||
],
|
||||
"labeledLatLngs": [
|
||||
{
|
||||
"label": "display",
|
||||
"lat": 56.00348039818216,
|
||||
"lng": -4.733884334564209
|
||||
}
|
||||
],
|
||||
"lat": 56.00348039818216,
|
||||
"lng": -4.733884334564209,
|
||||
"postalCode": "G84 8SR",
|
||||
"state": "Argyll and Bute"
|
||||
},
|
||||
"name": "Tesco",
|
||||
"referralId": "v-1519514374",
|
||||
"specials": {
|
||||
"count": 0,
|
||||
"items": [
|
||||
]
|
||||
},
|
||||
"stats": {
|
||||
"checkinsCount": 76,
|
||||
"tipCount": 1,
|
||||
"usersCount": 41
|
||||
},
|
||||
"storeId": "1492",
|
||||
"url": "http://www.tesco.com",
|
||||
"venueChains": [
|
||||
{
|
||||
"id": "556e1d0ca7c82e6b7251e0b0"
|
||||
}
|
||||
],
|
||||
"verified": true
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// https://api.yelp.com/v3/businesses/search?latitude=55.94228694015362&longitude=-4.555356528181545&term=Delhi+Darbar&radius=250&sort_by=best_match
|
||||
|
||||
|
||||
// https://api.yelp.com/v3/businesses/search?latitude=55.94299971824836&longitude=-4.561911821365356&term=Morrisons+Petrol+Station&radius=250&sort_by=best_match
|
||||
|
||||
// https://api.yelp.com/v3/businesses/search?latitude=56.00348039818216&longitude=-4.733884334564209&term=Tesco&radius=250&sort_by=best_match
|
||||
/*
|
||||
|
||||
{
|
||||
"businesses": [
|
||||
{
|
||||
"categories": [
|
||||
{
|
||||
"alias": "grocery",
|
||||
"title": "Grocery"
|
||||
}
|
||||
],
|
||||
"coordinates": {
|
||||
"latitude": 56.0035142354994,
|
||||
"longitude": -4.73386721648295
|
||||
},
|
||||
"display_phone": "+44 345 677 9348",
|
||||
"distance": 3.910164152196,
|
||||
"id": "tesco-stores-helensburgh",
|
||||
"image_url": "https://s3-media3.fl.yelpcdn.com/bphoto/yjIlNPrTJki6y2gBUMYVRA/o.jpg",
|
||||
"is_closed": false,
|
||||
"location": {
|
||||
"address1": "23-25 Sinclair Street",
|
||||
"address2": "",
|
||||
"address3": "",
|
||||
"city": "Helensburgh",
|
||||
"country": "GB",
|
||||
"display_address": [
|
||||
"23-25 Sinclair Street",
|
||||
"Helensburgh G84 8SR",
|
||||
"United Kingdom"
|
||||
],
|
||||
"state": "GLG",
|
||||
"zip_code": "G84 8SR"
|
||||
},
|
||||
"name": "Tesco Stores",
|
||||
"phone": "+443456779348",
|
||||
"price": "££",
|
||||
"rating": 3.5,
|
||||
"review_count": 4,
|
||||
"transactions": [
|
||||
],
|
||||
"url": "https://www.yelp.com/biz/tesco-stores-helensburgh?adjust_creative=s8FdwjzKWCpdbkUzShvAgg&utm_campaign=yelp_api_v3&utm_medium=api_v3_business_search&utm_source=s8FdwjzKWCpdbkUzShvAgg"
|
||||
}
|
||||
],
|
||||
"region": {
|
||||
"center": {
|
||||
"latitude": 56.0034803982,
|
||||
"longitude": -4.7338843346
|
||||
}
|
||||
},
|
||||
"total": 2
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
// https://api.foursquare.com/v2/venues/4c5ff51213791b8d0d5c4eaf?client_id=IXXFUGW3NC3DEVS2V5EU4NV4CL5E12AYGUPIR2D3U3B5DX4B&client_secret=MZRIJDCEKUMVERA1OKVAIZI0TYAEBD3W2A2AGPTPI5TOLL1D&v=20180224
|
||||
/*
|
||||
|
||||
{
|
||||
"meta": {
|
||||
"code": 200,
|
||||
"requestId": "5a91f2ea6a607123cf0674c2"
|
||||
},
|
||||
"response": {
|
||||
"venue": {
|
||||
"allowMenuUrlEdit": true,
|
||||
"attributes": {
|
||||
"groups": [
|
||||
]
|
||||
},
|
||||
"beenHere": {
|
||||
"count": 0,
|
||||
"lastCheckinExpiredAt": 0,
|
||||
"marked": false,
|
||||
"unconfirmedCount": 0
|
||||
},
|
||||
"canonicalUrl": "https://foursquare.com/v/tesco/4c5ff51213791b8d0d5c4eaf",
|
||||
"categories": [
|
||||
{
|
||||
"icon": {
|
||||
"prefix": "https://ss3.4sqi.net/img/categories_v2/shops/food_grocery_",
|
||||
"suffix": ".png"
|
||||
},
|
||||
"id": "4bf58dd8d48988d118951735",
|
||||
"name": "Grocery Store",
|
||||
"pluralName": "Grocery Stores",
|
||||
"primary": true,
|
||||
"shortName": "Grocery Store"
|
||||
}
|
||||
],
|
||||
"contact": {
|
||||
"formattedPhone": "+44 845 677 9348",
|
||||
"phone": "+448456779348",
|
||||
"twitter": "uktescooffers"
|
||||
},
|
||||
"createdAt": 1281357074,
|
||||
"description": "Every little helps",
|
||||
"dislike": false,
|
||||
"hereNow": {
|
||||
"count": 0,
|
||||
"groups": [
|
||||
],
|
||||
"summary": "Nobody here"
|
||||
},
|
||||
"id": "4c5ff51213791b8d0d5c4eaf",
|
||||
"inbox": {
|
||||
"count": 0,
|
||||
"items": [
|
||||
]
|
||||
},
|
||||
"likes": {
|
||||
"count": 1,
|
||||
"groups": [
|
||||
{
|
||||
"count": 1,
|
||||
"items": [
|
||||
{
|
||||
"firstName": "Jonathan",
|
||||
"gender": "male",
|
||||
"id": "723181",
|
||||
"lastName": "D.",
|
||||
"photo": {
|
||||
"prefix": "https://igx.4sqi.net/img/user/",
|
||||
"suffix": "/PEMF5HPRFRSRMQ0L.jpg"
|
||||
}
|
||||
}
|
||||
],
|
||||
"type": "others"
|
||||
}
|
||||
],
|
||||
"summary": "1 Like"
|
||||
},
|
||||
"listed": {
|
||||
"count": 0,
|
||||
"groups": [
|
||||
{
|
||||
"count": 0,
|
||||
"items": [
|
||||
],
|
||||
"name": "Lists from other people",
|
||||
"type": "others"
|
||||
}
|
||||
]
|
||||
},
|
||||
"location": {
|
||||
"address": "23-25 Sinclair Street",
|
||||
"cc": "GB",
|
||||
"city": "Helensburgh",
|
||||
"country": "United Kingdom",
|
||||
"formattedAddress": [
|
||||
"23-25 Sinclair Street",
|
||||
"Helensburgh",
|
||||
"Argyll and Bute",
|
||||
"G84 8SR",
|
||||
"United Kingdom"
|
||||
],
|
||||
"labeledLatLngs": [
|
||||
{
|
||||
"label": "display",
|
||||
"lat": 56.00348039818216,
|
||||
"lng": -4.733884334564209
|
||||
}
|
||||
],
|
||||
"lat": 56.00348039818216,
|
||||
"lng": -4.733884334564209,
|
||||
"postalCode": "G84 8SR",
|
||||
"state": "Argyll and Bute"
|
||||
},
|
||||
"name": "Tesco",
|
||||
"ok": false,
|
||||
"page": {
|
||||
"pageInfo": {
|
||||
"links": {
|
||||
"count": 1,
|
||||
"items": [
|
||||
{
|
||||
"url": "http://www.tesco.com"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"user": {
|
||||
"bio": "",
|
||||
"contact": {
|
||||
"twitter": "uktescooffers"
|
||||
},
|
||||
"firstName": "Tesco Offers",
|
||||
"gender": "none",
|
||||
"homeCity": "United Kingdom",
|
||||
"id": "26219082",
|
||||
"lists": {
|
||||
"groups": [
|
||||
{
|
||||
"count": 2,
|
||||
"items": [
|
||||
],
|
||||
"type": "created"
|
||||
}
|
||||
]
|
||||
},
|
||||
"photo": {
|
||||
"prefix": "https://igx.4sqi.net/img/user/",
|
||||
"suffix": "/RN4OT2YOFHDUB0DJ.jpg"
|
||||
},
|
||||
"tips": {
|
||||
"count": 1
|
||||
},
|
||||
"type": "chain"
|
||||
}
|
||||
},
|
||||
"pageUpdates": {
|
||||
"count": 0,
|
||||
"items": [
|
||||
]
|
||||
},
|
||||
"photos": {
|
||||
"count": 0,
|
||||
"groups": [
|
||||
]
|
||||
},
|
||||
"rating": 5.5,
|
||||
"ratingColor": "FF9600",
|
||||
"ratingSignals": 5,
|
||||
"reasons": {
|
||||
"count": 0,
|
||||
"items": [
|
||||
]
|
||||
},
|
||||
"shortUrl": "http://4sq.com/dC1wZO",
|
||||
"specials": {
|
||||
"count": 0,
|
||||
"items": [
|
||||
]
|
||||
},
|
||||
"stats": {
|
||||
"checkinsCount": 76,
|
||||
"tipCount": 1,
|
||||
"usersCount": 45,
|
||||
"visitsCount": 82
|
||||
},
|
||||
"storeId": "1492",
|
||||
"timeZone": "Europe/London",
|
||||
"tips": {
|
||||
"count": 1,
|
||||
"groups": [
|
||||
{
|
||||
"count": 1,
|
||||
"items": [
|
||||
{
|
||||
"agreeCount": 0,
|
||||
"canonicalUrl": "https://foursquare.com/item/4c6e5107d5c3a1cd08f1c72b",
|
||||
"createdAt": 1282298119,
|
||||
"disagreeCount": 0,
|
||||
"id": "4c6e5107d5c3a1cd08f1c72b",
|
||||
"likes": {
|
||||
"count": 0,
|
||||
"groups": [
|
||||
]
|
||||
},
|
||||
"logView": true,
|
||||
"text": "Prepare to be deafened by relief calls over the loudspeaker",
|
||||
"todo": {
|
||||
"count": 0
|
||||
},
|
||||
"type": "user",
|
||||
"user": {
|
||||
"firstName": "Dean",
|
||||
"gender": "male",
|
||||
"id": "2505497",
|
||||
"lastName": "Newell",
|
||||
"photo": {
|
||||
"prefix": "https://igx.4sqi.net/img/user/",
|
||||
"suffix": "/2JS3DS4QAM3BAQ3C.jpg"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"name": "All tips",
|
||||
"type": "others"
|
||||
}
|
||||
]
|
||||
},
|
||||
"url": "http://www.tesco.com",
|
||||
"venueChains": [
|
||||
{
|
||||
"bestName": {
|
||||
"lang": "en",
|
||||
"name": "Tesco"
|
||||
},
|
||||
"id": "556e1d0ca7c82e6b7251e0b0",
|
||||
"logo": {
|
||||
"prefix": "https://igx.4sqi.net/img/user/",
|
||||
"suffix": "/342353049_eouBKgGS_l39opqWMP-NJ4wfr18YZzez2y2m-WDzcq1ddDexbQd9kpEB1Z0XE6xr7FGzbd5J9"
|
||||
}
|
||||
}
|
||||
],
|
||||
"verified": true
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=uktescooffers&count=5&trim_user=true&exclude_replies=true&include_rts=false
|
37
notes/yelp.json
Normal file
@ -0,0 +1,37 @@
|
||||
{
|
||||
"id": "cruachan-power-station-visitor-centre-dalmally",
|
||||
"name": "Cruachan Power Station Visitor Centre",
|
||||
"image_url": "https://s3-media2.fl.yelpcdn.com/bphoto/eRvbe7h4JBGQB5g1P0iWFg/o.jpg",
|
||||
"is_closed": false,
|
||||
"url": "https://www.yelp.com/biz/cruachan-power-station-visitor-centre-dalmally?adjust_creative=s8FdwjzKWCpdbkUzShvAgg&utm_campaign=yelp_api_v3&utm_medium=api_v3_business_search&utm_source=s8FdwjzKWCpdbkUzShvAgg",
|
||||
"review_count": 2,
|
||||
"categories": [
|
||||
{
|
||||
"alias": "visitorcenters",
|
||||
"title": "Visitor Centers"
|
||||
}
|
||||
],
|
||||
"rating": 4.5,
|
||||
"coordinates": {
|
||||
"latitude": 56.394515,
|
||||
"longitude": -5.116196
|
||||
},
|
||||
"transactions": [],
|
||||
"location": {
|
||||
"address1": "Cruachan Power Station",
|
||||
"address2": null,
|
||||
"address3": null,
|
||||
"city": "Dalmally",
|
||||
"zip_code": "PA33 1AN",
|
||||
"country": "GB",
|
||||
"state": "AGB",
|
||||
"display_address": [
|
||||
"Cruachan Power Station",
|
||||
"Dalmally PA33 1AN",
|
||||
"United Kingdom"
|
||||
]
|
||||
},
|
||||
"phone": "+441866822618",
|
||||
"display_phone": "+44 1866 822618",
|
||||
"distance": 2.360238088184
|
||||
}
|
63
package-lock.json
generated
@ -59,6 +59,24 @@
|
||||
"samsam": "1.3.0"
|
||||
}
|
||||
},
|
||||
"@tonybadguy/call-me-maybe": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@tonybadguy/call-me-maybe/-/call-me-maybe-2.0.1.tgz",
|
||||
"integrity": "sha1-IzJn6woWJcL1lU8nrzZLSinG40Q=",
|
||||
"requires": {
|
||||
"caseless": "0.11.0",
|
||||
"error": "7.0.2",
|
||||
"small-request": "2.0.2",
|
||||
"string-template": "1.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"caseless": {
|
||||
"version": "0.11.0",
|
||||
"resolved": "https://registry.npmjs.org/caseless/-/caseless-0.11.0.tgz",
|
||||
"integrity": "sha1-cVuW6phBWTzDMGeSP17GDr2k99c="
|
||||
}
|
||||
}
|
||||
},
|
||||
"JSONStream": {
|
||||
"version": "1.3.2",
|
||||
"resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.2.tgz",
|
||||
@ -2198,6 +2216,22 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"error": {
|
||||
"version": "7.0.2",
|
||||
"resolved": "https://registry.npmjs.org/error/-/error-7.0.2.tgz",
|
||||
"integrity": "sha1-pfdf/02ZJhJt2sDqXcOOaJFTywI=",
|
||||
"requires": {
|
||||
"string-template": "0.2.1",
|
||||
"xtend": "4.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"string-template": {
|
||||
"version": "0.2.1",
|
||||
"resolved": "https://registry.npmjs.org/string-template/-/string-template-0.2.1.tgz",
|
||||
"integrity": "sha1-QpMuWYo1LQH8IuwzZ9nYTuxsmt0="
|
||||
}
|
||||
}
|
||||
},
|
||||
"error-ex": {
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.1.tgz",
|
||||
@ -9533,6 +9567,14 @@
|
||||
"uuid": "3.2.1"
|
||||
}
|
||||
},
|
||||
"request-function": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/request-function/-/request-function-2.0.0.tgz",
|
||||
"integrity": "sha1-J6rOJ/hx48L9SKGdrXXKOExLhlQ=",
|
||||
"requires": {
|
||||
"error": "7.0.2"
|
||||
}
|
||||
},
|
||||
"request-promise": {
|
||||
"version": "4.2.2",
|
||||
"resolved": "https://registry.npmjs.org/request-promise/-/request-promise-4.2.2.tgz",
|
||||
@ -10027,6 +10069,14 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"small-request": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/small-request/-/small-request-2.0.2.tgz",
|
||||
"integrity": "sha1-pEuo2G+i3iTBaAhSaMVn+IUDBlM=",
|
||||
"requires": {
|
||||
"request-function": "2.0.0"
|
||||
}
|
||||
},
|
||||
"smart-buffer": {
|
||||
"version": "1.1.15",
|
||||
"resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-1.1.15.tgz",
|
||||
@ -10499,6 +10549,11 @@
|
||||
"resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz",
|
||||
"integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM="
|
||||
},
|
||||
"string-template": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/string-template/-/string-template-1.0.0.tgz",
|
||||
"integrity": "sha1-np8iM9wA8hhxjsN5oopWc+zKi5Y="
|
||||
},
|
||||
"string-width": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz",
|
||||
@ -11809,6 +11864,14 @@
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"yelp-fusion": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/yelp-fusion/-/yelp-fusion-2.0.3.tgz",
|
||||
"integrity": "sha1-cB7yyQLqyM9LK6U92VKnDYeCRPg=",
|
||||
"requires": {
|
||||
"@tonybadguy/call-me-maybe": "2.0.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -34,7 +34,8 @@
|
||||
"node-foursquare-venues": "^1.1.0",
|
||||
"openweather-apis": "^3.3.5",
|
||||
"uglifyify": "^4.0.5",
|
||||
"underscore": "^1.8.3"
|
||||
"underscore": "^1.8.3",
|
||||
"yelp-fusion": "^2.0.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"expect.js": "^0.3.1",
|
||||
|
22
server.js
@ -5,6 +5,7 @@ const logger = require('log4js').getLogger('Server');
|
||||
const weather = require('./server/weather');
|
||||
const euronews = require('./server/euronews');
|
||||
const foursquare = require('./server/foursquare');
|
||||
const rightbyme = require('./server/RightByMe');
|
||||
|
||||
logger.level = 'debug';
|
||||
|
||||
@ -18,7 +19,7 @@ const cache = apicache.middleware;
|
||||
|
||||
app.use(express.static(path.join(__dirname, sitePath)));
|
||||
|
||||
app.get('/weather', cache('20 minutes'), (req, res) => {
|
||||
app.get('/weather', cache('45 minutes'), (req, res) => {
|
||||
if (req.query.hasOwnProperty('ll'))
|
||||
weather.doGetOpenWeather(req.query.ll)
|
||||
.then((d) => {
|
||||
@ -52,7 +53,24 @@ app.get('/fsexplore', cache('30 minutes'), (req, res) => {
|
||||
}
|
||||
});
|
||||
|
||||
app.get('/news', cache('20 minutes'), (req, res) => {
|
||||
app.get('/rightbyme', cache('12 hour'), (req, res) => {
|
||||
if (req.query.hasOwnProperty('ll'))
|
||||
rightbyme.doGetRightByMe(req.query.ll)
|
||||
.then((d) => {
|
||||
res.send(d);
|
||||
}).catch((e) => {
|
||||
logger.error(e);
|
||||
res.status(500).send('There was an error!');
|
||||
});
|
||||
|
||||
else {
|
||||
// throw new Error('Weather: LL missing');
|
||||
logger.warn('FS: LL missing');
|
||||
res.status(500).send('LL Missing');
|
||||
}
|
||||
});
|
||||
|
||||
app.get('/news', cache('30 minutes'), (req, res) => {
|
||||
euronews.getEuroNews().then((d) => {
|
||||
res.send(d);
|
||||
}).catch((e) => {
|
||||
|
240
server/RightByMe.js
Normal file
@ -0,0 +1,240 @@
|
||||
const logger = require('log4js').getLogger('FSQ');
|
||||
const foursquare = require('node-foursquare-venues')('IXXFUGW3NC3DEVS2V5EU4NV4CL5E12AYGUPIR2D3U3B5DX4B', 'MZRIJDCEKUMVERA1OKVAIZI0TYAEBD3W2A2AGPTPI5TOLL1D', '20170801');
|
||||
|
||||
const yelp = require('yelp-fusion');
|
||||
|
||||
const client = yelp.client('YlF_b6D149xr_xnrrYudlSnpn1A53b67vALlIK2HnD0ymBXQocRvPW3KjGN8jZNw0KnyAqxGaOzU7CLVPr84_KbnTxutNRXFVR9axmRqGN6ccda1xahoZo58KC2GWnYx');
|
||||
|
||||
const { get, isEmpty } = require('lodash');
|
||||
|
||||
const { reduceExplore, reduceYelp, reduceFullFS } = require('./reducers/rightbyme');
|
||||
|
||||
|
||||
logger.level = 'debug';
|
||||
|
||||
function doFSVenueSearch(ll, data = {}) {
|
||||
let payLoad = Object.assign({}, data);
|
||||
logger.debug('>> doFSVenueSearch');
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
const fsObj = {
|
||||
'll': ll,
|
||||
'radius': 15,
|
||||
'v': '20170801',
|
||||
'limit': 1
|
||||
};
|
||||
|
||||
if (isEmpty(payLoad))
|
||||
foursquare.venues.search(fsObj, function(err, fsData) {
|
||||
if (err)
|
||||
return reject(err);
|
||||
else {
|
||||
const venues = get(fsData, 'response.venues');
|
||||
if (venues.length > 0) {
|
||||
fsP1 = venues[0];
|
||||
|
||||
payLoad = reduceExplore(fsP1);
|
||||
|
||||
return resolve(payLoad);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
else
|
||||
|
||||
return resolve(payLoad);
|
||||
});
|
||||
}
|
||||
|
||||
function doFSVenueExplore(ll) {
|
||||
let payLoad = {};
|
||||
logger.debug('>> doFSVenueExplore', ll);
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
const fsObj = {
|
||||
'll': ll,
|
||||
'radius': 35,
|
||||
'v': '20170801',
|
||||
'limit': 1
|
||||
};
|
||||
|
||||
foursquare.venues.explore(fsObj, function(err, fsData) {
|
||||
if (err)
|
||||
return reject(err);
|
||||
else {
|
||||
const groups = get(fsData, 'response.groups');
|
||||
const items = groups[0];
|
||||
const venues = items.items[0];
|
||||
|
||||
if (venues) {
|
||||
fsP1 = venues.venue;
|
||||
|
||||
payLoad = reduceExplore(fsP1);
|
||||
}
|
||||
|
||||
return resolve(payLoad);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function doYelpSearch(data = {}) {
|
||||
const payLoad = Object.assign({}, data);
|
||||
logger.debug('>> doYelpSearch');
|
||||
|
||||
const yelpSearch = {};
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
if (!isEmpty(payLoad)) {
|
||||
yelpSearch.term = payLoad.name;
|
||||
yelpSearch.latitude = payLoad.latitude;
|
||||
yelpSearch.longitude = payLoad.longitude;
|
||||
yelpSearch.location = payLoad.address;
|
||||
yelpSearch.radius = 250;
|
||||
yelpSearch.sort_by = 'best_match';
|
||||
client.search(yelpSearch).then(response => {
|
||||
const respArray = get(response, 'jsonBody.businesses');
|
||||
yelpReply = (respArray.length > 0) ? respArray[0] : {};
|
||||
|
||||
reduceYelp(yelpReply);
|
||||
|
||||
payLoad.yelp = reduceYelp(yelpReply);
|
||||
|
||||
return resolve(payLoad);
|
||||
}).catch(e => {
|
||||
console.error(e);
|
||||
|
||||
return reject(e);
|
||||
});
|
||||
}
|
||||
else
|
||||
|
||||
return resolve(payLoad);
|
||||
});
|
||||
}
|
||||
|
||||
function doFSGetFullVenue(data = {}) {
|
||||
const payLoad = Object.assign({}, data);
|
||||
logger.debug('>> doFSGetFullVenue');
|
||||
|
||||
// https://api.foursquare.com/v2/venues/4c5ff51213791b8d0d5c4eaf?client_id=IXXFUGW3NC3DEVS2V5EU4NV4CL5E12AYGUPIR2D3U3B5DX4B&client_secret=MZRIJDCEKUMVERA1OKVAIZI0TYAEBD3W2A2AGPTPI5TOLL1D&v=20180224
|
||||
return new Promise((resolve, reject) => {
|
||||
if (!isEmpty(payLoad)) {
|
||||
// stuff
|
||||
// more
|
||||
const id = payLoad.id;
|
||||
foursquare.venues.venue(id, {}, function(err, fsData) {
|
||||
if (err)
|
||||
return reject(err);
|
||||
else {
|
||||
const partPayload = reduceFullFS(get(fsData, 'response.venue'));
|
||||
const newPayload = Object.assign(payLoad, partPayload);
|
||||
|
||||
return resolve(newPayload);
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
|
||||
return resolve(payLoad);
|
||||
});
|
||||
}
|
||||
|
||||
function doGetRightByMe(ll) {
|
||||
return new Promise((resolve, reject) => {
|
||||
doFSVenueExplore(ll)
|
||||
.then((d) => {
|
||||
return doFSVenueSearch(ll, d);
|
||||
})
|
||||
.catch((e) => {
|
||||
logger.error(e);
|
||||
|
||||
return reject(e);
|
||||
// res.status(500).send('There was an error!');
|
||||
})
|
||||
.then((d) => {
|
||||
return doYelpSearch(d);
|
||||
})
|
||||
.catch((e) => {
|
||||
logger.error(e);
|
||||
|
||||
return reject(e);
|
||||
// res.status(500).send('There was an error!');
|
||||
})
|
||||
.then((d) => {
|
||||
// return doYelpSearch(d)
|
||||
return doFSGetFullVenue(d);
|
||||
})
|
||||
.catch((e) => {
|
||||
logger.error(e);
|
||||
|
||||
return reject(e);
|
||||
// res.status(500).send('There was an error!');
|
||||
})
|
||||
.then((d) => {
|
||||
logger.info('Final', d.name, d.id);;
|
||||
|
||||
return resolve(d);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
async function test(ll, near) {
|
||||
console.log('TESTING...');
|
||||
await doFSVenueExplore(ll)
|
||||
.then((d) => {
|
||||
return doFSVenueSearch(ll, d);
|
||||
})
|
||||
.catch((e) => {
|
||||
logger.error(e);
|
||||
// res.status(500).send('There was an error!');
|
||||
})
|
||||
.then((d) => {
|
||||
return doYelpSearch(d);
|
||||
})
|
||||
.catch((e) => {
|
||||
logger.error(e);
|
||||
// res.status(500).send('There was an error!');
|
||||
})
|
||||
.then((d) => {
|
||||
// return doYelpSearch(d)
|
||||
return doFSGetFullVenue(d);
|
||||
})
|
||||
.then((d) => {
|
||||
logger.info('Final', d.name, d.id);
|
||||
})
|
||||
|
||||
;
|
||||
}
|
||||
module.exports = { doGetRightByMe };
|
||||
|
||||
const tests = {
|
||||
'cruachan' : '56.3946,-5.1166',
|
||||
'morrisonsGarage' : '55.9429,-4.5622',
|
||||
'tescohelensburgh' : '56.003466,-4.733689',
|
||||
'howlinwolf' : '55.863991,-4.257788'
|
||||
};
|
||||
|
||||
// doGetRightByMe('56.3946,-5.1166'); // cruachan
|
||||
|
||||
// doGetRightByMe('55.9429,-4.5622'); // morrisons garage
|
||||
|
||||
// 56.3890134, "lng" : -5.0939317
|
||||
|
||||
// cruachan 56.3946,-5.1166
|
||||
|
||||
// tesco helensburgh
|
||||
// const location = { 'homeDistance':12.941340256604686, 'workDistance':33.47577415510536, 'latitude':56.003466, 'longitude':-4.733689, 'atHome':false, 'atWork':false, 'timestamp':1519638618383, 'll':'56.003466,-4.733689', 'llFixed':'56.003,-4.734', 'city':'Helensburgh', 'cityCC':'Helensburgh,GB', 'address':'9-13 Sinclair St, Helensburgh G84, UK' };
|
||||
|
||||
// test('56.3946,-5.1166');
|
||||
|
||||
|
||||
// howling wolf http://localhost:8110/rightbyme?ll=55.863991,-4.257788
|
||||
|
||||
/*
|
||||
{"response":{"result":[{"cards":[{"card_id":"83a014c3-c0a4-3242-b5a8-79d011b677d6","rendering_engine":"custom","type":"WEATHER","type_display_name":"Weather","ttl":1519810720,"layout":{"template":"weather"},"data":{},"modules":{},"reason":"","notify":false,"ranking_arguments":{"STREAM_TYPE:MAIN":1.0,"rule_score":3.0,"TIER":3.0,"TIME_OF_DAY_RANGE:MORNING":1.0,"score":0.6},"instrumentation":{"rid":"13kfji9d97ld0","bucket":"ga"}},{"card_id":"c81eac4b-4553-3d60-85a6-178968bd5065","rendering_engine":"custom","type":"NEWS_DIGEST","type_display_name":"News Digest","ttl":1519810720,"layout":{"template":"news_digest"},"data":{},"modules":{},"reason":"","notify":false,"ranking_arguments":{"STREAM_TYPE:MAIN":1.0,"rule_score":2.0,"TIER":2.0,"TIME_OF_DAY_RANGE:MORNING":1.0,"score":0.55},"instrumentation":{"rid":"13kfji9d97ld0","bucket":"ga"}},{"card_id":"4b5b8c71-58d2-3f26-abce-318e3d3a01d6","rendering_engine":"custom","type":"MORNING_NIGHT","type_display_name":"Set Alarm","ttl":1519810720,"layout":{"template":"morning_night"},"data":{},"modules":{},"reason":"","notify":false,"ranking_arguments":{"USER_LOCATION:OTHER":1.0,"USER_SPEED:STILL":1.0,"STREAM_TYPE:MAIN":1.0,"rule_score":3.0,"TIER":3.0,"TIME_OF_DAY_RANGE:MORNING":1.0,"score":0.5},"instrumentation":{"rid":"13kfji9d97ld0","bucket":"ga"}},{"card_id":"bcacee7a-d79a-3e4e-a5b8-77c5b6480a8c","rendering_engine":"custom","type":"CALENDAR","type_display_name":"Calendar","ttl":1519810720,"layout":{"template":"calendar"},"data":{},"modules":{},"reason":"","notify":false,"ranking_arguments":{"USER_LOCATION:OTHER":1.0,"STREAM_TYPE:MAIN":1.0,"rule_score":2.0,"TIER":2.0,"TIME_OF_DAY_RANGE:MORNING":1.0,"score":0.25},"instrumentation":{"rid":"13kfji9d97ld0","bucket":"ga"}},{"card_id":"9953c0e9-5b77-3162-bcf4-e19fcd1f541f","rendering_engine":"custom","type":"VENUE_INFO","type_display_name":"Venues","ttl":1519641520,"layout":{"template":"venue_info"},"data":{"name":"Tesco","category":"Grocery Store","iconUrl":"https://ss3.4sqi.net/img/categories_v2/shops/food_grocery_64.png","id":"4c5ff51213791b8d0d5c4eaf","provider":"foursquare","tips":["Prepare to be deafened by relief calls over the loudspeaker"],"images":[],"address":"23-25 Sinclair Street","city":"Helensburgh","state":"Argyll and Bute","zip":"G84 8SR","twitter":{"handle":"uktescooffers","viewIntent":"https://twitter.com/uktescooffers#Intent;action=android.intent.action.VIEW;package=com.twitter.android;end","tweetIntent":"#Intent;action=android.intent.action.SEND;component=com.twitter.android/.PostActivity;S.android.intent.extra.TEXT=@uktescooffers;end"},"yelp":{"url":"https://m.yelp.com/biz/tesco-stores-helensburgh?adjust_creative=ogmBMO91tbdmscbTIaQEdA&utm_campaign=yelp_api&utm_medium=api_v2_search&utm_source=ogmBMO91tbdmscbTIaQEdA","rating":3.5,"reviewCount":4,"viewIntent":"https://m.yelp.com/biz/tesco-stores-helensburgh?adjust_creative=ogmBMO91tbdmscbTIaQEdA&utm_campaign=yelp_api&utm_medium=api_v2_search&utm_source=ogmBMO91tbdmscbTIaQEdA#Intent;action=android.intent.action.VIEW;end"}},"modules":{},"reason":"","notify":false,"ranking_arguments":{"poi_latitude":56.00348039818216,"poi_longitude":-4.733884334564209,"USER_LOCATION:OTHER":1.0,"req_longitude":-4.7336884,"req_latitude":56.003464,"STREAM_TYPE:MAIN":1.0,"USER_LOCATION_POI_CONFIDENCE:HIGH":1.0,"rule_score":0.0,"TIER":0.0,"USER_DIST_FROM_REQ_LOC:WITHIN_100M":1.0,"score":0.25},"instrumentation":{"rid":"13kfji9d97ld0","bucket":"ga"}},{"card_id":"eea4f59a-e8a2-3e12-a917-96e254c416d5","rendering_engine":"custom","type":"VENUE_CHOOSER","type_display_name":"Around Me","ttl":1519641520,"layout":{"template":"venue_chooser"},"data":{"venues":[{"name":"Lido's Fish & Chips","category":"Fish & Chips Shop","iconUrl":"https://ss3.4sqi.net/img/categories_v2/food/fishandchips_64.png","id":"4b9a9a77f964a5207ec535e3","provider":"foursquare","eid":"{\"card\":\"venue\",\"id\":\"4b9a9a77f964a5207ec535e3\"}"},{"name":"Mr Kebab","category":"Fast Food Restaurant","iconUrl":"https://ss3.4sqi.net/img/categories_v2/food/fastfo
|
||||
|
||||
|
||||
{"response":{"result":[{"cards":[{"card_id":"9953c0e9-5b77-3162-bcf4-e19fcd1f541f","rendering_engine":"custom","type":"VENUE_INFO","type_display_name":"Venues","ttl":1519654292,"layout":{"template":"venue_info"},"data":{"name":"Speirs Wharf","category":"Pool","iconUrl":"https://ss3.4sqi.net/img/categories_v2/parks_outdoors/pool_64.png","id":"5211c15a11d2c83298e7f8c2","provider":"foursquare","tips":[],"images":["https://igx.4sqi.net/img/general/640x640/72939115_8s_CraZskGLT5uJz5DzRiyBvKXgy6BobQBH5u0Vcsy4.jpg","https://igx.4sqi.net/img/general/960x364/62519220_Z_xAdlllLg7Mb1BUt1b9G18IKTpF1jyeNqGCMo0WhRs.jpg","https://igx.4sqi.net/img/general/960x541/24390977_Ws2HHTyM1zKBlvejccG1BxGTt0hKBURtWQOPPxYc7IM.jpg","https://igx.4sqi.net/img/general/960x960/149524__j5bRwPX5zy5RmOu-uleVtQ-KekAS-rXAJLgc_JjipY.jpg","https://igx.4sqi.net/img/general/640x640/4894760_ZOelH_F7ljq0Mjk6Zzs7KHH8-Dn470lbq4IfFg7WGiM.jpg","https://igx.4sqi.net/img/general/640x640/4894760_kW7NmETQYJxkGfBBnhHhQdDHcVouBj7OWpZBbyy0OTM.jpg"],"telephone":"","address":"","city":"","state":"","zip":"","latitude":55.872669822119796,"longitude":-4.257480441815151,"twitter":{"handle":null,"viewIntent":null,"tweetIntent":null},"yelp":{"url":null,"rating":0.0,"reviewCount":0,"viewIntent":null}},"modules":{},"reason":"","notify":false,"ranking_arguments":{"poi_latitude":55.872669822119796,"poi_longitude":-4.257480441815151,"USER_LOCATION:OTHER":1.0,"req_longitude":-4.2577868,"req_latitude":55.86399,"USER_LOCATION_POI_CONFIDENCE:HIGH":1.0,"STREAM_TYPE":1.0,"rule_score":0.0,"TIER":0.0,"USER_DIST_FROM_REQ_LOC:WITHIN_100M":1.0,"score":0.0},"instrumentation":{"rid":"fn62krdd981s4","bucket":"ga"}}]}],"error":null}}
|
||||
*/
|
||||
|
@ -11,7 +11,8 @@ function doGetFourSquareExplore(ll) {
|
||||
'll': ll,
|
||||
'section': 'topPicks',
|
||||
'v': '20170801',
|
||||
'limit': 3
|
||||
'limit': 3,
|
||||
'radius': 500
|
||||
};
|
||||
|
||||
foursquare.venues.explore(fsObj, function(err, fsData) {
|
||||
|
99
server/reducers/rightbyme.js
Normal file
@ -0,0 +1,99 @@
|
||||
const logger = require('log4js').getLogger('FS reducers');
|
||||
|
||||
const { get, isEmpty } = require('lodash');
|
||||
|
||||
// Bearer YlF_b6D149xr_xnrrYudlSnpn1A53b67vALlIK2HnD0ymBXQocRvPW3KjGN8jZNw0KnyAqxGaOzU7CLVPr84_KbnTxutNRXFVR9axmRqGN6ccda1xahoZo58KC2GWnYx'
|
||||
|
||||
logger.level = 'debug';
|
||||
|
||||
function reduceExplore(data) {
|
||||
const obj = {};
|
||||
if (typeof data === 'undefined' || isEmpty(data)) return obj;
|
||||
const { categories, location, contact } = data;
|
||||
|
||||
// console.log(contact);
|
||||
// make copy of object;
|
||||
|
||||
const localObj = Object.assign({}, data);
|
||||
|
||||
const iconPrefix = get(categories[0], 'icon.prefix', '');
|
||||
const iconSuffix = get(categories[0], 'icon.suffix', '');
|
||||
|
||||
obj.name = get(localObj, 'name', '');
|
||||
obj.category = get(categories[0], 'shortName', '');
|
||||
obj.icon = (iconPrefix !== '') ? `${iconPrefix}64${iconSuffix}` : '';
|
||||
obj.id = get(localObj, 'id', '');
|
||||
obj.provider = 'foursquare';
|
||||
obj.address = get(location, 'formattedAddress', []).join(', ');
|
||||
obj.city = get(location, 'city', '');
|
||||
obj.state = get(location, 'state', '');
|
||||
obj.postcode = get(location, 'postalCode', '');
|
||||
obj.twitter = get(contact, 'twitter', '');
|
||||
obj.facebook = get(contact, 'facebookName', '');
|
||||
obj.url = get(localObj, 'url', '');
|
||||
obj.latitude = get(location, 'lat', '');
|
||||
obj.longitude = get(location, 'lng', '');
|
||||
|
||||
// logger.debug(JSON.stringify(obj));
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
function reduceYelp(data) {
|
||||
const obj = {};
|
||||
|
||||
if (typeof data === 'undefined' || isEmpty(data)) return obj;
|
||||
const yelpUrlfixer = /([--:\w?@%&+~#=]*\.[a-z]{2,4}\/{0,2})((?:[?&](?:\w+)=(?:\w+))+|[--:\w?@%&+~#=]+)?/g;
|
||||
|
||||
const localObj = Object.assign({}, data);
|
||||
|
||||
obj.url = get(localObj, 'url', '');
|
||||
obj.rating = get(localObj, 'rating', '');
|
||||
obj.reviewCount = get(localObj, 'review_count', '');
|
||||
|
||||
if (obj.url !== '') {
|
||||
const url = yelpUrlfixer.exec(obj.url);
|
||||
const urlBit = url[2];
|
||||
obj.viewIntent = `https://m.yelp.com/${urlBit}`;
|
||||
}
|
||||
else
|
||||
obj.viewIntent = '';
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
function reduceFullFS(data) {
|
||||
const obj = {};
|
||||
if (typeof data === 'undefined' || isEmpty(data)) return obj;
|
||||
const localObj = Object.assign({}, data);
|
||||
|
||||
const photosCount = get(localObj, 'photos.count', 0);
|
||||
const tipsCount = get(localObj, 'tips.count', 0);
|
||||
|
||||
if (photosCount > 0) {
|
||||
const photoItems = get(localObj, 'photos.groups[0].items');
|
||||
obj.images = photoItems.map(item => {
|
||||
const prefix = get(item, 'prefix', '');
|
||||
const suffix = get(item, 'suffix', '');
|
||||
const width = get(item, 'width', 640);
|
||||
const height = get(item, 'height', 480);
|
||||
|
||||
const ratio = width / 640;
|
||||
let ratioHeight = ~~(height / ratio);
|
||||
if (ratioHeight <= 0) ratioHeight = 640;
|
||||
console.log(`${width}, ${height} => ${640}, ${ratioHeight}`);
|
||||
return `${prefix}${640}x${ratioHeight}${suffix}`;
|
||||
});
|
||||
}
|
||||
|
||||
if (tipsCount > 0) {
|
||||
const tipItems = get(localObj, 'tips.groups[0].items');
|
||||
obj.tips = tipItems.map(item => {
|
||||
return get(item, 'text', '');
|
||||
});
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
module.exports = { reduceExplore, reduceYelp, reduceFullFS };
|
@ -299,3 +299,12 @@ li {
|
||||
height: 275px;
|
||||
margin-top:15px;
|
||||
}
|
||||
|
||||
#byme, #bymeYelp {
|
||||
margin-top:5px;
|
||||
}
|
||||
|
||||
#bymeYelp img {
|
||||
max-height: 100%;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
@ -1,21 +1,38 @@
|
||||
|
||||
|
||||
.scrolling-wrapper-flexbox {
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
overflow-x: auto;
|
||||
|
||||
.scrollCard {
|
||||
.scrollCard, .scrollCardHalf, .imageCard {
|
||||
flex: 0 0 auto;
|
||||
margin-right: 3px;
|
||||
margin-right: 11px;
|
||||
}
|
||||
}
|
||||
|
||||
.scrollCard {
|
||||
border: 1px solid white;
|
||||
width: 250px;
|
||||
height: 175px;
|
||||
background: mui-color('white-alpha-12');
|
||||
.scrollCard, .scrollCardHalf {
|
||||
width: 250px;
|
||||
height: 175px;
|
||||
overflow-y: hidden;
|
||||
border-radius: 3px;
|
||||
background-color: #f5f5f5;
|
||||
padding: 5px;
|
||||
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 1px 5px 0 rgba(0, 0, 0, 0.12);
|
||||
}
|
||||
|
||||
.scrollCardHalf {
|
||||
height: 85px;
|
||||
}
|
||||
|
||||
.imageCard {
|
||||
// width: 250px;
|
||||
height: 175px;
|
||||
overflow-y: hidden;
|
||||
|
||||
}
|
||||
.imageCard img {
|
||||
max-height:100%;
|
||||
max-width:100%;
|
||||
}
|
||||
|
||||
.scrolling-wrapper, .scrolling-wrapper-flexbox {
|
||||
|
BIN
src/gfx/stars_00.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
src/gfx/stars_10.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
src/gfx/stars_15.png
Normal file
After Width: | Height: | Size: 2.5 KiB |
BIN
src/gfx/stars_20.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
src/gfx/stars_25.png
Normal file
After Width: | Height: | Size: 2.5 KiB |
BIN
src/gfx/stars_30.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
src/gfx/stars_35.png
Normal file
After Width: | Height: | Size: 2.6 KiB |
BIN
src/gfx/stars_40.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
src/gfx/stars_45.png
Normal file
After Width: | Height: | Size: 2.0 KiB |
BIN
src/gfx/stars_50.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
src/gfx/yelp_logo.jpg
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
src/gfx/yssdk_yelp_logo.png
Executable file
After Width: | Height: | Size: 4.9 KiB |
@ -11,7 +11,7 @@
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
const CACHE_VERSION = 5;
|
||||
const CACHE_VERSION = 6;
|
||||
const dataCacheName = 'jubileeData-v1';
|
||||
const cacheName = 'jubilee-final-1';
|
||||
const filesToCache = [
|
||||
@ -26,7 +26,18 @@ const filesToCache = [
|
||||
'/img/favicon-16x16.png',
|
||||
'/img/favicon-32x32.png',
|
||||
'/img/android-chrome-192x192.png',
|
||||
'/img/android-chrome-512x512.png'
|
||||
'/img/android-chrome-512x512.png',
|
||||
'/gfx/stars_00.png',
|
||||
'/gfx/stars_10.png',
|
||||
'/gfx/stars_15.png',
|
||||
'/gfx/stars_20.png',
|
||||
'/gfx/stars_25.png',
|
||||
'/gfx/stars_30.png',
|
||||
'/gfx/stars_35.png',
|
||||
'/gfx/stars_40.png',
|
||||
'/gfx/stars_45.png',
|
||||
'/gfx/stars_50.png',
|
||||
'/gfx/yssdk_yelp_logo.png'
|
||||
];
|
||||
|
||||
self.addEventListener('install', function(e) {
|
||||
|
@ -25,6 +25,12 @@
|
||||
<div class="mui-container">
|
||||
<div id="greet"></div>
|
||||
|
||||
<div id="bymeShell" class="mui-panel" style="display: none;">
|
||||
<div id="byMeTitle" class="mui--text-title cardTitle">By me</div>
|
||||
<div id="byme"></div>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="nearbyShell" class="mui-panel" style="display: none;">
|
||||
<div class="mui--text-title cardTitle">Around me</div>
|
||||
<div id="nearby"></div>
|
||||
|
19
src/v1/js/Foursquare.js
Normal file
@ -0,0 +1,19 @@
|
||||
const $ = require('jquery');
|
||||
const _ = require('underscore');
|
||||
const Backbone = require('backbone');
|
||||
const request = require('request');
|
||||
const { get } = require('lodash');
|
||||
const { reduceNearby } = require('./reducers');
|
||||
const { partOfDay } = require('./utils');
|
||||
|
||||
const FSDetailView = Backbone.View.extend({
|
||||
'initialize': function(options) {
|
||||
this.eventBus = options.eventBus;
|
||||
this.fsID = options.fsID;
|
||||
|
||||
console.log('New FSDetail View');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
module.exports = { FSDetailView };
|
@ -39,7 +39,7 @@ const LocationModel = Backbone.Model.extend({
|
||||
},
|
||||
'onChange': function() {
|
||||
console.log('>> Location updated');
|
||||
console.log(this.get('location'));
|
||||
console.log(JSON.stringify(this.get('location')));
|
||||
},
|
||||
'processPosition': function(pos) {
|
||||
console.log('processPosition');
|
||||
@ -61,11 +61,13 @@ const LocationModel = Backbone.Model.extend({
|
||||
const workDistance = distance(55.861939, -4.259338, latitude, longitude);
|
||||
const atHome = (homeDistance < 0.10);
|
||||
const atWork = (workDistance < 0.10);
|
||||
const atHomeOrWork = (atHome || atWork);
|
||||
const latlong = { 'lat':latitude, 'lon':longitude };
|
||||
const ll = `${latitude},${longitude}`;
|
||||
const llFixed = `${Number.parseFloat(latitude).toFixed(3)},${Number.parseFloat(longitude).toFixed(3)}`;
|
||||
const llSix = `${Number.parseFloat(latitude).toFixed(6)},${Number.parseFloat(longitude).toFixed(6)}`;
|
||||
|
||||
const newLocation = { homeDistance, workDistance, latitude, longitude, atHome, atWork, timestamp, ll, llFixed, 'city' : '', 'cityCC':'' };
|
||||
const newLocation = { homeDistance, workDistance, latitude, longitude, atHome, atWork, atHomeOrWork, timestamp, ll, llFixed, llSix, 'city' : '', 'cityCC':'' };
|
||||
|
||||
// console.log('>> NewLocation', JSON.stringify(newLocation));
|
||||
// const distanceFromLast = distance(current.latitude, current.longitude, latitude, longitude);
|
||||
@ -73,8 +75,10 @@ const LocationModel = Backbone.Model.extend({
|
||||
if (!current /* || distanceFromLast > 1.5*/)
|
||||
geocoder.reverse(latlong)
|
||||
.then(function(res) {
|
||||
console.log(JSON.stringify(res));
|
||||
newLocation.city = res[0].city;
|
||||
newLocation.cityCC = `${res[0].city},${res[0].countryCode}`;
|
||||
newLocation.address = res[0].formattedAddress;
|
||||
this.set('location', newLocation);
|
||||
}.bind(this))
|
||||
.catch(function(err) {
|
||||
@ -96,6 +100,7 @@ const LocationModel = Backbone.Model.extend({
|
||||
.then(function(res) {
|
||||
newLocation.city = res[0].city;
|
||||
newLocation.cityCC = `${res[0].city},${res[0].countryCode}`;
|
||||
newLocation.address = res[0].formattedAddress;
|
||||
this.set('location', newLocation);
|
||||
}.bind(this))
|
||||
.catch(function(err) {
|
||||
|
@ -4,6 +4,9 @@ const Backbone = require('backbone');
|
||||
const request = require('request');
|
||||
const { get } = require('lodash');
|
||||
const { reduceNearby } = require('./reducers');
|
||||
const { toHour } = require('./utils');
|
||||
|
||||
const { FSDetailView } = require('./Foursquare');
|
||||
|
||||
// console.notificationsTitle = 'Nearby';
|
||||
|
||||
@ -39,19 +42,37 @@ const fsItemView = Backbone.View.extend({
|
||||
const NearbyModel = Backbone.Model.extend({
|
||||
'initialize': function() {
|
||||
this.fsCollection = fsCollection;
|
||||
this.listenTo(this, 'change:llFixed', this.onChange);
|
||||
this.timerID = 0;
|
||||
this.tick();
|
||||
|
||||
this.listenTo(this, 'change:llFixed change:section', this.onChange);
|
||||
},
|
||||
'tick': function() {
|
||||
const hour = parseInt((new Date()).getHours().toString(), 10);
|
||||
const section = (hour >= 11 && hour <= 14) ? 'food' : 'topPicks';
|
||||
|
||||
this.set('section', section);
|
||||
|
||||
this.timerID = setTimeout(
|
||||
() => this.tick(),
|
||||
toHour()
|
||||
);
|
||||
},
|
||||
'onChange': function() {
|
||||
this.getNearby();
|
||||
},
|
||||
'getNearby': function() {
|
||||
const llFixed = this.get('llFixed');
|
||||
|
||||
const hour = parseInt((new Date()).getHours().toString(), 10);
|
||||
const section = this.get('section');
|
||||
console.log('>> Nearby section:', hour, section);
|
||||
request({
|
||||
'url': 'https://jubilee.silvrtree.co.uk/fsexplore',
|
||||
'url': `${window.loc}/fsexplore`,
|
||||
'method': 'GET',
|
||||
'qs': {
|
||||
'll': llFixed,
|
||||
'section': 'topPicks'
|
||||
'section': section
|
||||
}
|
||||
}, function(err, res, body) {
|
||||
if (err)
|
||||
@ -90,7 +111,7 @@ const NearbyView = Backbone.View.extend({
|
||||
this.fsCollection.bind('reset', this.render, this);
|
||||
},
|
||||
'events': {
|
||||
'click': 'doClick'
|
||||
'click .itemRow': 'doClick'
|
||||
},
|
||||
'updateLocation': function(l) {
|
||||
console.log('>> Nearby Location has changed...');
|
||||
@ -119,9 +140,13 @@ const NearbyView = Backbone.View.extend({
|
||||
},
|
||||
'doClick': function(d) {
|
||||
console.log('Do click', d);
|
||||
const id = get(d, 'currentTarget.dataset.id', '');
|
||||
console.log(id);
|
||||
|
||||
const fsdetail = new FSDetailView({ 'fsID':id });
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
module.exports = { NearbyModel, NearbyView };
|
||||
55.949443, -4.570721
|
||||
// 55.949443, -4.570721;
|
||||
|
@ -38,6 +38,7 @@ const newsItemView = Backbone.View.extend({
|
||||
'render': function() {
|
||||
this.$el.html(this.template(this.model.toJSON()));
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
const NewsModel = Backbone.Model.extend({
|
||||
@ -57,7 +58,7 @@ const NewsModel = Backbone.Model.extend({
|
||||
'getNews': function() {
|
||||
// const ll = this.get('llShort');
|
||||
request({
|
||||
'url': 'https://jubilee.silvrtree.co.uk/news',
|
||||
'url': `${window.loc}/news`,
|
||||
'method': 'GET'
|
||||
}, function(err, res, body) {
|
||||
if (err)
|
||||
@ -112,9 +113,7 @@ const NewsView = Backbone.View.extend({
|
||||
'class': 'horizontal-scroll-wrapper squares'
|
||||
};
|
||||
},
|
||||
'events': {
|
||||
'click': 'doClick'
|
||||
},
|
||||
|
||||
'render': function() {
|
||||
console.log('News:Render');
|
||||
|
||||
@ -127,6 +126,8 @@ const NewsView = Backbone.View.extend({
|
||||
|
||||
this.$el.parent().show();
|
||||
// console.log(this.$el.parent());
|
||||
}, 'events': {
|
||||
'click': 'doClick'
|
||||
}, 'doClick': function(d) {
|
||||
console.log('Do click', d);
|
||||
}
|
||||
|
147
src/v1/js/RightByMe.js
Normal file
@ -0,0 +1,147 @@
|
||||
const $ = require('jquery');
|
||||
const _ = require('underscore');
|
||||
const Backbone = require('backbone');
|
||||
const request = require('request');
|
||||
const { get, isEmpty } = require('lodash');
|
||||
const { maybePluralize } = require('./utils');
|
||||
|
||||
const ByMeModel = Backbone.Model.extend({
|
||||
'initialize': function() {
|
||||
this.timerID = 0;
|
||||
// this.fsCollection = fsCollection;
|
||||
this.listenTo(this, 'change:llSix', this.onChange);
|
||||
},
|
||||
'onChange': function() {
|
||||
// this.getByMe(); trigger when not moved for 30 seconds
|
||||
if (this.get('atHomeOrWork') !== true)
|
||||
this.timerID = setTimeout(
|
||||
() => this.getByMe(),
|
||||
30000
|
||||
);
|
||||
else {
|
||||
clearInterval(this.timerID);
|
||||
console.log('>> ByMe: atHomeOrWork');
|
||||
}
|
||||
},
|
||||
'getByMe': function() {
|
||||
const llSix = this.get('llFixed');
|
||||
|
||||
// const section = (partOfDay >= 11 && partOfDay <= 14) ? 'food' : 'topPicks';
|
||||
request({
|
||||
'url': `${window.loc}/rightbyme`,
|
||||
'method': 'GET',
|
||||
'qs': {
|
||||
'll': llSix
|
||||
}
|
||||
}, function(err, res, body) {
|
||||
if (err)
|
||||
console.error(err);
|
||||
else {
|
||||
// console.log(body);
|
||||
|
||||
const fsJSON = JSON.parse(body);
|
||||
|
||||
console.log(fsJSON);
|
||||
|
||||
this.set(fsJSON);
|
||||
}
|
||||
}.bind(this));
|
||||
}
|
||||
});
|
||||
|
||||
const ByMeView = Backbone.View.extend({
|
||||
'id':'byme',
|
||||
'className': '',
|
||||
'template': _.template('<div></div>'),
|
||||
'yelpTemplate': _.template(`<div id="bymeYelp" class="itemRow">
|
||||
<div class="mui-col-md-4 mui-col-xs-4">
|
||||
<img src="gfx/stars_<%= yelp.rating * 10 %>.png">
|
||||
</div>
|
||||
<div class="mui-col-md-4 mui-col-xs-4 mui--text-center">
|
||||
<%= yelp.reviewCount %> review
|
||||
</div>
|
||||
<div class="mui-col-md-4 mui-col-xs-4 mui--text-right">
|
||||
<img src="gfx/yssdk_yelp_logo.png">
|
||||
</div>
|
||||
</div>
|
||||
`),
|
||||
'tipsTemplate': _.template(`
|
||||
<div id='bymeTips'>
|
||||
<div class="mui--text-subhead">Tips</div>
|
||||
<div class='scrolling-wrapper-flexbox' style="height: 100px;">
|
||||
<%_.forEach(tips, function(i) {%>
|
||||
<div class="scrollCardHalf">
|
||||
<%=i %>
|
||||
</div>
|
||||
<%}) %>
|
||||
</div>
|
||||
</div>
|
||||
`),
|
||||
'imagesTemplate': _.template(`
|
||||
<div id='bymeImages'>
|
||||
<div class='scrolling-wrapper-flexbox' style="height: 100%;">
|
||||
<%_.forEach(images, function(i) {%>
|
||||
<div class="imageCard">
|
||||
<img src="<%=i %>" class="scrollImg">
|
||||
</div>
|
||||
<%}) %>
|
||||
</div>
|
||||
</div>
|
||||
`),
|
||||
'initialize': function(options) {
|
||||
this.eventBus = options.eventBus;
|
||||
this.location = options.location;
|
||||
|
||||
// this.model.bind('change', this.render, this);
|
||||
this.location.bind('change', this.updateLocation, this);
|
||||
this.location.bind('change:atHomeOrWork', this.atHomeOrWork, this);
|
||||
this.model.bind('change:id', this.render, this);
|
||||
},
|
||||
'events': {
|
||||
'click .itemRow': 'doClick'
|
||||
},
|
||||
'atHomeOrWork': function(m) {
|
||||
console.log('>> atHomeOrWork', m);
|
||||
},
|
||||
'updateLocation': function(l) {
|
||||
console.log('>> ByMe Location has changed...');
|
||||
|
||||
if (l.has('location')) {
|
||||
const location = l.get('location');
|
||||
if (location.hasOwnProperty('atHomeOrWork')) {
|
||||
this.model.set(location);
|
||||
|
||||
if (location.atHomeOrWork)
|
||||
// We're at home so hide
|
||||
this.$el.parent().hide();
|
||||
}
|
||||
}
|
||||
else
|
||||
console.log('>> ByMe No location yet');
|
||||
},
|
||||
'render': function() {
|
||||
console.log('>> ByMe render');
|
||||
// console.log(this.model);
|
||||
|
||||
const contents = [];
|
||||
const m = this.model.toJSON();
|
||||
// this.imagesTemplate(this.model.toJSON()), this.yelpTemplate(this.model.toJSON()), this.tipsTemplate(this.model.toJSON())
|
||||
|
||||
if (!isEmpty(m.images))
|
||||
contents.push(this.imagesTemplate(this.model.toJSON()));
|
||||
|
||||
if (!isEmpty(m.yelp))
|
||||
contents.push(this.yelpTemplate(this.model.toJSON()));
|
||||
|
||||
if (!isEmpty(m.tips))
|
||||
contents.push(this.tipsTemplate(this.model.toJSON()));
|
||||
|
||||
this.$el.html(contents.join(''));
|
||||
// console.log(this.el);
|
||||
this.$el.parent().children('#byMeTitle').html(m.name);
|
||||
this.$el.parent().show();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
module.exports = { ByMeModel, ByMeView };
|
@ -94,7 +94,7 @@ const WeatherModel = Backbone.Model.extend({
|
||||
// const ll = this.get('llShort');
|
||||
const llFixed = this.get('llFixed');
|
||||
request({
|
||||
'url': 'https://jubilee.silvrtree.co.uk/weather',
|
||||
'url': `${window.loc}/weather`,
|
||||
'method': 'GET',
|
||||
'qs': {
|
||||
'll': llFixed
|
||||
|
@ -8,9 +8,14 @@ const { GreetModel, GreetView } = require('./Greet');
|
||||
const { NearbyModel, NearbyView } = require('./Nearby');
|
||||
const { WeatherModel, WeatherView } = require('./Weather');
|
||||
const { NewsModel, NewsView } = require('./News');
|
||||
const { ByMeModel, ByMeView } = require('./RightByMe');
|
||||
|
||||
var app = app || {};
|
||||
|
||||
window.loc = 'https://jubilee.silvrtree.co.uk';
|
||||
//window.loc = 'http://localhost:8110';
|
||||
|
||||
|
||||
(function () {
|
||||
if ('serviceWorker' in navigator)
|
||||
navigator.serviceWorker
|
||||
@ -20,6 +25,7 @@ var app = app || {};
|
||||
});
|
||||
|
||||
const offline = false;
|
||||
|
||||
app.eventBus = _.extend({}, Backbone.Events);
|
||||
|
||||
app.locationModel = new LocationModel();
|
||||
@ -33,4 +39,6 @@ var app = app || {};
|
||||
app.weather = new WeatherView({ 'model': new WeatherModel(), 'eventBus': app.eventBus, 'location': app.locationModel, 'el':'#weather' });
|
||||
|
||||
app.news = new NewsView({ 'model': new NewsModel(), 'eventBus': app.eventBus, 'el':'#news' });
|
||||
|
||||
app.byMe = new ByMeView({ 'model': new ByMeModel(), 'eventBus': app.eventBus, 'location': app.locationModel, 'el':'#byme' });
|
||||
})();
|
||||
|
@ -58,5 +58,8 @@ function distance(lat1, lon1, lat2, lon2) {
|
||||
return 12742 * Math.asin(Math.sqrt(a)); // 2 * R; R = 6371 km
|
||||
}
|
||||
|
||||
module.exports = { partOfDay, toHour, distance };
|
||||
const maybePluralize = (count, noun, suffix = 's') =>
|
||||
`${count} ${noun}${count !== 1 ? suffix : ''}`;
|
||||
|
||||
module.exports = { partOfDay, toHour, distance, maybePluralize };
|
||||
|
||||
|
556
test/rightbyme.spec.js
Normal file
@ -0,0 +1,556 @@
|
||||
|
||||
const { reduceExplore, reduceYelp, reduceFullFS } = require('../server/reducers/rightbyme');
|
||||
|
||||
const expect = require('expect.js');
|
||||
|
||||
const exploreFS = {
|
||||
'id': '4c233b549a67a5937ea7dd87',
|
||||
'name': 'Cruachan Power Station',
|
||||
'contact': {
|
||||
'phone': '+441866822618',
|
||||
'formattedPhone': '+44 1866 822618'
|
||||
},
|
||||
'location': {
|
||||
'address': 'A85',
|
||||
'lat': 56.39449115920086,
|
||||
'lng': -5.1161516920810755,
|
||||
'labeledLatLngs': [
|
||||
{
|
||||
'label': 'display',
|
||||
'lat': 56.39449115920086,
|
||||
'lng': -5.1161516920810755
|
||||
}
|
||||
],
|
||||
'distance': 30,
|
||||
'postalCode': 'PA33 1AN',
|
||||
'cc': 'GB',
|
||||
'city': 'Dalmally',
|
||||
'country': 'United Kingdom',
|
||||
'formattedAddress': [
|
||||
'A85',
|
||||
'Dalmally',
|
||||
'PA33 1AN',
|
||||
'United Kingdom'
|
||||
]
|
||||
},
|
||||
'categories': [
|
||||
{
|
||||
'id': '4bf58dd8d48988d130941735',
|
||||
'name': 'Building',
|
||||
'pluralName': 'Buildings',
|
||||
'shortName': 'Building',
|
||||
'icon': {
|
||||
'prefix': 'https://ss3.4sqi.net/img/categories_v2/building/default_',
|
||||
'suffix': '.png'
|
||||
},
|
||||
'primary': true
|
||||
}
|
||||
],
|
||||
'verified': false,
|
||||
'stats': {
|
||||
'tipCount': 2,
|
||||
'usersCount': 98,
|
||||
'checkinsCount': 100
|
||||
},
|
||||
'url': 'http://www.visitcruachan.co.uk',
|
||||
'venueRatingBlacklisted': true,
|
||||
'beenHere': {
|
||||
'count': 0,
|
||||
'marked': false,
|
||||
'lastCheckinExpiredAt': 0
|
||||
},
|
||||
'photos': {
|
||||
'count': 0,
|
||||
'groups': []
|
||||
},
|
||||
'hereNow': {
|
||||
'count': 0,
|
||||
'summary': 'Nobody here',
|
||||
'groups': []
|
||||
}
|
||||
};
|
||||
|
||||
const YelpData = {
|
||||
'id': 'cruachan-power-station-visitor-centre-dalmally',
|
||||
'name': 'Cruachan Power Station Visitor Centre',
|
||||
'image_url': 'https://s3-media2.fl.yelpcdn.com/bphoto/eRvbe7h4JBGQB5g1P0iWFg/o.jpg',
|
||||
'is_closed': false,
|
||||
'url': 'https://www.yelp.com/biz/cruachan-power-station-visitor-centre-dalmally?adjust_creative=s8FdwjzKWCpdbkUzShvAgg&utm_campaign=yelp_api_v3&utm_medium=api_v3_business_search&utm_source=s8FdwjzKWCpdbkUzShvAgg',
|
||||
'review_count': 2,
|
||||
'categories': [
|
||||
{
|
||||
'alias': 'visitorcenters',
|
||||
'title': 'Visitor Centers'
|
||||
}
|
||||
],
|
||||
'rating': 4.5,
|
||||
'coordinates': {
|
||||
'latitude': 56.394515,
|
||||
'longitude': -5.116196
|
||||
},
|
||||
'transactions': [],
|
||||
'location': {
|
||||
'address1': 'Cruachan Power Station',
|
||||
'address2': null,
|
||||
'address3': null,
|
||||
'city': 'Dalmally',
|
||||
'zip_code': 'PA33 1AN',
|
||||
'country': 'GB',
|
||||
'state': 'AGB',
|
||||
'display_address': [
|
||||
'Cruachan Power Station',
|
||||
'Dalmally PA33 1AN',
|
||||
'United Kingdom'
|
||||
]
|
||||
},
|
||||
'phone': '+441866822618',
|
||||
'display_phone': '+44 1866 822618',
|
||||
'distance': 2.360238088184
|
||||
};
|
||||
|
||||
const fullFS = {
|
||||
'id': '4c233b549a67a5937ea7dd87',
|
||||
'name': 'Cruachan Power Station',
|
||||
'contact': {
|
||||
'phone': '+441866822618',
|
||||
'formattedPhone': '+44 1866 822618'
|
||||
},
|
||||
'location': {
|
||||
'address': 'A85',
|
||||
'lat': 56.39449115920086,
|
||||
'lng': -5.1161516920810755,
|
||||
'labeledLatLngs': [
|
||||
{
|
||||
'label': 'display',
|
||||
'lat': 56.39449115920086,
|
||||
'lng': -5.1161516920810755
|
||||
}
|
||||
],
|
||||
'postalCode': 'PA33 1AN',
|
||||
'cc': 'GB',
|
||||
'city': 'Dalmally',
|
||||
'country': 'United Kingdom',
|
||||
'formattedAddress': [
|
||||
'A85',
|
||||
'Dalmally',
|
||||
'PA33 1AN',
|
||||
'United Kingdom'
|
||||
]
|
||||
},
|
||||
'canonicalUrl': 'https://foursquare.com/v/cruachan-power-station/4c233b549a67a5937ea7dd87',
|
||||
'categories': [
|
||||
{
|
||||
'id': '4bf58dd8d48988d130941735',
|
||||
'name': 'Building',
|
||||
'pluralName': 'Buildings',
|
||||
'shortName': 'Building',
|
||||
'icon': {
|
||||
'prefix': 'https://ss3.4sqi.net/img/categories_v2/building/default_',
|
||||
'suffix': '.png'
|
||||
},
|
||||
'primary': true
|
||||
},
|
||||
{
|
||||
'id': '4bf58dd8d48988d165941735',
|
||||
'name': 'Scenic Lookout',
|
||||
'pluralName': 'Scenic Lookouts',
|
||||
'shortName': 'Scenic Lookout',
|
||||
'icon': {
|
||||
'prefix': 'https://ss3.4sqi.net/img/categories_v2/parks_outdoors/sceniclookout_',
|
||||
'suffix': '.png'
|
||||
}
|
||||
}
|
||||
],
|
||||
'verified': false,
|
||||
'stats': {
|
||||
'tipCount': 2,
|
||||
'usersCount': 146,
|
||||
'checkinsCount': 100,
|
||||
'visitsCount': 150
|
||||
},
|
||||
'url': 'http://www.visitcruachan.co.uk',
|
||||
'likes': {
|
||||
'count': 3,
|
||||
'groups': [
|
||||
{
|
||||
'type': 'others',
|
||||
'count': 3,
|
||||
'items': [
|
||||
{
|
||||
'id': '148882502',
|
||||
'firstName': 'James',
|
||||
'lastName': 'Braid',
|
||||
'gender': 'none',
|
||||
'photo': {
|
||||
'prefix': 'https://igx.4sqi.net/img/user/',
|
||||
'suffix': '/blank_boy.png',
|
||||
'default': true
|
||||
}
|
||||
},
|
||||
{
|
||||
'id': '21137780',
|
||||
'firstName': 'Simon',
|
||||
'lastName': 'Gregory',
|
||||
'gender': 'male',
|
||||
'photo': {
|
||||
'prefix': 'https://igx.4sqi.net/img/user/',
|
||||
'suffix': '/NZ5Z5VJMRRNPKIPL.jpg'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
'summary': '3 Likes'
|
||||
},
|
||||
'dislike': false,
|
||||
'ok': false,
|
||||
'venueRatingBlacklisted': true,
|
||||
'beenHere': {
|
||||
'count': 0,
|
||||
'unconfirmedCount': 0,
|
||||
'marked': false,
|
||||
'lastCheckinExpiredAt': 0
|
||||
},
|
||||
'specials': {
|
||||
'count': 0,
|
||||
'items': []
|
||||
},
|
||||
'photos': {
|
||||
'count': 5,
|
||||
'groups': [
|
||||
{
|
||||
'type': 'venue',
|
||||
'name': 'Venue photos',
|
||||
'count': 5,
|
||||
'items': [
|
||||
{
|
||||
'id': '51878588498e053c231b5333',
|
||||
'createdAt': 1367836040,
|
||||
'source': {
|
||||
'name': 'Instagram',
|
||||
'url': 'http://instagram.com'
|
||||
},
|
||||
'prefix': 'https://igx.4sqi.net/img/general/',
|
||||
'suffix': '/16198007__KficeTL_D2tiqT7Zgu3wJyiL0485yVS_uNYAtCHOxw.jpg',
|
||||
'width': 612,
|
||||
'height': 612,
|
||||
'user': {
|
||||
'id': '16198007',
|
||||
'firstName': 'houdi',
|
||||
'gender': 'male',
|
||||
'photo': {
|
||||
'prefix': 'https://igx.4sqi.net/img/user/',
|
||||
'suffix': '/C1OQYP3FHOP2YJYM.jpg'
|
||||
}
|
||||
},
|
||||
'visibility': 'public'
|
||||
},
|
||||
{
|
||||
'id': '5187853e498ee4fb7757a79e',
|
||||
'createdAt': 1367835966,
|
||||
'source': {
|
||||
'name': 'Instagram',
|
||||
'url': 'http://instagram.com'
|
||||
},
|
||||
'prefix': 'https://igx.4sqi.net/img/general/',
|
||||
'suffix': '/16198007_gXoDHf06UwW-n-hUe8ul5udJut2DDZ7GocGN0Akn6IA.jpg',
|
||||
'width': 612,
|
||||
'height': 612,
|
||||
'user': {
|
||||
'id': '16198007',
|
||||
'firstName': 'houdi',
|
||||
'gender': 'male',
|
||||
'photo': {
|
||||
'prefix': 'https://igx.4sqi.net/img/user/',
|
||||
'suffix': '/C1OQYP3FHOP2YJYM.jpg'
|
||||
}
|
||||
},
|
||||
'visibility': 'public'
|
||||
},
|
||||
{
|
||||
'id': '4fd9da1ee4b0ea76a6c80417',
|
||||
'createdAt': 1339677214,
|
||||
'source': {
|
||||
'name': 'Foursquare for Android',
|
||||
'url': 'https://foursquare.com/download/#/android'
|
||||
},
|
||||
'prefix': 'https://igx.4sqi.net/img/general/',
|
||||
'suffix': '/cWA5MDOAyYCEqszteU7y4Fgq3W9ngKrNaXNIF3VraEc.jpg',
|
||||
'width': 640,
|
||||
'height': 480,
|
||||
'user': {
|
||||
'id': '2597712',
|
||||
'firstName': 'Nia',
|
||||
'lastName': 'Wearn',
|
||||
'gender': 'female',
|
||||
'photo': {
|
||||
'prefix': 'https://igx.4sqi.net/img/user/',
|
||||
'suffix': '/QWON2DY3SGFP0JIN.jpg'
|
||||
}
|
||||
},
|
||||
'visibility': 'public'
|
||||
},
|
||||
{
|
||||
'id': '50ceeb05e4b01c69f47dd479',
|
||||
'createdAt': 1355737861,
|
||||
'source': {
|
||||
'name': 'Foursquare for iOS',
|
||||
'url': 'https://foursquare.com/download/#/iphone'
|
||||
},
|
||||
'prefix': 'https://igx.4sqi.net/img/general/',
|
||||
'suffix': '/4442790_8SNrTl-wGnc9c6Ds7bHdcZeqbT9T-ScMw36KErzLDhU.jpg',
|
||||
'width': 537,
|
||||
'height': 720,
|
||||
'user': {
|
||||
'id': '4442790',
|
||||
'firstName': 'Rachel',
|
||||
'lastName': 'Brown',
|
||||
'gender': 'female',
|
||||
'photo': {
|
||||
'prefix': 'https://igx.4sqi.net/img/user/',
|
||||
'suffix': '/40RRMDM10221RS0R.jpg'
|
||||
}
|
||||
},
|
||||
'visibility': 'public'
|
||||
},
|
||||
{
|
||||
'id': '5374b0f9498e9e41f159e8fe',
|
||||
'createdAt': 1400156409,
|
||||
'source': {
|
||||
'name': 'Foursquare for iOS',
|
||||
'url': 'https://foursquare.com/download/#/iphone'
|
||||
},
|
||||
'prefix': 'https://igx.4sqi.net/img/general/',
|
||||
'suffix': '/4353161_Rr_HCB-pEhemJxkBAmH5wWN68rju4MhbtEahLFa8trk.jpg',
|
||||
'width': 720,
|
||||
'height': 960,
|
||||
'user': {
|
||||
'id': '4353161',
|
||||
'firstName': 'sunita',
|
||||
'lastName': 'panich',
|
||||
'gender': 'none',
|
||||
'photo': {
|
||||
'prefix': 'https://igx.4sqi.net/img/user/',
|
||||
'suffix': '/I3HAQMV2YTOMNU50.jpg'
|
||||
}
|
||||
},
|
||||
'visibility': 'public'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
'reasons': {
|
||||
'count': 0,
|
||||
'items': []
|
||||
},
|
||||
'hereNow': {
|
||||
'count': 0,
|
||||
'summary': 'Nobody here',
|
||||
'groups': []
|
||||
},
|
||||
'createdAt': 1277377364,
|
||||
'tips': {
|
||||
'count': 2,
|
||||
'groups': [
|
||||
{
|
||||
'type': 'others',
|
||||
'name': 'All tips',
|
||||
'count': 2,
|
||||
'items': [
|
||||
{
|
||||
'id': '4d93304df7e8dcb3e594cb12',
|
||||
'createdAt': 1301491789,
|
||||
'text': 'Bring your O2 or Vodafone phone so you can actually get a signal to check in!',
|
||||
'type': 'user',
|
||||
'canonicalUrl': 'https://foursquare.com/item/4d93304df7e8dcb3e594cb12',
|
||||
'likes': {
|
||||
'count': 0,
|
||||
'groups': []
|
||||
},
|
||||
'logView': true,
|
||||
'agreeCount': 0,
|
||||
'disagreeCount': 0,
|
||||
'todo': {
|
||||
'count': 0
|
||||
},
|
||||
'user': {
|
||||
'id': '530470',
|
||||
'firstName': 'Rob',
|
||||
'lastName': 'Fisher',
|
||||
'gender': 'male',
|
||||
'photo': {
|
||||
'prefix': 'https://igx.4sqi.net/img/user/',
|
||||
'suffix': '/XAZKL04TO3CU0BCG.jpg'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
'id': '4d650ad689238cfa81459436',
|
||||
'createdAt': 1298467542,
|
||||
'text': 'a good exscuse for a check in!',
|
||||
'type': 'user',
|
||||
'canonicalUrl': 'https://foursquare.com/item/4d650ad689238cfa81459436',
|
||||
'likes': {
|
||||
'count': 0,
|
||||
'groups': []
|
||||
},
|
||||
'logView': true,
|
||||
'agreeCount': 0,
|
||||
'disagreeCount': 0,
|
||||
'todo': {
|
||||
'count': 0
|
||||
},
|
||||
'user': {
|
||||
'id': '4808723',
|
||||
'firstName': 'Anna',
|
||||
'lastName': 'Hastings',
|
||||
'gender': 'female',
|
||||
'photo': {
|
||||
'prefix': 'https://igx.4sqi.net/img/user/',
|
||||
'suffix': '/LM5A3CIS2TT1UHXX.jpg'
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
'shortUrl': 'http://4sq.com/b9RihM',
|
||||
'timeZone': 'Europe/London',
|
||||
'listed': {
|
||||
'count': 1,
|
||||
'groups': [
|
||||
{
|
||||
'type': 'others',
|
||||
'name': 'Lists from other people',
|
||||
'count': 1,
|
||||
'items': [
|
||||
{
|
||||
'id': '51ffd2de498e3955660fd8b7',
|
||||
'name': 'Holiday',
|
||||
'description': '',
|
||||
'type': 'others',
|
||||
'user': {
|
||||
'id': '48298321',
|
||||
'firstName': 'Hans',
|
||||
'lastName': 'Peeters',
|
||||
'gender': 'male',
|
||||
'photo': {
|
||||
'prefix': 'https://igx.4sqi.net/img/user/',
|
||||
'suffix': '/OTQ3XLHGRYPQIQGR.jpg'
|
||||
}
|
||||
},
|
||||
'editable': false,
|
||||
'public': true,
|
||||
'collaborative': false,
|
||||
'url': '/mstrhans/list/holiday',
|
||||
'canonicalUrl': 'https://foursquare.com/mstrhans/list/holiday',
|
||||
'createdAt': 1375720158,
|
||||
'updatedAt': 1377538112,
|
||||
'followers': {
|
||||
'count': 1
|
||||
},
|
||||
'listItems': {
|
||||
'count': 43,
|
||||
'items': [
|
||||
{
|
||||
'id': 'v4c233b549a67a5937ea7dd87',
|
||||
'createdAt': 1376225268
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
'pageUpdates': {
|
||||
'count': 0,
|
||||
'items': []
|
||||
},
|
||||
'inbox': {
|
||||
'count': 0,
|
||||
'items': []
|
||||
},
|
||||
'venueChains': [],
|
||||
'attributes': {
|
||||
'groups': []
|
||||
},
|
||||
'bestPhoto': {
|
||||
'id': '51878588498e053c231b5333',
|
||||
'createdAt': 1367836040,
|
||||
'source': {
|
||||
'name': 'Instagram',
|
||||
'url': 'http://instagram.com'
|
||||
},
|
||||
'prefix': 'https://igx.4sqi.net/img/general/',
|
||||
'suffix': '/16198007__KficeTL_D2tiqT7Zgu3wJyiL0485yVS_uNYAtCHOxw.jpg',
|
||||
'width': 612,
|
||||
'height': 612,
|
||||
'visibility': 'public'
|
||||
}
|
||||
};
|
||||
|
||||
describe('Explore', () => {
|
||||
it('should gracefully handle no data', done => {
|
||||
expect(reduceExplore()).to.eql({});
|
||||
done();
|
||||
});
|
||||
|
||||
it('should process data correctly', done => {
|
||||
expect(reduceExplore(exploreFS)).to.eql({ 'name':'Cruachan Power Station', 'category':'Building', 'icon':'https://ss3.4sqi.net/img/categories_v2/building/default_64.png', 'id':'4c233b549a67a5937ea7dd87', 'provider':'foursquare', 'address':'A85, Dalmally, PA33 1AN, United Kingdom', 'city':'Dalmally', 'state':'', 'postcode':'PA33 1AN', 'twitter':'', 'facebook':'', 'url':'http://www.visitcruachan.co.uk' });
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
describe('Yelp', () => {
|
||||
it('should gracefully handle no data', done => {
|
||||
expect(reduceYelp()).to.eql({});
|
||||
done();
|
||||
});
|
||||
|
||||
it('should process data correctly', done => {
|
||||
expect(reduceYelp(YelpData)).to.eql({ 'url':'https://www.yelp.com/biz/cruachan-power-station-visitor-centre-dalmally?adjust_creative=s8FdwjzKWCpdbkUzShvAgg&utm_campaign=yelp_api_v3&utm_medium=api_v3_business_search&utm_source=s8FdwjzKWCpdbkUzShvAgg', 'rating':4.5, 'reviewCount':2, 'viewIntent':'https://m.yelp.com/biz/cruachan-power-station-visitor-centre-dalmally?adjust_creative=s8FdwjzKWCpdbkUzShvAgg&utm_campaign=yelp_api_v3&utm_medium=api_v3_business_search&utm_source=s8FdwjzKWCpdbkUzShvAgg' });
|
||||
done();
|
||||
});
|
||||
|
||||
it('should handle Missing Url', done => {
|
||||
const brokenYelp = Object.assign({}, YelpData);
|
||||
|
||||
delete brokenYelp.url;
|
||||
|
||||
expect(reduceYelp(brokenYelp)).to.eql({ 'url':'', 'rating':4.5, 'reviewCount':2, 'viewIntent':'' });
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
describe('Full FS', () => {
|
||||
it('should gracefully handle no data', done => {
|
||||
expect(reduceFullFS()).to.eql({});
|
||||
done();
|
||||
});
|
||||
|
||||
it('should process data correctly', done => {
|
||||
expect(reduceFullFS(fullFS)).to.eql({ 'images':['https://igx.4sqi.net/img/general//16198007__KficeTL_D2tiqT7Zgu3wJyiL0485yVS_uNYAtCHOxw.jpg', 'https://igx.4sqi.net/img/general//16198007_gXoDHf06UwW-n-hUe8ul5udJut2DDZ7GocGN0Akn6IA.jpg', 'https://igx.4sqi.net/img/general//cWA5MDOAyYCEqszteU7y4Fgq3W9ngKrNaXNIF3VraEc.jpg', 'https://igx.4sqi.net/img/general//4442790_8SNrTl-wGnc9c6Ds7bHdcZeqbT9T-ScMw36KErzLDhU.jpg', 'https://igx.4sqi.net/img/general//4353161_Rr_HCB-pEhemJxkBAmH5wWN68rju4MhbtEahLFa8trk.jpg'], 'tips':['Bring your O2 or Vodafone phone so you can actually get a signal to check in!', 'a good exscuse for a check in!'] });
|
||||
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
describe('Merging', () => {
|
||||
it('should gracefully handle no data', done => {
|
||||
const m = Object.assign(reduceExplore(), reduceFullFS());
|
||||
|
||||
expect(m).to.eql({});
|
||||
done();
|
||||
});
|
||||
|
||||
it('should Merge Cruachan correctly', done => {
|
||||
const m = Object.assign(reduceExplore(exploreFS), reduceFullFS(fullFS));
|
||||
const yelp = reduceYelp(YelpData);
|
||||
m.yelp = yelp;
|
||||
expect(m).to.eql({ 'name':'Cruachan Power Station', 'category':'Building', 'icon':'https://ss3.4sqi.net/img/categories_v2/building/default_64.png', 'id':'4c233b549a67a5937ea7dd87', 'provider':'foursquare', 'address':'A85, Dalmally, PA33 1AN, United Kingdom', 'city':'Dalmally', 'state':'', 'postcode':'PA33 1AN', 'twitter':'', 'facebook':'', 'url':'http://www.visitcruachan.co.uk', 'images':['https://igx.4sqi.net/img/general//16198007__KficeTL_D2tiqT7Zgu3wJyiL0485yVS_uNYAtCHOxw.jpg', 'https://igx.4sqi.net/img/general//16198007_gXoDHf06UwW-n-hUe8ul5udJut2DDZ7GocGN0Akn6IA.jpg', 'https://igx.4sqi.net/img/general//cWA5MDOAyYCEqszteU7y4Fgq3W9ngKrNaXNIF3VraEc.jpg', 'https://igx.4sqi.net/img/general//4442790_8SNrTl-wGnc9c6Ds7bHdcZeqbT9T-ScMw36KErzLDhU.jpg', 'https://igx.4sqi.net/img/general//4353161_Rr_HCB-pEhemJxkBAmH5wWN68rju4MhbtEahLFa8trk.jpg'], 'tips':['Bring your O2 or Vodafone phone so you can actually get a signal to check in!', 'a good exscuse for a check in!'], 'yelp':{ 'url':'https://www.yelp.com/biz/cruachan-power-station-visitor-centre-dalmally?adjust_creative=s8FdwjzKWCpdbkUzShvAgg&utm_campaign=yelp_api_v3&utm_medium=api_v3_business_search&utm_source=s8FdwjzKWCpdbkUzShvAgg', 'rating':4.5, 'reviewCount':2, 'viewIntent':'https://m.yelp.com/biz/cruachan-power-station-visitor-centre-dalmally?adjust_creative=s8FdwjzKWCpdbkUzShvAgg&utm_campaign=yelp_api_v3&utm_medium=api_v3_business_search&utm_source=s8FdwjzKWCpdbkUzShvAgg' } });
|
||||
done();
|
||||
});
|
||||
});
|