Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Updated to make activity posting work. #1

Merged
merged 1 commit into from

2 participants

@milosimpson

Also added .idea freinds to the .gitignore.

We used your library as part of a prototype/feasibility investigation, and these are the updates we discovered thru that process.

@demetriusj demetriusj merged commit 87a38dd into demetriusj:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 19, 2012
  1. @milosimpson

    Updated JanRain api to support activity posting.

    milosimpson authored
    Added .idea to the .gitignore.
This page is out of date. Refresh to see the latest.
Showing with 20 additions and 1 deletion.
  1. +5 −0 .gitignore
  2. +15 −1 lib/janrain.js
View
5 .gitignore
@@ -1,2 +1,7 @@
.project
.DS_Store
+
+# Folders to ignore
+.hg
+.svn
+.idea
View
16 lib/janrain.js
@@ -70,6 +70,20 @@ function janrain(EngageAPIKey) {
map: function(identifier, primaryKey, overwrite, callback) {makeCall('map', {apiKey:EngageAPIKey, identifier:identifier, primaryKey:primaryKey, overwrite:overwrite}, callback);},
unmap: function(identifier, all_identifiers, primaryKey, unlink, callback) {makeCall('unmap', {apiKey:EngageAPIKey, identifier:identifier, all_identifiers:all_identifiers, primaryKey:primaryKey, unlink:unlink}, callback);},
mappings: function(primaryKey, callback) {makeCall('mappings', {apiKey:EngageAPIKey, primaryKey:primaryKey}, callback);},
- activity: function(identifier, activity, truncate, location, callback) {makeCall('activity', {apiKey:EngageAPIKey, activity:activity, truncate:truncate, location:location}, callback);},
+ activity: function(identifier, activity, truncate, location, callback) {
+ // JSON Stringify the Activity object as the 'queryString' lib's, 'stringify' method (which escapes POST data,
+ // does not handle subobjects.
+ // Without this step, no activty is sent to JanRain, and it returns with the error "activity is not a valid JSON object".
+ var activityString = JSON.stringify(activity);
+ makeCall('activity',
+ {
+ apiKey:EngageAPIKey,
+ identifier:identifier,
+ activity:activityString,
+ truncate:truncate,
+ location:location
+ },
+ callback);
+ }
};
}
Something went wrong with that request. Please try again.