Skip to content

Commit

Permalink
Merge pull request #3 from alexadkins/master
Browse files Browse the repository at this point in the history
Updated company names (s/appmobi/intel) & Klout demo app to v2.
  • Loading branch information
mansilladev committed Jul 11, 2013
2 parents 0af4c9c + ff17da7 commit b24c150
Show file tree
Hide file tree
Showing 38 changed files with 38 additions and 2,975 deletions.
4 changes: 2 additions & 2 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Mashery Network API Demo Apps for appMobi XDK
Mashery Network API Demo Apps for Intel XDK
==================================================================
Created lovingly for the developer community by Mashery.

Expand All @@ -11,7 +11,7 @@ http://developer.mashery.com
SYNOPSIS
==================================================================
These demo apps provide a way to see various Mashery Network APIs
in action. They're built using appMobi's Cross Platform Development
in action. They're built using Intel's Cross Platform Development
Kit (XDK) that lets you create mobile apps for smartphones and
tablets using standard web languages (HTML5, CSS, and JavaScript).

Expand Down
4 changes: 2 additions & 2 deletions mashery.hotwire/3.4.0/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ http://developer.mashery.com
SYNOPSIS
==================================================================
This demo App provides a way to see the Hotwire API in action.
It is built using appMobi's Cross Platform Development Kit (XDK)
It is built using Intel's Cross Platform Development Kit (XDK)
that lets you create mobile apps for smartphones and tablets using
standard web languages (HTML5, CSS, and JavaScript).

Expand All @@ -24,7 +24,7 @@ GETTING STARTED
==================================================================
You will need the following to get started -

1. appMobi's XDK. Free Download - http://www.appmobi.com/?q=node/27
1. Intel's XDK. Free Download - http://xdk-software.intel.com/
2. A Hotwire API key (Register at http://developer.hotwire.com/member/register).


Expand Down
4 changes: 2 additions & 2 deletions mashery.klout/3.4.0/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ http://developer.mashery.com
SYNOPSIS
==================================================================
This demo App provides a way to see the Klout API in action.
It's built using appMobi's Cross Platform Development Kit (XDK)
It's built using Intel's Cross Platform Development Kit (XDK)
that lets you create mobile apps for smartphones and tablets using
standard web languages (HTML5, CSS, and JavaScript).

Expand All @@ -26,7 +26,7 @@ GETTING STARTED
==================================================================
You will need the following to get started -

1. appMobi's XDK. Free Download - http://www.appmobi.com/?q=node/27
1. Intel's XDK. Free Download - http://xdk-software.intel.com/
2. A Klout API key (Register at http://developer.Klout.com/member/register).


Expand Down
6 changes: 3 additions & 3 deletions mashery.klout/3.4.0/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@



<p style="text-align:center;margin-bottom:0;padding-bottom:0;">Twitter Name @<input type="text" id="search" placeholder="Ex: mashery,michels"/><br /><span style="font-size:9px;">Enter up to five handles comma separated.</span></p>
<p style="text-align:center;"><button id="btnUser" ontouchstart="kloutUser();">Search Klout</button>
<p style="text-align:center;margin-bottom:0;padding-bottom:0;">Twitter Name @<input type="text" id="search" placeholder="Ex: mashery"/><br /><span style="font-size:9px;">Enter a Twitter handle.</span></p>
<p style="text-align:center;"><button id="btnUser" ontouchstart="kloutID();">Search Klout</button>


<div id="output">
<div class="output-inner" id="klout-output" style="display:none;">
<div class="users">
<div class="kloutId">

</div>
</div>
Expand Down
43 changes: 25 additions & 18 deletions mashery.klout/3.4.0/klout.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,23 @@ var api_key ='your_api_key_here';
// ***********************************************************

// Check if valid API Key
function check_keys(){
var url = 'http://api.klout.com/1/users/show.json?&key=' + api_key;
function check_keys(){
var url = 'http://api.klout.com/v2/identity.json/twitter?screenName=SteveMartinToGo&key=' + api_key;
AppMobi.device.getRemoteData(url,"GET","","displayFlashMessage","displayFlashMessage");
}

function displayFlashMessage (rawPayload) {

var httpStatus = '200';
var matchString = new RegExp("code: ([0-9]{3})");
var matchArray = rawPayload.match(matchString);

var missingIDError = rawPayload.search("api.klout");

if (matchArray) {
httpStatus = matchArray[1];
}
else if (missingIDError > 0) {
httpStatus = '404';
}

$('#flash').show();
if(httpStatus == '404') {
Expand All @@ -36,36 +39,40 @@ function displayFlashMessage (rawPayload) {
else if(httpStatus == '202') {
AppMobi.notification.alert('Profile Not Found','Invalid ID','OK');
reset_screen();
}
}
else {
$('#flash').addClass('green');
$('#flash').html("<p class='center green'>Valid API Key Found</p>");
}
}

function kloutUser(){
function kloutID(){
var search = $('#search').val();
var url = 'http://api.klout.com/1/users/show.json?&key=' + api_key + '&users=' + search;
AppMobi.device.getRemoteData(url,"GET","","showUserCB","displayFlashMessage");
var url = 'http://api.klout.com/v2/identity.json/twitter?screenName=' + search + '&key=' + api_key;
AppMobi.device.getRemoteData(url,"GET","","userInfo","displayFlashMessage");
}

function userInfo(rawPayload){
var data = $.parseJSON(rawPayload);
var url = 'http://api.klout.com/v2/user.json/' + data.id + '?key=' + api_key;
AppMobi.device.getRemoteData(url,"GET","","showUserCB","displayFlashMessage");
}


function showUserCB(rawPayload)
{
var data = $.parseJSON(rawPayload);
reset_screen();
if (!data.users) {
alert('No Klout profile could be located for that search query.');
if (!data.kloutId) {
AppMobi.notification.alert('Profile Not Found','Oops','OK');
reset_screen();
return false;
}
var users = data.users;
$("#klout-output").show();
$("#klout-output .users").html('<p class="center"><strong>Klout Profiles</strong></p>');
var kloutId = data.kloutId;

$.each(users, function(index, user) {

$("#klout-output .users").append('<hr/>');
$("#klout-output .users").append('<p>Twitter Name: @' + user.twitter_screen_name + '<br />Klout Score: ' + user.score.kscore + '<br />Class: ' + user.score.kclass + '<br />Delta (1 day / 5 day): '+user.score.delta_1day+' / '+user.score.delta_5day+'</p>');
});
$("#klout-output").show();
$("#klout-output .kloutId").html('<p class="center"><strong>Klout Profile</strong></p>');
$("#klout-output .kloutId").append('<p>Twitter Name: @' + data.nick + '<br />Klout Score: ' + data.score.score + '<br />Score Bucket: ' + data.score.bucket + '<br />Score Deltas: ' + '<br /> &nbsp;&nbsp;Day Change: ' + data.scoreDeltas.dayChange + '<br /> &nbsp;&nbsp;Week Change: ' + data.scoreDeltas.weekChange +'<br /> &nbsp;&nbsp;Month Change: ' + data.scoreDeltas.monthChange + '</p>');
}

function reset_screen(){
Expand Down
102 changes: 0 additions & 102 deletions mashery.neustar/3.4.0/Readme.md

This file was deleted.

Loading

0 comments on commit b24c150

Please sign in to comment.