Skip to content

Instantly share code, notes, and snippets.

@lbrenman
Created May 7, 2015 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lbrenman/25287e1f2db932d85b3f to your computer and use it in GitHub Desktop.
Save lbrenman/25287e1f2db932d85b3f to your computer and use it in GitHub Desktop.
Appcelerator Arrow Double Post Block to add GPS coordinates and Local Coffee Shops (via Foursquare) to the Salesforce Account
var Arrow = require("arrow");
var Model = Arrow.Model.reduce("appc.salesforce/Account","Account",{
"fields": {
"Name": {
"type": "string",
"description": "Account Name",
"readonly": false,
"maxlength": 255,
"required": true,
"optional": false,
"writeonly": false
},
"Type": {
"type": "string",
"description": "Account Type",
"readonly": false,
"maxlength": 40,
"required": false,
"optional": true,
"writeonly": false
},
"BillingStreet": {
"type": "string",
"description": "Billing Street",
"readonly": false,
"maxlength": 255,
"required": false,
"optional": true,
"writeonly": false
},
"Phone": {
"type": "string",
"description": "Account Phone",
"readonly": false,
"maxlength": 40,
"required": false,
"optional": true,
"writeonly": false
},
"Website": {
"type": "string",
"description": "Website",
"readonly": false,
"maxlength": 255,
"required": false,
"optional": true,
"writeonly": false
},
"lat": {
"type": "String",
"custom": true
},
"lon": {
"type": "String",
"custom": true
},
"coffeeshops": {
"type": "Array",
"custom": true
}
},
"after": ["addgps","addcoffeeshops"],
"actions": [
"create",
"read",
"update",
"delete",
"deleteAll"
],
"singular": "Account",
"plural": "Accounts"
});
module.exports = Model;
var Arrow = require('arrow');
var request = require('request');
var FSclient_id = "<Your Foursquare App Client ID>";
var FSclient_secret = "<Your Foursquare App Client Secret>";
var baseURL = "https://api.foursquare.com/v2/venues/search?client_id="+FSclient_id+"&client_secret="+FSclient_secret+"&v=20141024&query=coffee&limit=3&ll=";
var PostBlock = Arrow.Block.extend({
name: 'addcoffeeshops',
description: 'add coffee shops to the retreived data',
action: function(req, resp, next) {
// req.log.info("Post Example Block executed");
var body = JSON.parse(resp.body);
var data = body[body.key];
var dataLen = data.length;
var replies = 0;
// console.log("data = "+JSON.stringify(data));
// console.log("dataLen = "+dataLen);
if(dataLen){
data.forEach(function (_row, _index) {
// console.log("lat = "+_row.lat);
// console.log("lon = "+_row.lon);
var url = baseURL+_row.lat+","+_row.lon;
request(url, function (error, response, body) {
if (!error && response.statusCode == 200) {
var res = JSON.parse(body);
if(res.response.venues.length>0) {
// _row.coffeeshops = response.response.venues; //assign all venue data
var shops=[];
for(var i=0;i<res.response.venues.length; i++) {
// console.log("venue["+i+"] = "+JSON.stringify(response.response.venues[i]));
var shop = {};
shop.id=res.response.venues[i].id;
shop.name=res.response.venues[i].name;
shop.location=res.response.venues[i].location;
shops.push(shop);
}
_row.coffeeshops = shops;
}
replies++;
if(replies == dataLen) {
setReply();
}
} else {
console.log("foursquare request error");
if(replies == dataLen) {
setReply();
}
}
});
});
} else {
var url = baseURL+data.lat+","+data.lon;
request(url, function (error, response, body) {
if (!error && response.statusCode == 200) {
var res = JSON.parse(body);
if(res.response.venues.length>0) {
// _row.coffeeshops = response.response.venues; //assign all venue data
var shops=[];
for(var i=0;i<res.response.venues.length; i++) {
// console.log("venue["+i+"] = "+JSON.stringify(response.response.venues[i]));
var shop = {};
shop.id=res.response.venues[i].id;
shop.name=res.response.venues[i].name;
shop.location=res.response.venues[i].location;
shops.push(shop);
}
data.coffeeshops = shops;
}
setReply();
} else {
console.log("foursquare request error");
setReply();
}
});
}
function setReply() {
console.log("post block addcoffeeshops executed");
resp.success(body[body.key], next);
}
}
});
module.exports = PostBlock;
var Arrow = require('arrow');
var request = require('request');
var googleMapAPIKey = "<Your Google Maps API Key>";
var baseURL = "https://maps.googleapis.com/maps/api/geocode/json?address=";
var PostBlock = Arrow.Block.extend({
name: 'addgps',
description: 'add lat, long to the retreived data',
action: function(req, resp, next) {
// req.log.info("Post Example Block executed");
var body = JSON.parse(resp.body);
var data = body[body.key];
var dataLen = data.length;
var replies = 0;
// console.log("data = "+JSON.stringify(data));
// console.log("dataLen = "+dataLen);
if(dataLen){ //findAll
data.forEach(function (_row, _index) {
var url=baseURL+encodeURIComponent(prepareAddress(_row.BillingStreet))+"&key="+googleMapAPIKey;
request(url, function (error, response, body) {
if (!error && response.statusCode == 200) {
var res = JSON.parse(body);
_row.lat = res.results[0].geometry.location.lat;
_row.lon = res.results[0].geometry.location.lng;
replies++;
if(replies == dataLen) {
setReply();
}
} else {
console.log("google maps geocode request error");
replies++;
if(replies == dataLen) {
setReply();
}
}
});
});
} else { //findOne
var url=baseURL+encodeURIComponent(prepareAddress(data.BillingStreet))+"&key="+googleMapAPIKey;
request(url, function (error, response, body) {
if (!error && response.statusCode == 200) {
var res = JSON.parse(body);
data.lat = res.results[0].geometry.location.lat;
data.lon = res.results[0].geometry.location.lng;
setReply();
} else {
console.log("google maps geocode request error");
setReply();
}
});
// console.log("data = "+JSON.stringify(data));
}
function prepareAddress(str) {
return str.replace(/(\r\n|\n|\r)/gm,",");
}
function setReply() {
console.log("post block addgps executed");
resp.success(body[body.key], next);
}
}
});
module.exports = PostBlock;
{
"success": true,
"request-id": "ad3b22cd-aecf-4a72-bb80-248391f9c420",
"key": "accounts",
"accounts": [
{
"id": "001i000000PscewAAB",
"Name": "GenePoint",
"Type": "Customer - Channel",
"BillingStreet": "345 Shoreline Park\nMountain View, CA 94043\nUSA",
"Phone": "(650) 867-3450",
"Website": "www.genepoint.com",
"lat": 37.423958,
"lon": -122.0721391,
"coffeeshops": [
{
"id": "531f4262498e7dfd38788daf",
"name": "Root Coffee Bar",
"location": {
"address": "1200 Charleston Rd",
"lat": 37.42125,
"lng": -122.071451,
"distance": 307,
"postalCode": "94043",
"cc": "US",
"city": "Mountain View",
"state": "CA",
"country": "United States",
"formattedAddress": [
"1200 Charleston Rd",
"Mountain View, CA 94043",
"United States"
]
}
},
{
"id": "5281225911d2fbe8d10f9463",
"name": "Barefoot Coffee Roasters van",
"location": {
"lat": 37.419684936426464,
"lng": -122.07105266770425,
"distance": 485,
"cc": "US",
"city": "San Jose",
"state": "CA",
"country": "United States",
"formattedAddress": [
"San Jose, CA",
"United States"
]
}
},
{
"id": "50660dc7e4b0b68b5dbe8858",
"name": "Googleplex - Sight Glass Coffee",
"location": {
"address": "Google",
"lat": 37.420315759073134,
"lng": -122.07286151728987,
"distance": 410,
"postalCode": "94043",
"cc": "US",
"city": "Mountain View",
"state": "CA",
"country": "United States",
"formattedAddress": [
"Google",
"Mountain View, CA 94043",
"United States"
]
}
}
]
},
{
"id": "001i000000PscexAAB",
"Name": "United Oil & Gas, UK",
"Type": "Customer - Direct",
"BillingStreet": "Kings Park, 17th Avenue, Team Valley Trading Estate,\nGateshead, Tyne and Wear NE26 3HS\nUnited Kingdom",
"Phone": "+44 191 4956203",
"Website": "http://www.uos.com",
"lat": 55.05473019999999,
"lon": -1.4665574,
"coffeeshops": [
{
"id": "4daecace6a23e6c93490977d",
"name": "Coffee Plus",
"location": {
"lat": 55.03303979781262,
"lng": -1.5186882019042969,
"distance": 4109,
"cc": "GB",
"city": "N Tyneside",
"state": "N Tyneside",
"country": "United Kingdom",
"formattedAddress": [
"N Tyneside",
"N Tyneside",
"United Kingdom"
]
}
},
{
"id": "4b62f32ff964a520515a2ae3",
"name": "Costa Coffee",
"location": {
"address": "Park Avenue",
"lat": 55.042456,
"lng": -1.44745,
"distance": 1830,
"postalCode": "NE26 1DG",
"cc": "GB",
"city": "Whitley Bay",
"country": "United Kingdom",
"formattedAddress": [
"Park Avenue",
"Whitley Bay",
"NE26 1DG",
"United Kingdom"
]
}
},
{
"id": "4e772657b0fb968033ec9b34",
"name": "Central Park Coffee Bar",
"location": {
"lat": 55.04505587854874,
"lng": -1.4528733809052563,
"distance": 1386,
"cc": "GB",
"country": "United Kingdom",
"formattedAddress": [
"United Kingdom"
]
}
}
]
},
{
"id": "001i000000PsceyAAB",
"Name": "United Oil & Gas, Singapore",
"Type": "Customer - Direct",
"BillingStreet": "9 Tagore Lane\nSingapore, Singapore 787472\nSingapore",
"Phone": "(650) 450-8810",
"Website": "http://www.uos.com",
"lat": 1.384019,
"lon": 103.826043,
"coffeeshops": [
{
"id": "51600a0ae4b0e58ee70ba63b",
"name": "2 plus 6 coffee shop",
"location": {
"address": "Tagoie Land",
"lat": 1.3835645925914226,
"lng": 103.82548942917778,
"distance": 79,
"cc": "SG",
"country": "Singapore",
"formattedAddress": [
"Tagoie Land",
"Singapore"
]
}
},
{
"id": "4e93dfebcc21f921aaccd0ad",
"name": "Coffee Table ",
"location": {
"lat": 1.38466885866889,
"lng": 103.83598466491912,
"distance": 1108,
"cc": "SG",
"country": "Singapore",
"formattedAddress": [
"Singapore"
]
}
},
{
"id": "4d8e97a5cb9b224bb2dc8841",
"name": "Coffee Sense @ Amk Ave 5",
"location": {
"lat": 1.377192,
"lng": 103.837053,
"distance": 1441,
"cc": "SG",
"country": "Singapore",
"formattedAddress": [
"Singapore"
]
}
}
]
},
{
"id": "001i000000PscezAAB",
"Name": "Edge Communications",
"Type": "Customer - Direct",
"BillingStreet": "312 Constitution Place\nAustin, TX 78767\nUSA",
"Phone": "(512) 757-6000",
"Website": "http://edgecomm.com",
"lat": 29.6024873,
"lon": -95.54378609999999,
"coffeeshops": [
{
"id": "4f3238ad19836c91c7c21bdc",
"name": "Coffee News",
"location": {
"address": "5680 Highway 6",
"lat": 29.570652,
"lng": -95.568849,
"distance": 4294,
"postalCode": "77459",
"cc": "US",
"city": "Missouri City",
"state": "TX",
"country": "United States",
"formattedAddress": [
"5680 Highway 6",
"Missouri City, TX 77459",
"United States"
]
}
},
{
"id": "51890895498e25c7c0615269",
"name": "The Coffee Bean & Tea Leaf.",
"location": {
"lat": 29.65910444741293,
"lng": -95.55613164032808,
"distance": 6414,
"cc": "US",
"city": "Sugar Land",
"state": "TX",
"country": "United States",
"formattedAddress": [
"Sugar Land, TX",
"United States"
]
}
},
{
"id": "4f32856c19836c91c7dfe997",
"name": "S and J Beverage and Coffee Service",
"location": {
"address": "603 Murphy Rd",
"lat": 29.610375,
"lng": -95.56447,
"distance": 2185,
"postalCode": "77477",
"cc": "US",
"city": "Stafford",
"state": "TX",
"country": "United States",
"formattedAddress": [
"603 Murphy Rd",
"Stafford, TX 77477",
"United States"
]
}
}
]
},
{
"id": "001i000000Pscf0AAB",
"Name": "Burlington Textiles Corp of America",
"Type": "Customer - Direct",
"BillingStreet": "525 S. Lexington Ave\r\nBurlington\r\nNC\r\n27215\r\nUSA",
"Phone": "(336) 222-7000",
"Website": "www.burlington.com",
"lat": 36.0905435,
"lon": -79.43733,
"coffeeshops": [
{
"id": "4e60ca37b993678bb58f6b5b",
"name": "Coffee Shop Via LabCorp",
"location": {
"lat": 36.09055709838867,
"lng": -79.44388580322266,
"distance": 589,
"cc": "US",
"state": "North Carolina",
"country": "United States",
"formattedAddress": [
"North Carolina",
"United States"
]
}
},
{
"id": "4ec4ef706da117f8e5e31b5b",
"name": "The Coffee Pot And Other Things",
"location": {
"lat": 36.0911750793457,
"lng": -79.44769287109375,
"distance": 934,
"postalCode": "27215",
"cc": "US",
"city": "Burlington",
"state": "NC",
"country": "United States",
"formattedAddress": [
"Burlington, NC 27215",
"United States"
]
}
},
{
"id": "52f8bd0411d2ba07cf0cc139",
"name": "Coffee For Me",
"location": {
"lat": 36.089054552362285,
"lng": -79.42003274979335,
"distance": 1564,
"cc": "US",
"city": "Burlington",
"state": "NC",
"country": "United States",
"formattedAddress": [
"Burlington, NC",
"United States"
]
}
}
]
},
{
"id": "001i000000Pscf1AAB",
"Name": "Pyramid Construction Inc.",
"Type": "Customer - Channel",
"BillingStreet": "2 Place Jussieu\r\nParis\r\n75251\r\nFrance",
"Phone": "(014) 427-4427",
"Website": "www.pyramid.com",
"lat": 48.8460258,
"lon": 2.3552132,
"coffeeshops": [
{
"id": "52b5c225498eeda0297a855a",
"name": "Coffee Crêpes",
"location": {
"address": "85 Quai du Louvre",
"lat": 48.858784,
"lng": 2.340793,
"distance": 1769,
"postalCode": "75001",
"cc": "FR",
"city": "Paris",
"state": "Île-de-France",
"country": "France",
"formattedAddress": [
"85 Quai du Louvre",
"75001 Paris",
"France"
]
}
},
{
"id": "4b08f601f964a520981323e3",
"name": "Coffee Parisien",
"location": {
"address": "4 rue Princesse",
"lat": 48.852633795513384,
"lng": 2.3343855142593384,
"distance": 1693,
"postalCode": "75006",
"cc": "FR",
"city": "Paris",
"state": "Île-de-France",
"country": "France",
"formattedAddress": [
"4 rue Princesse",
"75006 Paris",
"France"
]
}
},
{
"id": "501ba244e4b09166759c1e39",
"name": "Coffee Break",
"location": {
"lat": 48.86307054856677,
"lng": 2.3416313854611803,
"distance": 2142,
"cc": "FR",
"country": "France",
"formattedAddress": [
"France"
]
}
}
]
},
{
"id": "001i000000Pscf2AAB",
"Name": "Dickenson plc",
"Type": "Customer - Channel",
"BillingStreet": "1301 Hoch Drive\r\nLawrence\r\nKS\r\n66045\r\nUSA",
"Phone": "(785) 241-6200",
"Website": "dickenson-consulting.com",
"lat": 38.957344,
"lon": -95.250569,
"coffeeshops": [
{
"id": "4ed3c9466da162f1c26d68b5",
"name": "Coffee Corner at The Oread Hotel",
"location": {
"address": "1200 Oread Ave",
"lat": 38.959105760451955,
"lng": -95.24202154117256,
"distance": 765,
"postalCode": "66044",
"cc": "US",
"city": "Lawrence",
"state": "KS",
"country": "United States",
"formattedAddress": [
"1200 Oread Ave",
"Lawrence, KS 66044",
"United States"
]
}
},
{
"id": "4ca0c1532fb1a143cd2bff40",
"name": "Milton's Coffee Shop in the Union",
"location": {
"lat": 38.959425477758046,
"lng": -95.24367570877075,
"distance": 640,
"postalCode": "66044",
"cc": "US",
"city": "Lawrence",
"state": "KS",
"country": "United States",
"formattedAddress": [
"Lawrence, KS 66044",
"United States"
]
}
},
{
"id": "49d9249ef964a520065e1fe3",
"name": "Dunn Bros Coffee",
"location": {
"address": "1618 W 23rd St",
"crossStreet": "Ousdahl Rd",
"lat": 38.9430509,
"lng": -95.255024,
"distance": 1637,
"postalCode": "66046",
"cc": "US",
"city": "Lawrence",
"state": "KS",
"country": "United States",
"formattedAddress": [
"1618 W 23rd St (Ousdahl Rd)",
"Lawrence, KS 66046",
"United States"
]
}
}
]
},
{
"id": "001i000000Pscf3AAB",
"Name": "Grand Hotels & Resorts Ltd",
"Type": "Customer - Direct",
"BillingStreet": "2334 N. Michigan Avenue, Suite 1500\nChicago, IL 60601, USA",
"Phone": "(312) 596-1000",
"Website": "www.grandhotels.com",
"lat": 41.850015,
"lon": -87.624203,
"coffeeshops": [
{
"id": "4a5bc165f964a520b9bb1fe3",
"name": "Intelligentsia Coffee",
"location": {
"address": "53 E Randolph St",
"crossStreet": "btwn Wabash Ave & Garland Ct",
"lat": 41.88446503036799,
"lng": -87.625760010939,
"distance": 3837,
"postalCode": "60601",
"cc": "US",
"city": "Chicago",
"state": "IL",
"country": "United States",
"formattedAddress": [
"53 E Randolph St (btwn Wabash Ave & Garland Ct)",
"Chicago, IL 60601",
"United States"
]
}
},
{
"id": "5113cf111648ac19ebdaf725",
"name": "Bow Truss Coffee",
"location": {
"address": "406 N Wells St",
"crossStreet": "at W Kinzie St",
"lat": 41.88940342086328,
"lng": -87.63409852981567,
"distance": 4460,
"postalCode": "60654",
"cc": "US",
"city": "Chicago",
"state": "IL",
"country": "United States",
"formattedAddress": [
"406 N Wells St (at W Kinzie St)",
"Chicago, IL 60654",
"United States"
]
}
},
{
"id": "4fb3bdc0e4b0d0b77c1d776d",
"name": "Coffee Unlimited",
"location": {
"lat": 41.86358561942807,
"lng": -87.64075289861239,
"distance": 2040,
"postalCode": "60607",
"cc": "US",
"city": "Chicago",
"state": "IL",
"country": "United States",
"formattedAddress": [
"Chicago, IL 60607",
"United States"
]
}
}
]
},
{
"id": "001i000000Pscf4AAB",
"Name": "Express Logistics and Transport",
"Type": "Customer - Channel",
"BillingStreet": "620 SW 5th Avenue Suite 400\nPortland, Oregon 97204\nUnited States",
"Phone": "(503) 421-7800",
"Website": "www.expressl&t.net",
"lat": 45.5190932,
"lon": -122.6771044,
"coffeeshops": [
{
"id": "4e4dd552bd41b76bef93e321",
"name": "Starbucks Coffee",
"location": {
"address": "10218 SW Washington St",
"lat": 45.51856698937857,
"lng": -122.6766451501495,
"distance": 68,
"postalCode": "97225",
"cc": "US",
"city": "Portland",
"state": "OR",
"country": "United States",
"formattedAddress": [
"10218 SW Washington St",
"Portland, OR 97225",
"United States"
]
}
},
{
"id": "4ec3eb751081a4863efe2b94",
"name": "Coffee & Snack",
"location": {
"address": "888 SW 5th Ave",
"crossStreet": "at SW Taylor St.",
"lat": 45.51756426975972,
"lng": -122.67797470092773,
"distance": 183,
"postalCode": "97204",
"cc": "US",
"city": "Portland",
"state": "OR",
"country": "United States",
"formattedAddress": [
"888 SW 5th Ave (at SW Taylor St.)",
"Portland, OR 97204",
"United States"
]
}
},
{
"id": "4a91a6aaf964a520291b20e3",
"name": "Peet's Coffee & Tea",
"location": {
"address": "508 SW Broadway",
"lat": 45.520617,
"lng": -122.678785,
"distance": 214,
"postalCode": "97205",
"cc": "US",
"city": "Portland",
"state": "OR",
"country": "United States",
"formattedAddress": [
"508 SW Broadway",
"Portland, OR 97205",
"United States"
]
}
}
]
},
{
"id": "001i000000Pscf5AAB",
"Name": "University of Arizona",
"Type": "Customer - Direct",
"BillingStreet": "888 N Euclid \nHallis Center, Room 501\nTucson, AZ 85721\nUnited States",
"Phone": "(520) 773-9050",
"Website": "www.universityofarizona.com",
"lat": 32.2332841,
"lon": -110.9488008,
"coffeeshops": [
{
"id": "4b19a70ff964a52041e123e3",
"name": "Bentley's House of Coffee & Tea",
"location": {
"address": "1730 E Speedway Blvd",
"crossStreet": "Campbell",
"lat": 32.2357777,
"lng": -110.945946,
"distance": 386,
"postalCode": "85719",
"cc": "US",
"city": "Tucson",
"state": "AZ",
"country": "United States",
"formattedAddress": [
"1730 E Speedway Blvd (Campbell)",
"Tucson, AZ 85719",
"United States"
]
}
},
{
"id": "4bacf82ff964a5207b1f3be3",
"name": "Coffee Times",
"location": {
"address": "3401 E Speedway Blvd",
"crossStreet": "at N Jones Blvd",
"lat": 32.236453133333335,
"lng": -110.920162,
"distance": 2719,
"postalCode": "85716",
"cc": "US",
"city": "Tucson",
"state": "AZ",
"country": "United States",
"formattedAddress": [
"3401 E Speedway Blvd (at N Jones Blvd)",
"Tucson, AZ 85716",
"United States"
]
}
},
{
"id": "50d1d745e4b0ece913332eff",
"name": "Coffee Base",
"location": {
"lat": 32.2282795474327,
"lng": -110.95241866513123,
"distance": 653,
"postalCode": "85719",
"cc": "US",
"city": "Tucson",
"state": "AZ",
"country": "United States",
"formattedAddress": [
"Tucson, AZ 85719",
"United States"
]
}
}
]
},
{
"id": "001i000000Pscf6AAB",
"Name": "United Oil & Gas Corp.",
"Type": "Customer - Direct",
"BillingStreet": "1301 Avenue of the Americas \nNew York, NY 10019\nUSA",
"Phone": "(212) 842-5500",
"Website": "http://www.uos.com",
"lat": 40.7616971,
"lon": -73.9801263,
"coffeeshops": [
{
"id": "4b6ad59ef964a5209be22be3",
"name": "Coffee Cart",
"location": {
"address": "51st Street",
"crossStreet": "7th Ave",
"lat": 40.76337735085997,
"lng": -73.98092822202503,
"distance": 198,
"cc": "US",
"city": "New York",
"state": "NY",
"country": "United States",
"formattedAddress": [
"51st Street (7th Ave)",
"New York, NY",
"United States"
]
}
},
{
"id": "4ec11fdff5b93923c212cdc0",
"name": "Coffee Cart",
"location": {
"address": "50th And 6th",
"lat": 40.75999512452107,
"lng": -73.98103726694443,
"distance": 204,
"postalCode": "11220",
"cc": "US",
"city": "New York",
"state": "NY",
"country": "United States",
"formattedAddress": [
"50th And 6th",
"New York, NY 11220",
"United States"
]
}
},
{
"id": "4ddc6032b0fba481fc81546f",
"name": "Coffee Cart (46th & 6th)",
"location": {
"address": "46th St",
"crossStreet": "at 6th Ave (NE Corner)",
"lat": 40.75970808566679,
"lng": -73.9874267578125,
"distance": 654,
"postalCode": "10036",
"cc": "US",
"city": "New York",
"state": "NY",
"country": "United States",
"formattedAddress": [
"46th St (at 6th Ave (NE Corner))",
"New York, NY 10036",
"United States"
]
}
}
]
},
{
"id": "001i000000Pscf7AAB",
"Name": "sForce",
"BillingStreet": "The Landmark @ One Market\r\nSan Francisco\r\nCA\r\n94087\r\nUSA",
"Phone": "(415) 901-7000",
"Website": "www.sforce.com",
"lat": 37.79396,
"lon": -122.39496,
"coffeeshops": [
{
"id": "4b0d71eaf964a5207b4823e3",
"name": "The Coffee Bean & Tea Leaf",
"location": {
"address": "150 Drumm St",
"crossStreet": "at Four Embarcadero Center",
"lat": 37.79469538242046,
"lng": -122.39654863295293,
"distance": 161,
"postalCode": "94111",
"cc": "US",
"city": "San Francisco",
"state": "CA",
"country": "United States",
"formattedAddress": [
"150 Drumm St (at Four Embarcadero Center)",
"San Francisco, CA 94111",
"United States"
]
}
},
{
"id": "4aafc57df964a520ab6420e3",
"name": "Peet's Coffee & Tea",
"location": {
"address": "1 California St",
"crossStreet": "at Drumm St",
"lat": 37.793323943617715,
"lng": -122.39672565009258,
"distance": 170,
"postalCode": "94111",
"cc": "US",
"city": "San Francisco",
"state": "CA",
"country": "United States",
"formattedAddress": [
"1 California St (at Drumm St)",
"San Francisco, CA 94111",
"United States"
]
}
},
{
"id": "4cc6f529be40a35dc8198d4c",
"name": "Justin Herman Plaza- Keurig Coffee Pop Up",
"location": {
"lat": 37.79467,
"lng": -122.394862,
"distance": 79,
"postalCode": "94105",
"cc": "US",
"city": "San Francisco",
"state": "CA",
"country": "United States",
"formattedAddress": [
"San Francisco, CA 94105",
"United States"
]
}
}
]
}
]
}
{
"success": true,
"request-id": "21061835-4594-44b3-9545-35f1bdfe0486",
"key": "account",
"account": {
"id": "001i000000PscewAAB",
"Name": "GenePoint",
"Type": "Customer - Channel",
"BillingStreet": "345 Shoreline Park\nMountain View, CA 94043\nUSA",
"Phone": "(650) 867-3450",
"Website": "www.genepoint.com",
"lat": 37.423958,
"lon": -122.0721391,
"coffeeshops": [
{
"id": "531f4262498e7dfd38788daf",
"name": "Root Coffee Bar",
"location": {
"address": "1200 Charleston Rd",
"lat": 37.42125,
"lng": -122.071451,
"distance": 307,
"postalCode": "94043",
"cc": "US",
"city": "Mountain View",
"state": "CA",
"country": "United States",
"formattedAddress": [
"1200 Charleston Rd",
"Mountain View, CA 94043",
"United States"
]
}
},
{
"id": "5281225911d2fbe8d10f9463",
"name": "Barefoot Coffee Roasters van",
"location": {
"lat": 37.419684936426464,
"lng": -122.07105266770425,
"distance": 485,
"cc": "US",
"city": "San Jose",
"state": "CA",
"country": "United States",
"formattedAddress": [
"San Jose, CA",
"United States"
]
}
},
{
"id": "50660dc7e4b0b68b5dbe8858",
"name": "Googleplex - Sight Glass Coffee",
"location": {
"address": "Google",
"lat": 37.420315759073134,
"lng": -122.07286151728987,
"distance": 410,
"postalCode": "94043",
"cc": "US",
"city": "Mountain View",
"state": "CA",
"country": "United States",
"formattedAddress": [
"Google",
"Mountain View, CA 94043",
"United States"
]
}
}
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment