Skip to content

Commit

Permalink
[DB MIGRATION REQ'D] Issue #718: Foursquare plugin
Browse files Browse the repository at this point in the history
Pull request #1286 rebased on current state of master, 6/21/2012

TODO:
-----
* Page back through user's checkin history and archive old checkins; make sure each crawler run after that only requests recent checkins once archive is acquired
* Standardize look & feel of the checkins list: use relative dates, display reply count in far right column like they're displayed for Twitter/Facebook/G+
* Add paging to checkin list
* Convert dashboard image charts to JavaScript-based charts
* Double-check test coverage (So far: missing DashboardController change test; TestOfFoursquarePlugin is kind of flimsy)
* Verify test build passes
* Proofread docs

[ci skip]
  • Loading branch information
AaronKalair authored and ginatrapani committed Jun 21, 2012
1 parent 1d00bbf commit 38ce145
Show file tree
Hide file tree
Showing 37 changed files with 3,257 additions and 41 deletions.
31 changes: 31 additions & 0 deletions docs/source/userguide/settings/plugins/foursquare.rst
@@ -0,0 +1,31 @@
Foursquare
==========

ThinkUp's foursquare plugin captures your foursquare checkins, photos, and comments.


Configure the foursquare Plugin (Admin only)
--------------------------------------------

To set up the foursquare plugin:

1. Go to https://foursquare.com/oauth/ and click on "Register a New Consumer."
2. Set the application name to anything you like, perhaps "ThinkUp."
3. Set application web site to: the URL of your ThinkUp installation home page.
4. Set the callback URL to the URL displayed on the foursquare settings page in ThinkUp.
5. Fill in the CAPCTHA.
6. Click on the green "Register Application" button at the bottom of the page.
7. In ThinkUp->Settings->foursquare, fill in the foursquare-provided Client ID and Secret.

Plugin Settings
---------------

**Client ID** (required) is the Client ID provided when you register a new consumer on foursquare

**Client secret** (required) is the Client secret provided when you register a new consumer on foursquare

Add a foursquare User to ThinkUp
--------------------------------

Click on the "Add a foursquare User" button in ThinkUp->Settings->foursquare to add your foursquare user account to
ThinkUp. This button will only appear if the foursquare plugin is configured.
1 change: 1 addition & 0 deletions docs/source/userguide/settings/plugins/index.rst
Expand Up @@ -8,6 +8,7 @@ The official ThinkUp distribution comes with a set of approved plugins. Click on

expandurls
facebook
foursquare
geoencoder
googleplus
twitter
Expand Down
2 changes: 1 addition & 1 deletion extras/dev/makeplugin/makeplugin
Expand Up @@ -80,7 +80,7 @@ class $1PluginConfigurationController extends PluginConfigurationController {
public function authControl() {
\$config = Config::getInstance();
Utils::defineConstants();
Loader::definePathConstants();
\$this->setViewTemplate( THINKUP_WEBAPP_PATH.'plugins/$plugin_name_lcase/view/account.index.tpl');
\$this->addToView('message', 'Hello ThinkUp world! This is an auto-generated plugin configuration '.
'page for ' . \$this->owner->email .'.');
Expand Down
49 changes: 47 additions & 2 deletions tests/TestOfPlaceMySQLDAO.php
Expand Up @@ -78,7 +78,7 @@ public function testInsertPlaceBBoxOnly() {
);
$this->dao->insertPlace($place, 123456, 'twitter');
$res = $this->dao->getPlaceByID('1a16a1d70500c27d');
$this->assertEqual(sizeof($res), 10);
$this->assertEqual(sizeof($res), 12);
$this->assertEqual($res['place_id'], '1a16a1d70500c27d');
$this->assertEqual($res['name'], 'Hyde Park');
$this->assertPattern('/POINT\(-97.72446/', $res['longlat']);
Expand Down Expand Up @@ -142,7 +142,7 @@ public function testInsertPlace() {
$this->dao->insertPlace($place1, 123456, 'twitter');
$this->dao->insertPlace($place2, 123457, 'twitter');
$res = $this->dao->getPlaceByID('1a16a1d70500c27d');
$this->assertEqual(sizeof($res), 10);
$this->assertEqual(sizeof($res), 12);
$this->assertEqual($res['place_id'], '1a16a1d70500c27d');
$this->assertEqual($res['name'], 'Hyde Park');
$this->assertPattern('/POINT\(-97.72446/', $res['longlat']);
Expand All @@ -163,6 +163,51 @@ public function testInsertPlace() {
$this->assertEqual($res['post_id'], 123457);
}

public function testInsertGenericPlace() {
// Set all possible fields
$places['id'] = 123;
$places['place_type'] = "Park";
$places['name'] = "A Park";
$places['full_name'] = "The Greatest Park";
$places['country_code'] = "UK";
$places['country'] = "United Kingdom";
$places['icon'] = "http://www.iconlocation.com";
$places['lat_lng'] = 'POINT(51.514 -0.1167)';
$places['bounding_box'] = 'POLYGON((-0.213503 51.512805,-0.105303 51.512805,-0.105303 51.572068,'.
'-0.213503 51.572068, -0.213503 51.512805)))';
$places['map_image'] = "http://www.mapimage.com";

// Insert the place
$this->dao->insertGenericPlace($places, 1234, 'foursquare');
// Get the place from the database
$res = $this->dao->getPlaceByID('123');

// Check all 12 fields were returned
$this->assertEqual(sizeof($res), 12);
// Check the place ID was set correctly
$this->assertEqual($res['place_id'], '123');
// Check the type was set correctly
$this->assertEqual($res['place_type'], 'Park');
// Check the name was set correctly
$this->assertEqual($res['name'], 'A Park');
// Check the fullname was set correctly
$this->assertEqual($res['full_name'], 'The Greatest Park');
// Check the country code was set correctly
$this->assertEqual($res['country_code'], 'UK');
// Check the country was set correctly
$this->assertEqual($res['country'], 'United Kingdom');
// Check the icon was set correctly
$this->assertEqual($res['icon'], 'http://www.iconlocation.com');
// Check the point was set correctly
$this->assertPattern('/POINT\(51.514/', $res['longlat']);
$this->assertPattern('/ -0.1167/', $res['longlat']);
// Check the bounding box was set correctly
$this->assertEqual($res['bounding_box'], 'POLYGON((-0.213503 51.512805,-0.105303 51.512805,-0.105303 51.572068,'.
'-0.213503 51.572068,-0.213503 51.512805))');
// Check the map image was set correctly
$this->assertEqual($res['map_image'], 'http://www.mapimage.com');
}

public function testInsertPlacePointCoordsOnly() {
$place = array (
'point_coords' => array(
Expand Down
2 changes: 1 addition & 1 deletion tests/TestOfPluginMySQLDAO.php
Expand Up @@ -61,7 +61,7 @@ public function testGetInstalledPlugins() {
$dao = new PluginMySQLDAO();

$plugins = $dao->getInstalledPlugins();
$this->assertEqual(count($plugins), 7);
$this->assertEqual(count($plugins), 8);

usort($plugins, 'TestOfPluginMySQLDAO::pluginSort');
$this->assertEqual($plugins[0]->name,"Expand URLs");
Expand Down

0 comments on commit 38ce145

Please sign in to comment.