Skip to content

Commit

Permalink
Issue #718: Foursquare plugin
Browse files Browse the repository at this point in the history
Pull request #1286 rebased on current state of master, 5/22/2012

TODO:
-----
Convert dashboard image charts to current style of JavaScript-based charts
Standardize terminology - UI uses both checkin and check-in right now
Improve/standardize look & feel of the checkins list (use relative dates, display user replies more like they're displayed for Twitter/Facebook/G+)
Add paging to checkin list
Proofread documentation
Question: how far back does the plugin capture checkins?

Possible bugs:
-------------
Looks like the plugin only gets comments on checking from me, but no comments from my friends
  • Loading branch information
AaronKalair authored and ginatrapani committed May 22, 2012
1 parent 24440cd commit a1c12d6
Show file tree
Hide file tree
Showing 38 changed files with 3,548 additions and 22 deletions.
31 changes: 31 additions & 0 deletions docs/source/userguide/settings/plugins/foursquare.rst
@@ -0,0 +1,31 @@
foursquare
==========

ThinkUp's foursquare plugin collects check-ins and any associated links and comments.


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

To use the foursquare plugin you will need to

1) Go to: https://foursquare.com/oauth/
2) Click register a new consumer
3) Set the application name to: anything you like
4) Set application web site to: the URL of your ThinkUp installation home page
5) Set the callback URL to: the URL displayed on the foursquare settings page
6) Fill in the capture
7) Click the green 'Register Application' button at the bottom of the page

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 "Authorize ThinkUp on foursquare" button 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 @@ -12,3 +12,4 @@ The official ThinkUp distribution comes with a set of approved plugins. Click on
googleplus
twitter
twitterrealtime
foursquare
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
51 changes: 49 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 @@ -161,6 +161,53 @@ public function testInsertPlace() {

$res = $this->dao->getPostPlace(123457);
$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() {
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 a1c12d6

Please sign in to comment.