diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4388130 --- /dev/null +++ b/.gitignore @@ -0,0 +1,28 @@ +# Created by .gitignore support plugin (hsz.mobi) + +### JetBrains template +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm +*.iml + +## Directory-based project format: +.idea + +### Java template +*.class + +# Maven +target/ +dependency-reduced-pom.xml + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.ear + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + + diff --git a/KloutJavaWrapper/.classpath b/KloutJavaWrapper/.classpath deleted file mode 100644 index 758a14f..0000000 --- a/KloutJavaWrapper/.classpath +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/KloutJavaWrapper/.gitignore b/KloutJavaWrapper/.gitignore deleted file mode 100644 index 5e56e04..0000000 --- a/KloutJavaWrapper/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/bin diff --git a/KloutJavaWrapper/.project b/KloutJavaWrapper/.project deleted file mode 100644 index b9947ff..0000000 --- a/KloutJavaWrapper/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - KloutJavaWrapper - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - - diff --git a/KloutJavaWrapper/.settings/org.eclipse.jdt.core.prefs b/KloutJavaWrapper/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 7341ab1..0000000 --- a/KloutJavaWrapper/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,11 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.7 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.7 diff --git a/KloutJavaWrapper/src/wrapper/Klout.java b/KloutJavaWrapper/src/wrapper/Klout.java deleted file mode 100644 index 0929b30..0000000 --- a/KloutJavaWrapper/src/wrapper/Klout.java +++ /dev/null @@ -1,111 +0,0 @@ -package wrapper; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.HttpURLConnection; -import java.net.URL; - -import argo.jdom.JdomParser; -import argo.jdom.JsonRootNode; - - -/** - * This serves as a Klout Java/Android API Wrapper. All functions that can be done with the Klout API - * can be done through this wrapper as well in a more elegant manner. - * - * @author Anish Visaria - * - */ -public class Klout { - - - public static final String TWITTER = "tw"; - public static final String GOOGLE_PLUS = "gp"; - public static final String INSTAGRAM = "ig"; - public static final String KLOUT = "klout"; - public static final String TWITTER_SCREEN_NAME = "screenName"; - - private String api_key; - private HttpURLConnection conn; - private final String USER_AGENT = "Mozilla/5.0"; - - - - /** - * Initializes the Klout object with the api key provided. - * - * @param key your api key - */ - public Klout(String key) { - api_key = key; - } - - - /** - * Retrieves the id and network of the specified type. All types return a Klout network id - * except when the type is Klout. - * - * @param id social network id - * @param type classification of id - * @return String[] with elements id and network, respectively. - * @throws Exception - */ - public String[] getIdentity(String id, String type) throws Exception { - String content; - if (type.equals(KLOUT)) - content = getContentBody("http://api.klout.com/v2/identity.json/"+type+"/"+id+"/tw?key="+api_key); - else if (type.equals(TWITTER_SCREEN_NAME)) - content = getContentBody("http://api.klout.com/v2/identity.json/twitter?screenName="+id+"&key="+api_key); - else - content = getContentBody("http://api.klout.com/v2/identity.json/"+type+"/"+id+"?key="+api_key); - - JdomParser parser = new JdomParser(); - JsonRootNode stuff = parser.parse(content); - - return new String[] {stuff.getStringValue("id"), stuff.getStringValue("network")}; - } - - - /** - * Retrieves a User object with the specified kloutId. - * - * @param kloutId klout id of user - * @return User with id kloutId - * @throws Exception - */ - public User getUser(String kloutId) throws Exception { - return new User(kloutId, api_key); - } - - - private String getContentBody(String url) throws Exception { - - URL obj = new URL(url); - conn = (HttpURLConnection) obj.openConnection(); - - // default is GET - conn.setRequestMethod("GET"); - - conn.setUseCaches(false); - - // act like a browser - conn.setRequestProperty("User-Agent", USER_AGENT); - conn.setRequestProperty("Accept", - "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); - conn.setRequestProperty("Accept-Language", "en-US,en;q=0.5"); - - BufferedReader in = - new BufferedReader(new InputStreamReader(conn.getInputStream())); - String inputLine; - StringBuffer response = new StringBuffer(); - - while ((inputLine = in.readLine()) != null) { - response.append(inputLine); - } - in.close(); - - return response.toString(); - - } - -} diff --git a/KloutJavaWrapper/src/wrapper/Topic.java b/KloutJavaWrapper/src/wrapper/Topic.java deleted file mode 100644 index f47ec4c..0000000 --- a/KloutJavaWrapper/src/wrapper/Topic.java +++ /dev/null @@ -1,38 +0,0 @@ -package wrapper; - -/** - * The topic class stores all the information given by the Klout API - * of a topic. All fields are publicly accessible. - * - * @author Anish Visaria - * - */ -public class Topic { - - public final String id, display_name, name, slug, imageUrl, displayType, topicType; - - - /** - * Constructs topic object. - * - * @param id - * @param display_name - * @param name - * @param slug - * @param image_url - * @param displayType - * @param topicType - */ - public Topic(String id, String display_name, String name, String slug, String image_url, - String displayType, String topicType) { - this.id = id; - this.display_name = display_name; - this.name = name; - this.slug = slug; - imageUrl = image_url; - this.displayType = displayType; - this.topicType = topicType; - } - - -} diff --git a/KloutJavaWrapper/src/wrapper/User.java b/KloutJavaWrapper/src/wrapper/User.java deleted file mode 100644 index 5f89ded..0000000 --- a/KloutJavaWrapper/src/wrapper/User.java +++ /dev/null @@ -1,222 +0,0 @@ -package wrapper; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.HttpURLConnection; -import java.net.URL; -import java.util.List; - -import argo.jdom.JdomParser; -import argo.jdom.JsonNode; -import argo.jdom.JsonRootNode; - - -/** - * The User class stores all the information pertaining to a klout id user. - * Each user object has a kloutId, nick name, klout score, and bucket. It also provides - * the day change, week change, and month change of the klout score. With this class - * you can also retrieve the user's topics, influencers, and influencees. - * - * @author Anish Visaria - * - */ -public class User { - - private String kloutId, nick, bucket; - private double score, dayChange, weekChange, monthChange; - private HttpURLConnection conn; - private String api_key; - private final String USER_AGENT = "Mozilla/5.0"; - - - /** - * Parses JSON of the user given by the klout id and stores in fields. - * - * @param id klout id of user - * @param api_key your api key - * @throws Exception - */ - public User(String id, String api_key) throws Exception { - String content = getContentBody("http://api.klout.com/v2/user.json/"+id+"?key="+api_key); - this.api_key = api_key; - - JdomParser parser = new JdomParser(); - JsonRootNode stuff = parser.parse(content); - - // real parsing starts - kloutId = stuff.getStringValue("kloutId"); - nick = stuff.getStringValue("nick"); - score = Double.parseDouble(stuff.getNode("score").getNumberValue("score")); - bucket = stuff.getNode("score").getStringValue("bucket"); - - dayChange = Double.parseDouble(stuff.getNode("scoreDeltas").getNumberValue("dayChange")); - weekChange = Double.parseDouble(stuff.getNode("scoreDeltas").getNumberValue("weekChange")); - monthChange = Double.parseDouble(stuff.getNode("scoreDeltas").getNumberValue("monthChange")); - } - - /** - * Returns klout id. - * @return klout id - */ - public String kloutid() { - return kloutId; - } - - /** - * Returns nick name of user. - * @return nick name - */ - public String nick() { - return nick; - } - - /** - * Returns score. - * @return klout score - */ - public double score() { - return score; - } - - /** - * Returns bucket of score. - * @return bucket - */ - public String bucket() { - return bucket; - } - - /** - * Returns day change in score. - * @return day change - */ - public double dayChange() { - return dayChange; - } - - /** - * Returns week change in score. - * @return week change - */ - public double weekChange() { - return weekChange; - } - - /** - * Returns month change in score. - * @return month change - */ - public double monthChange() { - return monthChange; - } - - /** - * Retrieves topics of this user. - * @return array of topics - * @throws Exception - */ - public Topic[] getTopics() throws Exception { - String content = getContentBody("http://api.klout.com/v2/user.json/"+kloutId+"/topics?key="+api_key); - - JdomParser parser = new JdomParser(); - List arr = parser.parse(content).getArrayNode(); - - Topic[] t = new Topic[arr.size()]; - - for (int i = 0; i < arr.size(); i++) { - JsonNode jo = arr.get(i); - Topic temp = new Topic(jo.getStringValue("id"), jo.getStringValue("displayName"), jo.getStringValue("name"), - jo.getStringValue("slug"), jo.getStringValue("imageUrl"), jo.getStringValue("displayType"), - jo.getStringValue("topicType")); - t[i] = temp; - } - - return t; - - } - - - /** - * Returns User[] of influencers. - * @return influencers - * @throws Exception - */ - public User[] getInfluencers() throws Exception { - String content = getContentBody("http://api.klout.com/v2/user.json/"+kloutId+"/influence?key="+api_key); - - JdomParser parser = new JdomParser(); - JsonNode stuff = parser.parse(content); - - List arr = stuff.getArrayNode("myInfluencers"); - - User[] users = new User[arr.size()]; - - for (int i = 0; i < arr.size(); i++) { - JsonNode ent = arr.get(i).getNode("entity"); - String id = ent.getStringValue("id"); - User temp = new User(id, api_key); - users[i] = temp; - } - - return users; - } - - /** - * Returns User[] of influencees. - * @return influencees - * @throws Exception - */ - public User[] getInfluencees() throws Exception { - String content = getContentBody("http://api.klout.com/v2/user.json/"+kloutId+"/influence?key="+api_key); - - JdomParser parser = new JdomParser(); - JsonNode stuff = parser.parse(content); - - List arr = stuff.getArrayNode("myInfluencees"); - - User[] users = new User[arr.size()]; - - for (int i = 0; i < arr.size(); i++) { - JsonNode ent = arr.get(i).getNode("entity"); - String id = ent.getStringValue("id"); - User temp = new User(id, api_key); - users[i] = temp; - } - - return users; - } - - - private String getContentBody(String url) throws Exception { - - URL obj = new URL(url); - conn = (HttpURLConnection) obj.openConnection(); - - // default is GET - conn.setRequestMethod("GET"); - - conn.setUseCaches(false); - - // act like a browser - conn.setRequestProperty("User-Agent", USER_AGENT); - conn.setRequestProperty("Accept", - "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); - conn.setRequestProperty("Accept-Language", "en-US,en;q=0.5"); - - BufferedReader in = - new BufferedReader(new InputStreamReader(conn.getInputStream())); - String inputLine; - StringBuffer response = new StringBuffer(); - - while ((inputLine = in.readLine()) != null) { - response.append(inputLine); - } - in.close(); - - return response.toString(); - - } - - - -} diff --git a/README.md b/README.md index 76e7a91..d9003f6 100644 --- a/README.md +++ b/README.md @@ -6,38 +6,37 @@ Klout Java Wrapper is an interface for the Klout API. In order to use the API you need to first acquire an API key from the Klout website (http://developer.klout.com/member/register). -How to Install it +How to Build ------------------ -You can easily use it by downloading klout-java-wrapper.jar and attaching -it to your project. +After having cloned the source code from Github, go the project directory and run the following +command to build it with Maven: + mvn package install -How to Use it --------------- -See the javadoc for more details. +How to Use +-------------- ```java Klout k = new Klout("your api key"); - + // retrieves klout id with twitter screen name String[] data = k.getIdentity("jtimberlake", Klout.TWITTER_SCREEN_NAME); // contains ["635263", "ks] - + // retrieves klout id with twitter id String[] d = k.getIdentity("500042487", Klout.TWITTER); // contains ["54887627490056592", "ks"] - + // gets user with klout id User u = k.getUser("635263"); - + double score = u.score(); - + Topic[] topics = u.getTopics(); - + User[] influencers = u.getInfluencers(); User[] influencees = u.getInfluencees(); - ``` diff --git a/javadoc/allclasses-frame.html b/javadoc/allclasses-frame.html deleted file mode 100644 index 1603f50..0000000 --- a/javadoc/allclasses-frame.html +++ /dev/null @@ -1,20 +0,0 @@ - - - - - -All Classes - - - - -

All Classes

-
- -
- - diff --git a/javadoc/allclasses-noframe.html b/javadoc/allclasses-noframe.html deleted file mode 100644 index a5f2603..0000000 --- a/javadoc/allclasses-noframe.html +++ /dev/null @@ -1,20 +0,0 @@ - - - - - -All Classes - - - - -

All Classes

-
- -
- - diff --git a/javadoc/constant-values.html b/javadoc/constant-values.html deleted file mode 100644 index 25f8c7e..0000000 --- a/javadoc/constant-values.html +++ /dev/null @@ -1,170 +0,0 @@ - - - - - -Constant Field Values - - - - - - - -
- - - - - -
- - -
-

Constant Field Values

-

Contents

- -
-
- - -

wrapper.*

-
    -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    wrapper.Klout 
    Modifier and TypeConstant FieldValue
    - -public static final java.lang.StringGOOGLE_PLUS"gp"
    - -public static final java.lang.StringINSTAGRAM"ig"
    - -public static final java.lang.StringKLOUT"klout"
    - -public static final java.lang.StringTWITTER"tw"
    - -public static final java.lang.StringTWITTER_SCREEN_NAME"screenName"
    -
  • -
-
- -
- - - - - -
- - - - diff --git a/javadoc/deprecated-list.html b/javadoc/deprecated-list.html deleted file mode 100644 index 7f335db..0000000 --- a/javadoc/deprecated-list.html +++ /dev/null @@ -1,113 +0,0 @@ - - - - - -Deprecated List - - - - - - - -
- - - - - -
- - -
-

Deprecated API

-

Contents

-
- -
- - - - - -
- - - - diff --git a/javadoc/help-doc.html b/javadoc/help-doc.html deleted file mode 100644 index 488e7da..0000000 --- a/javadoc/help-doc.html +++ /dev/null @@ -1,214 +0,0 @@ - - - - - -API Help - - - - - - - -
- - - - - -
- - -
-

How This API Document Is Organized

-
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
-
-
-
    -
  • -

    Package

    -

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    -
      -
    • Interfaces (italic)
    • -
    • Classes
    • -
    • Enums
    • -
    • Exceptions
    • -
    • Errors
    • -
    • Annotation Types
    • -
    -
  • -
  • -

    Class/Interface

    -

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    -
      -
    • Class inheritance diagram
    • -
    • Direct Subclasses
    • -
    • All Known Subinterfaces
    • -
    • All Known Implementing Classes
    • -
    • Class/interface declaration
    • -
    • Class/interface description
    • -
    -
      -
    • Nested Class Summary
    • -
    • Field Summary
    • -
    • Constructor Summary
    • -
    • Method Summary
    • -
    -
      -
    • Field Detail
    • -
    • Constructor Detail
    • -
    • Method Detail
    • -
    -

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    -
  • -
  • -

    Annotation Type

    -

    Each annotation type has its own separate page with the following sections:

    -
      -
    • Annotation Type declaration
    • -
    • Annotation Type description
    • -
    • Required Element Summary
    • -
    • Optional Element Summary
    • -
    • Element Detail
    • -
    -
  • -
  • -

    Enum

    -

    Each enum has its own separate page with the following sections:

    -
      -
    • Enum declaration
    • -
    • Enum description
    • -
    • Enum Constant Summary
    • -
    • Enum Constant Detail
    • -
    -
  • -
  • -

    Use

    -

    Each documented package, class and interface has its own Use page. This page describes what packages, classes, methods, constructors and fields use any part of the given class or package. Given a class or interface A, its Use page includes subclasses of A, fields declared as A, methods that return A, and methods and constructors with parameters of type A. You can access this page by first going to the package, class or interface, then clicking on the "Use" link in the navigation bar.

    -
  • -
  • -

    Tree (Class Hierarchy)

    -

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    -
      -
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • -
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • -
    -
  • -
  • -

    Deprecated API

    -

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    -
  • -
  • -

    Index

    -

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    -
  • -
  • -

    Prev/Next

    -

    These links take you to the next or previous class, interface, package, or related page.

    -
  • -
  • -

    Frames/No Frames

    -

    These links show and hide the HTML frames. All pages are available with or without frames.

    -
  • -
  • -

    All Classes

    -

    The All Classes link shows all classes and interfaces except non-static nested types.

    -
  • -
  • -

    Serialized Form

    -

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    -
  • -
  • -

    Constant Field Values

    -

    The Constant Field Values page lists the static final fields and their values.

    -
  • -
-This help file applies to API documentation generated using the standard doclet.
- -
- - - - - -
- - - - diff --git a/javadoc/index-files/index-1.html b/javadoc/index-files/index-1.html deleted file mode 100644 index eb70755..0000000 --- a/javadoc/index-files/index-1.html +++ /dev/null @@ -1,120 +0,0 @@ - - - - - -B-Index - - - - - - - -
- - - - - -
- - -
B D G I K M N S T U W  - - -

B

-
-
bucket() - Method in class wrapper.User
-
-
Returns bucket of score.
-
-
-B D G I K M N S T U W 
- -
- - - - - -
- - - - diff --git a/javadoc/index-files/index-10.html b/javadoc/index-files/index-10.html deleted file mode 100644 index 516a2f8..0000000 --- a/javadoc/index-files/index-10.html +++ /dev/null @@ -1,124 +0,0 @@ - - - - - -U-Index - - - - - - - -
- - - - - -
- - -
B D G I K M N S T U W  - - -

U

-
-
User - Class in wrapper
-
-
The User class stores all the information pertaining to a klout id user.
-
-
User(String, String) - Constructor for class wrapper.User
-
-
Parses JSON of the user given by the klout id and stores in fields.
-
-
-B D G I K M N S T U W 
- -
- - - - - -
- - - - diff --git a/javadoc/index-files/index-11.html b/javadoc/index-files/index-11.html deleted file mode 100644 index a0a0b83..0000000 --- a/javadoc/index-files/index-11.html +++ /dev/null @@ -1,122 +0,0 @@ - - - - - -W-Index - - - - - - - -
- - - - - -
- - -
B D G I K M N S T U W  - - -

W

-
-
weekChange() - Method in class wrapper.User
-
-
Returns week change in score.
-
-
wrapper - package wrapper
-
 
-
-B D G I K M N S T U W 
- -
- - - - - -
- - - - diff --git a/javadoc/index-files/index-2.html b/javadoc/index-files/index-2.html deleted file mode 100644 index 4983db2..0000000 --- a/javadoc/index-files/index-2.html +++ /dev/null @@ -1,124 +0,0 @@ - - - - - -D-Index - - - - - - - -
- - - - - -
- - -
B D G I K M N S T U W  - - -

D

-
-
dayChange() - Method in class wrapper.User
-
-
Returns day change in score.
-
-
display_name - Variable in class wrapper.Topic
-
 
-
displayType - Variable in class wrapper.Topic
-
 
-
-B D G I K M N S T U W 
- -
- - - - - -
- - - - diff --git a/javadoc/index-files/index-3.html b/javadoc/index-files/index-3.html deleted file mode 100644 index 9948aa0..0000000 --- a/javadoc/index-files/index-3.html +++ /dev/null @@ -1,138 +0,0 @@ - - - - - -G-Index - - - - - - - -
- - - - - -
- - -
B D G I K M N S T U W  - - -

G

-
-
getIdentity(String, String) - Method in class wrapper.Klout
-
-
Retrieves the id and network of the specified type.
-
-
getInfluencees() - Method in class wrapper.User
-
-
Returns User[] of influencees.
-
-
getInfluencers() - Method in class wrapper.User
-
-
Returns User[] of influencers.
-
-
getTopics() - Method in class wrapper.User
-
-
Retrieves topics of this user.
-
-
getUser(String) - Method in class wrapper.Klout
-
-
Retrieves a User object with the specified kloutId.
-
-
GOOGLE_PLUS - Static variable in class wrapper.Klout
-
 
-
-B D G I K M N S T U W 
- -
- - - - - -
- - - - diff --git a/javadoc/index-files/index-4.html b/javadoc/index-files/index-4.html deleted file mode 100644 index eb57ec5..0000000 --- a/javadoc/index-files/index-4.html +++ /dev/null @@ -1,122 +0,0 @@ - - - - - -I-Index - - - - - - - -
- - - - - -
- - -
B D G I K M N S T U W  - - -

I

-
-
id - Variable in class wrapper.Topic
-
 
-
imageUrl - Variable in class wrapper.Topic
-
 
-
INSTAGRAM - Static variable in class wrapper.Klout
-
 
-
-B D G I K M N S T U W 
- -
- - - - - -
- - - - diff --git a/javadoc/index-files/index-5.html b/javadoc/index-files/index-5.html deleted file mode 100644 index ff8de91..0000000 --- a/javadoc/index-files/index-5.html +++ /dev/null @@ -1,130 +0,0 @@ - - - - - -K-Index - - - - - - - -
- - - - - -
- - -
B D G I K M N S T U W  - - -

K

-
-
Klout - Class in wrapper
-
-
This serves as a Klout Java/Android API Wrapper.
-
-
Klout(String) - Constructor for class wrapper.Klout
-
-
Initializes the Klout object with the api key provided.
-
-
KLOUT - Static variable in class wrapper.Klout
-
 
-
kloutid() - Method in class wrapper.User
-
-
Returns klout id.
-
-
-B D G I K M N S T U W 
- -
- - - - - -
- - - - diff --git a/javadoc/index-files/index-6.html b/javadoc/index-files/index-6.html deleted file mode 100644 index befb531..0000000 --- a/javadoc/index-files/index-6.html +++ /dev/null @@ -1,120 +0,0 @@ - - - - - -M-Index - - - - - - - -
- - - - - -
- - -
B D G I K M N S T U W  - - -

M

-
-
monthChange() - Method in class wrapper.User
-
-
Returns month change in score.
-
-
-B D G I K M N S T U W 
- -
- - - - - -
- - - - diff --git a/javadoc/index-files/index-7.html b/javadoc/index-files/index-7.html deleted file mode 100644 index 594966a..0000000 --- a/javadoc/index-files/index-7.html +++ /dev/null @@ -1,122 +0,0 @@ - - - - - -N-Index - - - - - - - -
- - - - - -
- - -
B D G I K M N S T U W  - - -

N

-
-
name - Variable in class wrapper.Topic
-
 
-
nick() - Method in class wrapper.User
-
-
Returns nick name of user.
-
-
-B D G I K M N S T U W 
- -
- - - - - -
- - - - diff --git a/javadoc/index-files/index-8.html b/javadoc/index-files/index-8.html deleted file mode 100644 index d3f9e4a..0000000 --- a/javadoc/index-files/index-8.html +++ /dev/null @@ -1,122 +0,0 @@ - - - - - -S-Index - - - - - - - -
- - - - - -
- - -
B D G I K M N S T U W  - - -

S

-
-
score() - Method in class wrapper.User
-
-
Returns score.
-
-
slug - Variable in class wrapper.Topic
-
 
-
-B D G I K M N S T U W 
- -
- - - - - -
- - - - diff --git a/javadoc/index-files/index-9.html b/javadoc/index-files/index-9.html deleted file mode 100644 index 1f8410d..0000000 --- a/javadoc/index-files/index-9.html +++ /dev/null @@ -1,131 +0,0 @@ - - - - - -T-Index - - - - - - - -
- - - - - -
- - -
B D G I K M N S T U W  - - -

T

-
-
Topic - Class in wrapper
-
-
The topic class stores all the information given by the Klout API - of a topic.
-
-
Topic(String, String, String, String, String, String, String) - Constructor for class wrapper.Topic
-
-
Constructs topic object.
-
-
topicType - Variable in class wrapper.Topic
-
 
-
TWITTER - Static variable in class wrapper.Klout
-
 
-
TWITTER_SCREEN_NAME - Static variable in class wrapper.Klout
-
 
-
-B D G I K M N S T U W 
- -
- - - - - -
- - - - diff --git a/javadoc/index.html b/javadoc/index.html deleted file mode 100644 index dbb52b8..0000000 --- a/javadoc/index.html +++ /dev/null @@ -1,64 +0,0 @@ - - - - - -Generated Documentation (Untitled) - - - - - - -<noscript> -<div>JavaScript is disabled on your browser.</div> -</noscript> -<h2>Frame Alert</h2> -<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="wrapper/package-summary.html">Non-frame version</a>.</p> - - - diff --git a/javadoc/overview-tree.html b/javadoc/overview-tree.html deleted file mode 100644 index 14a7b63..0000000 --- a/javadoc/overview-tree.html +++ /dev/null @@ -1,128 +0,0 @@ - - - - - -Class Hierarchy - - - - - - - -
- - - - - -
- - -
-

Hierarchy For All Packages

-Package Hierarchies: - -
-
-

Class Hierarchy

-
    -
  • java.lang.Object - -
  • -
-
- -
- - - - - -
- - - - diff --git a/javadoc/package-list b/javadoc/package-list deleted file mode 100644 index 191df3b..0000000 --- a/javadoc/package-list +++ /dev/null @@ -1 +0,0 @@ -wrapper diff --git a/javadoc/resources/background.gif b/javadoc/resources/background.gif deleted file mode 100644 index f471940..0000000 Binary files a/javadoc/resources/background.gif and /dev/null differ diff --git a/javadoc/resources/tab.gif b/javadoc/resources/tab.gif deleted file mode 100644 index 1a73a83..0000000 Binary files a/javadoc/resources/tab.gif and /dev/null differ diff --git a/javadoc/resources/titlebar.gif b/javadoc/resources/titlebar.gif deleted file mode 100644 index 17443b3..0000000 Binary files a/javadoc/resources/titlebar.gif and /dev/null differ diff --git a/javadoc/resources/titlebar_end.gif b/javadoc/resources/titlebar_end.gif deleted file mode 100644 index 3ad78d4..0000000 Binary files a/javadoc/resources/titlebar_end.gif and /dev/null differ diff --git a/javadoc/stylesheet.css b/javadoc/stylesheet.css deleted file mode 100644 index 0aeaa97..0000000 --- a/javadoc/stylesheet.css +++ /dev/null @@ -1,474 +0,0 @@ -/* Javadoc style sheet */ -/* -Overall document style -*/ -body { - background-color:#ffffff; - color:#353833; - font-family:Arial, Helvetica, sans-serif; - font-size:76%; - margin:0; -} -a:link, a:visited { - text-decoration:none; - color:#4c6b87; -} -a:hover, a:focus { - text-decoration:none; - color:#bb7a2a; -} -a:active { - text-decoration:none; - color:#4c6b87; -} -a[name] { - color:#353833; -} -a[name]:hover { - text-decoration:none; - color:#353833; -} -pre { - font-size:1.3em; -} -h1 { - font-size:1.8em; -} -h2 { - font-size:1.5em; -} -h3 { - font-size:1.4em; -} -h4 { - font-size:1.3em; -} -h5 { - font-size:1.2em; -} -h6 { - font-size:1.1em; -} -ul { - list-style-type:disc; -} -code, tt { - font-size:1.2em; -} -dt code { - font-size:1.2em; -} -table tr td dt code { - font-size:1.2em; - vertical-align:top; -} -sup { - font-size:.6em; -} -/* -Document title and Copyright styles -*/ -.clear { - clear:both; - height:0px; - overflow:hidden; -} -.aboutLanguage { - float:right; - padding:0px 21px; - font-size:.8em; - z-index:200; - margin-top:-7px; -} -.legalCopy { - margin-left:.5em; -} -.bar a, .bar a:link, .bar a:visited, .bar a:active { - color:#FFFFFF; - text-decoration:none; -} -.bar a:hover, .bar a:focus { - color:#bb7a2a; -} -.tab { - background-color:#0066FF; - background-image:url(resources/titlebar.gif); - background-position:left top; - background-repeat:no-repeat; - color:#ffffff; - padding:8px; - width:5em; - font-weight:bold; -} -/* -Navigation bar styles -*/ -.bar { - background-image:url(resources/background.gif); - background-repeat:repeat-x; - color:#FFFFFF; - padding:.8em .5em .4em .8em; - height:auto;/*height:1.8em;*/ - font-size:1em; - margin:0; -} -.topNav { - background-image:url(resources/background.gif); - background-repeat:repeat-x; - color:#FFFFFF; - float:left; - padding:0; - width:100%; - clear:right; - height:2.8em; - padding-top:10px; - overflow:hidden; -} -.bottomNav { - margin-top:10px; - background-image:url(resources/background.gif); - background-repeat:repeat-x; - color:#FFFFFF; - float:left; - padding:0; - width:100%; - clear:right; - height:2.8em; - padding-top:10px; - overflow:hidden; -} -.subNav { - background-color:#dee3e9; - border-bottom:1px solid #9eadc0; - float:left; - width:100%; - overflow:hidden; -} -.subNav div { - clear:left; - float:left; - padding:0 0 5px 6px; -} -ul.navList, ul.subNavList { - float:left; - margin:0 25px 0 0; - padding:0; -} -ul.navList li{ - list-style:none; - float:left; - padding:3px 6px; -} -ul.subNavList li{ - list-style:none; - float:left; - font-size:90%; -} -.topNav a:link, .topNav a:active, .topNav a:visited, .bottomNav a:link, .bottomNav a:active, .bottomNav a:visited { - color:#FFFFFF; - text-decoration:none; -} -.topNav a:hover, .bottomNav a:hover { - text-decoration:none; - color:#bb7a2a; -} -.navBarCell1Rev { - background-image:url(resources/tab.gif); - background-color:#a88834; - color:#FFFFFF; - margin: auto 5px; - border:1px solid #c9aa44; -} -/* -Page header and footer styles -*/ -.header, .footer { - clear:both; - margin:0 20px; - padding:5px 0 0 0; -} -.indexHeader { - margin:10px; - position:relative; -} -.indexHeader h1 { - font-size:1.3em; -} -.title { - color:#2c4557; - margin:10px 0; -} -.subTitle { - margin:5px 0 0 0; -} -.header ul { - margin:0 0 25px 0; - padding:0; -} -.footer ul { - margin:20px 0 5px 0; -} -.header ul li, .footer ul li { - list-style:none; - font-size:1.2em; -} -/* -Heading styles -*/ -div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 { - background-color:#dee3e9; - border-top:1px solid #9eadc0; - border-bottom:1px solid #9eadc0; - margin:0 0 6px -8px; - padding:2px 5px; -} -ul.blockList ul.blockList ul.blockList li.blockList h3 { - background-color:#dee3e9; - border-top:1px solid #9eadc0; - border-bottom:1px solid #9eadc0; - margin:0 0 6px -8px; - padding:2px 5px; -} -ul.blockList ul.blockList li.blockList h3 { - padding:0; - margin:15px 0; -} -ul.blockList li.blockList h2 { - padding:0px 0 20px 0; -} -/* -Page layout container styles -*/ -.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer { - clear:both; - padding:10px 20px; - position:relative; -} -.indexContainer { - margin:10px; - position:relative; - font-size:1.0em; -} -.indexContainer h2 { - font-size:1.1em; - padding:0 0 3px 0; -} -.indexContainer ul { - margin:0; - padding:0; -} -.indexContainer ul li { - list-style:none; -} -.contentContainer .description dl dt, .contentContainer .details dl dt, .serializedFormContainer dl dt { - font-size:1.1em; - font-weight:bold; - margin:10px 0 0 0; - color:#4E4E4E; -} -.contentContainer .description dl dd, .contentContainer .details dl dd, .serializedFormContainer dl dd { - margin:10px 0 10px 20px; -} -.serializedFormContainer dl.nameValue dt { - margin-left:1px; - font-size:1.1em; - display:inline; - font-weight:bold; -} -.serializedFormContainer dl.nameValue dd { - margin:0 0 0 1px; - font-size:1.1em; - display:inline; -} -/* -List styles -*/ -ul.horizontal li { - display:inline; - font-size:0.9em; -} -ul.inheritance { - margin:0; - padding:0; -} -ul.inheritance li { - display:inline; - list-style:none; -} -ul.inheritance li ul.inheritance { - margin-left:15px; - padding-left:15px; - padding-top:1px; -} -ul.blockList, ul.blockListLast { - margin:10px 0 10px 0; - padding:0; -} -ul.blockList li.blockList, ul.blockListLast li.blockList { - list-style:none; - margin-bottom:25px; -} -ul.blockList ul.blockList li.blockList, ul.blockList ul.blockListLast li.blockList { - padding:0px 20px 5px 10px; - border:1px solid #9eadc0; - background-color:#f9f9f9; -} -ul.blockList ul.blockList ul.blockList li.blockList, ul.blockList ul.blockList ul.blockListLast li.blockList { - padding:0 0 5px 8px; - background-color:#ffffff; - border:1px solid #9eadc0; - border-top:none; -} -ul.blockList ul.blockList ul.blockList ul.blockList li.blockList { - margin-left:0; - padding-left:0; - padding-bottom:15px; - border:none; - border-bottom:1px solid #9eadc0; -} -ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast { - list-style:none; - border-bottom:none; - padding-bottom:0; -} -table tr td dl, table tr td dl dt, table tr td dl dd { - margin-top:0; - margin-bottom:1px; -} -/* -Table styles -*/ -.contentContainer table, .classUseContainer table, .constantValuesContainer table { - border-bottom:1px solid #9eadc0; - width:100%; -} -.contentContainer ul li table, .classUseContainer ul li table, .constantValuesContainer ul li table { - width:100%; -} -.contentContainer .description table, .contentContainer .details table { - border-bottom:none; -} -.contentContainer ul li table th.colOne, .contentContainer ul li table th.colFirst, .contentContainer ul li table th.colLast, .classUseContainer ul li table th, .constantValuesContainer ul li table th, .contentContainer ul li table td.colOne, .contentContainer ul li table td.colFirst, .contentContainer ul li table td.colLast, .classUseContainer ul li table td, .constantValuesContainer ul li table td{ - vertical-align:top; - padding-right:20px; -} -.contentContainer ul li table th.colLast, .classUseContainer ul li table th.colLast,.constantValuesContainer ul li table th.colLast, -.contentContainer ul li table td.colLast, .classUseContainer ul li table td.colLast,.constantValuesContainer ul li table td.colLast, -.contentContainer ul li table th.colOne, .classUseContainer ul li table th.colOne, -.contentContainer ul li table td.colOne, .classUseContainer ul li table td.colOne { - padding-right:3px; -} -.overviewSummary caption, .packageSummary caption, .contentContainer ul.blockList li.blockList caption, .summary caption, .classUseContainer caption, .constantValuesContainer caption { - position:relative; - text-align:left; - background-repeat:no-repeat; - color:#FFFFFF; - font-weight:bold; - clear:none; - overflow:hidden; - padding:0px; - margin:0px; -} -caption a:link, caption a:hover, caption a:active, caption a:visited { - color:#FFFFFF; -} -.overviewSummary caption span, .packageSummary caption span, .contentContainer ul.blockList li.blockList caption span, .summary caption span, .classUseContainer caption span, .constantValuesContainer caption span { - white-space:nowrap; - padding-top:8px; - padding-left:8px; - display:block; - float:left; - background-image:url(resources/titlebar.gif); - height:18px; -} -.overviewSummary .tabEnd, .packageSummary .tabEnd, .contentContainer ul.blockList li.blockList .tabEnd, .summary .tabEnd, .classUseContainer .tabEnd, .constantValuesContainer .tabEnd { - width:10px; - background-image:url(resources/titlebar_end.gif); - background-repeat:no-repeat; - background-position:top right; - position:relative; - float:left; -} -ul.blockList ul.blockList li.blockList table { - margin:0 0 12px 0px; - width:100%; -} -.tableSubHeadingColor { - background-color: #EEEEFF; -} -.altColor { - background-color:#eeeeef; -} -.rowColor { - background-color:#ffffff; -} -.overviewSummary td, .packageSummary td, .contentContainer ul.blockList li.blockList td, .summary td, .classUseContainer td, .constantValuesContainer td { - text-align:left; - padding:3px 3px 3px 7px; -} -th.colFirst, th.colLast, th.colOne, .constantValuesContainer th { - background:#dee3e9; - border-top:1px solid #9eadc0; - border-bottom:1px solid #9eadc0; - text-align:left; - padding:3px 3px 3px 7px; -} -td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover { - font-weight:bold; -} -td.colFirst, th.colFirst { - border-left:1px solid #9eadc0; - white-space:nowrap; -} -td.colLast, th.colLast { - border-right:1px solid #9eadc0; -} -td.colOne, th.colOne { - border-right:1px solid #9eadc0; - border-left:1px solid #9eadc0; -} -table.overviewSummary { - padding:0px; - margin-left:0px; -} -table.overviewSummary td.colFirst, table.overviewSummary th.colFirst, -table.overviewSummary td.colOne, table.overviewSummary th.colOne { - width:25%; - vertical-align:middle; -} -table.packageSummary td.colFirst, table.overviewSummary th.colFirst { - width:25%; - vertical-align:middle; -} -/* -Content styles -*/ -.description pre { - margin-top:0; -} -.deprecatedContent { - margin:0; - padding:10px 0; -} -.docSummary { - padding:0; -} -/* -Formatting effect styles -*/ -.sourceLineNo { - color:green; - padding:0 30px 0 0; -} -h1.hidden { - visibility:hidden; - overflow:hidden; - font-size:.9em; -} -.block { - display:block; - margin:3px 0 0 0; -} -.strong { - font-weight:bold; -} diff --git a/javadoc/wrapper/Klout.html b/javadoc/wrapper/Klout.html deleted file mode 100644 index 8802811..0000000 --- a/javadoc/wrapper/Klout.html +++ /dev/null @@ -1,387 +0,0 @@ - - - - - -Klout - - - - - - - - - - - -
-
wrapper
-

Class Klout

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • wrapper.Klout
    • -
    -
  • -
-
-
    -
  • -
    -
    -
    public class Klout
    -extends java.lang.Object
    -
    This serves as a Klout Java/Android API Wrapper. All functions that can be done with the Klout API - can be done through this wrapper as well in a more elegant manner.
    -
    Author:
    -
    Anish Visaria
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Field Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Fields 
      Modifier and TypeField and Description
      static java.lang.StringGOOGLE_PLUS 
      static java.lang.StringINSTAGRAM 
      static java.lang.StringKLOUT 
      static java.lang.StringTWITTER 
      static java.lang.StringTWITTER_SCREEN_NAME 
      -
    • -
    - -
      -
    • - - -

      Constructor Summary

      - - - - - - - - -
      Constructors 
      Constructor and Description
      Klout(java.lang.String key) -
      Initializes the Klout object with the api key provided.
      -
      -
    • -
    - -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - -
      Methods 
      Modifier and TypeMethod and Description
      java.lang.String[]getIdentity(java.lang.String id, - java.lang.String type) -
      Retrieves the id and network of the specified type.
      -
      UsergetUser(java.lang.String kloutId) -
      Retrieves a User object with the specified kloutId.
      -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
  • -
-
-
-
    -
  • - - - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        Klout

        -
        public Klout(java.lang.String key)
        -
        Initializes the Klout object with the api key provided.
        -
        Parameters:
        key - your api key
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getIdentity

        -
        public java.lang.String[] getIdentity(java.lang.String id,
        -                             java.lang.String type)
        -                               throws java.lang.Exception
        -
        Retrieves the id and network of the specified type. All types return a Klout network id - except when the type is Klout.
        -
        Parameters:
        id - social network id
        type - classification of id
        -
        Returns:
        String[] with elements id and network, respectively.
        -
        Throws:
        -
        java.lang.Exception
        -
      • -
      - - - -
        -
      • -

        getUser

        -
        public User getUser(java.lang.String kloutId)
        -             throws java.lang.Exception
        -
        Retrieves a User object with the specified kloutId.
        -
        Parameters:
        kloutId - klout id of user
        -
        Returns:
        User with id kloutId
        -
        Throws:
        -
        java.lang.Exception
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/javadoc/wrapper/Topic.html b/javadoc/wrapper/Topic.html deleted file mode 100644 index 1a9cf9b..0000000 --- a/javadoc/wrapper/Topic.html +++ /dev/null @@ -1,360 +0,0 @@ - - - - - -Topic - - - - - - - - - - - -
-
wrapper
-

Class Topic

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • wrapper.Topic
    • -
    -
  • -
-
-
    -
  • -
    -
    -
    public class Topic
    -extends java.lang.Object
    -
    The topic class stores all the information given by the Klout API - of a topic. All fields are publicly accessible.
    -
    Author:
    -
    Anish Visaria
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Field Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Fields 
      Modifier and TypeField and Description
      java.lang.Stringdisplay_name 
      java.lang.StringdisplayType 
      java.lang.Stringid 
      java.lang.StringimageUrl 
      java.lang.Stringname 
      java.lang.Stringslug 
      java.lang.StringtopicType 
      -
    • -
    - -
      -
    • - - -

      Constructor Summary

      - - - - - - - - -
      Constructors 
      Constructor and Description
      Topic(java.lang.String id, - java.lang.String display_name, - java.lang.String name, - java.lang.String slug, - java.lang.String image_url, - java.lang.String displayType, - java.lang.String topicType) -
      Constructs topic object.
      -
      -
    • -
    - -
      -
    • - - -

      Method Summary

      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        id

        -
        public final java.lang.String id
        -
      • -
      - - - -
        -
      • -

        display_name

        -
        public final java.lang.String display_name
        -
      • -
      - - - -
        -
      • -

        name

        -
        public final java.lang.String name
        -
      • -
      - - - -
        -
      • -

        slug

        -
        public final java.lang.String slug
        -
      • -
      - - - -
        -
      • -

        imageUrl

        -
        public final java.lang.String imageUrl
        -
      • -
      - - - -
        -
      • -

        displayType

        -
        public final java.lang.String displayType
        -
      • -
      - - - -
        -
      • -

        topicType

        -
        public final java.lang.String topicType
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        Topic

        -
        public Topic(java.lang.String id,
        -     java.lang.String display_name,
        -     java.lang.String name,
        -     java.lang.String slug,
        -     java.lang.String image_url,
        -     java.lang.String displayType,
        -     java.lang.String topicType)
        -
        Constructs topic object.
        -
        Parameters:
        id -
        display_name -
        name -
        slug -
        image_url -
        displayType -
        topicType -
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/javadoc/wrapper/User.html b/javadoc/wrapper/User.html deleted file mode 100644 index d20b274..0000000 --- a/javadoc/wrapper/User.html +++ /dev/null @@ -1,435 +0,0 @@ - - - - - -User - - - - - - - - - - - -
-
wrapper
-

Class User

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • wrapper.User
    • -
    -
  • -
-
-
    -
  • -
    -
    -
    public class User
    -extends java.lang.Object
    -
    The User class stores all the information pertaining to a klout id user. - Each user object has a kloutId, nick name, klout score, and bucket. It also provides - the day change, week change, and month change of the klout score. With this class - you can also retrieve the user's topics, influencers, and influencees.
    -
    Author:
    -
    Anish Visaria
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Summary

      - - - - - - - - -
      Constructors 
      Constructor and Description
      User(java.lang.String id, - java.lang.String api_key) -
      Parses JSON of the user given by the klout id and stores in fields.
      -
      -
    • -
    - -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Methods 
      Modifier and TypeMethod and Description
      java.lang.Stringbucket() -
      Returns bucket of score.
      -
      doubledayChange() -
      Returns day change in score.
      -
      User[]getInfluencees() -
      Returns User[] of influencees.
      -
      User[]getInfluencers() -
      Returns User[] of influencers.
      -
      Topic[]getTopics() -
      Retrieves topics of this user.
      -
      java.lang.Stringkloutid() -
      Returns klout id.
      -
      doublemonthChange() -
      Returns month change in score.
      -
      java.lang.Stringnick() -
      Returns nick name of user.
      -
      doublescore() -
      Returns score.
      -
      doubleweekChange() -
      Returns week change in score.
      -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        User

        -
        public User(java.lang.String id,
        -    java.lang.String api_key)
        -     throws java.lang.Exception
        -
        Parses JSON of the user given by the klout id and stores in fields.
        -
        Parameters:
        id - klout id of user
        api_key - your api key
        -
        Throws:
        -
        java.lang.Exception
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        kloutid

        -
        public java.lang.String kloutid()
        -
        Returns klout id.
        -
        Returns:
        klout id
        -
      • -
      - - - -
        -
      • -

        nick

        -
        public java.lang.String nick()
        -
        Returns nick name of user.
        -
        Returns:
        nick name
        -
      • -
      - - - -
        -
      • -

        score

        -
        public double score()
        -
        Returns score.
        -
        Returns:
        klout score
        -
      • -
      - - - -
        -
      • -

        bucket

        -
        public java.lang.String bucket()
        -
        Returns bucket of score.
        -
        Returns:
        bucket
        -
      • -
      - - - -
        -
      • -

        dayChange

        -
        public double dayChange()
        -
        Returns day change in score.
        -
        Returns:
        day change
        -
      • -
      - - - -
        -
      • -

        weekChange

        -
        public double weekChange()
        -
        Returns week change in score.
        -
        Returns:
        week change
        -
      • -
      - - - -
        -
      • -

        monthChange

        -
        public double monthChange()
        -
        Returns month change in score.
        -
        Returns:
        month change
        -
      • -
      - - - -
        -
      • -

        getTopics

        -
        public Topic[] getTopics()
        -                  throws java.lang.Exception
        -
        Retrieves topics of this user.
        -
        Returns:
        array of topics
        -
        Throws:
        -
        java.lang.Exception
        -
      • -
      - - - -
        -
      • -

        getInfluencers

        -
        public User[] getInfluencers()
        -                      throws java.lang.Exception
        -
        Returns User[] of influencers.
        -
        Returns:
        influencers
        -
        Throws:
        -
        java.lang.Exception
        -
      • -
      - - - -
        -
      • -

        getInfluencees

        -
        public User[] getInfluencees()
        -                      throws java.lang.Exception
        -
        Returns User[] of influencees.
        -
        Returns:
        influencees
        -
        Throws:
        -
        java.lang.Exception
        -
      • -
      -
    • -
    -
  • -
-
-
- - - - - - - diff --git a/javadoc/wrapper/class-use/Klout.html b/javadoc/wrapper/class-use/Klout.html deleted file mode 100644 index b87b679..0000000 --- a/javadoc/wrapper/class-use/Klout.html +++ /dev/null @@ -1,113 +0,0 @@ - - - - - -Uses of Class wrapper.Klout - - - - - - - - - - -
-

Uses of Class
wrapper.Klout

-
-
No usage of wrapper.Klout
- - - - - - diff --git a/javadoc/wrapper/class-use/Topic.html b/javadoc/wrapper/class-use/Topic.html deleted file mode 100644 index 71f64bb..0000000 --- a/javadoc/wrapper/class-use/Topic.html +++ /dev/null @@ -1,140 +0,0 @@ - - - - - -Uses of Class wrapper.Topic - - - - - - - - - - -
-

Uses of Class
wrapper.Topic

-
-
- -
- - - - - - diff --git a/javadoc/wrapper/class-use/User.html b/javadoc/wrapper/class-use/User.html deleted file mode 100644 index 4564e75..0000000 --- a/javadoc/wrapper/class-use/User.html +++ /dev/null @@ -1,152 +0,0 @@ - - - - - -Uses of Class wrapper.User - - - - - - - - - - -
-

Uses of Class
wrapper.User

-
-
-
    -
  • -
      -
    • - - -

      Uses of User in wrapper

      - - - - - - - - - - - - - - - - - - - - -
      Methods in wrapper that return User 
      Modifier and TypeMethod and Description
      User[]User.getInfluencees() -
      Returns User[] of influencees.
      -
      User[]User.getInfluencers() -
      Returns User[] of influencers.
      -
      UserKlout.getUser(java.lang.String kloutId) -
      Retrieves a User object with the specified kloutId.
      -
      -
    • -
    -
  • -
-
- - - - - - diff --git a/javadoc/wrapper/package-frame.html b/javadoc/wrapper/package-frame.html deleted file mode 100644 index 5dee014..0000000 --- a/javadoc/wrapper/package-frame.html +++ /dev/null @@ -1,21 +0,0 @@ - - - - - -wrapper - - - - -

wrapper

-
-

Classes

- -
- - diff --git a/javadoc/wrapper/package-summary.html b/javadoc/wrapper/package-summary.html deleted file mode 100644 index d7f930c..0000000 --- a/javadoc/wrapper/package-summary.html +++ /dev/null @@ -1,146 +0,0 @@ - - - - - -wrapper - - - - - - - - - - -
-

Package wrapper

-
-
-
    -
  • - - - - - - - - - - - - - - - - - - - - -
    Class Summary 
    ClassDescription
    Klout -
    This serves as a Klout Java/Android API Wrapper.
    -
    Topic -
    The topic class stores all the information given by the Klout API - of a topic.
    -
    User -
    The User class stores all the information pertaining to a klout id user.
    -
    -
  • -
-
- - - - - - diff --git a/javadoc/wrapper/package-tree.html b/javadoc/wrapper/package-tree.html deleted file mode 100644 index b0c76ed..0000000 --- a/javadoc/wrapper/package-tree.html +++ /dev/null @@ -1,124 +0,0 @@ - - - - - -wrapper Class Hierarchy - - - - - - - -
- - - - - -
- - -
-

Hierarchy For Package wrapper

-
-
-

Class Hierarchy

-
    -
  • java.lang.Object - -
  • -
-
- -
- - - - - -
- - - - diff --git a/javadoc/wrapper/package-use.html b/javadoc/wrapper/package-use.html deleted file mode 100644 index 3f3e677..0000000 --- a/javadoc/wrapper/package-use.html +++ /dev/null @@ -1,139 +0,0 @@ - - - - - -Uses of Package wrapper - - - - - - - -
- - - - - -
- - -
-

Uses of Package
wrapper

-
-
-
    -
  • - - - - - - - - - - - - - - - -
    Classes in wrapper used by wrapper 
    Class and Description
    Topic -
    The topic class stores all the information given by the Klout API - of a topic.
    -
    User -
    The User class stores all the information pertaining to a klout id user.
    -
    -
  • -
-
- -
- - - - - -
- - - - diff --git a/klout-java-wrapper.jar b/klout-java-wrapper.jar deleted file mode 100644 index dad5eaa..0000000 Binary files a/klout-java-wrapper.jar and /dev/null differ diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..18b3e3f --- /dev/null +++ b/pom.xml @@ -0,0 +1,70 @@ + + 4.0.0 + + be.bigindustries.klout + klout + 1.0-SNAPSHOT + jar + + BigIndustries Klout Wrapper + http://bigindustries.be + + + + UTF-8 + + + + + + + org.apache.maven.plugins + maven-shade-plugin + 2.3 + + + + + + package + + shade + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.2 + + 1.7 + 1.7 + + + + + + + + junit + junit + 4.11 + test + + + + org.slf4j + slf4j-log4j12 + 1.7.7 + + + + com.fasterxml.jackson.core + jackson-databind + 2.5.0 + + + diff --git a/src/main/java/be/bigindustries/klout/Klout.java b/src/main/java/be/bigindustries/klout/Klout.java new file mode 100644 index 0000000..3509ca4 --- /dev/null +++ b/src/main/java/be/bigindustries/klout/Klout.java @@ -0,0 +1,110 @@ +package be.bigindustries.klout; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.URL; + +/** + * This serves as a Klout Java/Android API Wrapper. All functions that can be done with the Klout API + * can be done through this wrapper as well in a more elegant manner. + * + * @author Anish Visaria + * @author Emre Sevinç + */ +public class Klout { + + public static final String TWITTER = "tw"; + public static final String GOOGLE_PLUS = "gp"; + public static final String INSTAGRAM = "ig"; + public static final String KLOUT = "klout"; + public static final String TWITTER_SCREEN_NAME = "screenName"; + + private String api_key; + private HttpURLConnection conn; + private final String USER_AGENT = "Mozilla/5.0"; + + + /** + * Initializes the Klout object with the api key provided. + * + * @param key your api key + */ + public Klout(String key) { + api_key = key; + } + + + /** + * Retrieves the id and network of the specified type. All types return a Klout network id + * except when the type is Klout. + * + * @param id social network id + * @param type classification of id + * @return String[] with elements id and network, respectively. + * @throws IOException + */ + public String[] getIdentity(String id, String type) throws IOException { + String content; + if (type.equals(KLOUT)) { + content = getContentBody(String.format("http://api.klout.com/v2/identity.json/%s/%s/tw?key=%s", + type, id, api_key)); + } else if (type.equals(TWITTER_SCREEN_NAME)) { + content = getContentBody(String.format("http://api.klout.com/v2/identity.json/twitter?screenName=%s&key=%s", + id, api_key)); + } else { + content = getContentBody(String.format("http://api.klout.com/v2/identity.json/%s/%s?key=%s", type, id, api_key)); + } + + ObjectMapper objectMapper = new ObjectMapper(); + JsonNode jsonNode = objectMapper.readTree(content); + + return new String[]{jsonNode.get("id").textValue(), jsonNode.get("network").textValue()}; + } + + + /** + * Retrieves a User object with the specified kloutId. + * + * @param kloutId klout id of user + * @return User with id kloutId + * @throws Exception + */ + public User getUser(String kloutId) throws IOException { + return new User(kloutId, api_key); + } + + + private String getContentBody(String url) throws IOException { + + URL obj = new URL(url); + conn = (HttpURLConnection) obj.openConnection(); + + // default is GET + conn.setRequestMethod("GET"); + + conn.setUseCaches(false); + + // act like a browser + conn.setRequestProperty("User-Agent", USER_AGENT); + conn.setRequestProperty("Accept", "text/html,application/json;q=0.9,*/*;q=0.8"); + conn.setRequestProperty("Accept-Language", "en-US,en;q=0.5"); + + BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream())); + String inputLine; + StringBuffer response = new StringBuffer(); + + while ((inputLine = in.readLine()) != null) { + response.append(inputLine); + } + in.close(); + + return response.toString(); + } + + +} diff --git a/src/main/java/be/bigindustries/klout/Topic.java b/src/main/java/be/bigindustries/klout/Topic.java new file mode 100644 index 0000000..da1905e --- /dev/null +++ b/src/main/java/be/bigindustries/klout/Topic.java @@ -0,0 +1,42 @@ +package be.bigindustries.klout; + +/** + * The topic class stores all the information given by the Klout API + * of a topic. All fields are publicly accessible. + * + * @author Anish Visaria + */ +public class Topic { + + public final String id; + public final String display_name; + public final String name; + public final String slug; + public final String imageUrl; + public final String displayType; + public final String topicType; + + + /** + * Constructs topic object. + * + * @param id + * @param display_name + * @param name + * @param slug + * @param image_url + * @param displayType + * @param topicType + */ + public Topic(String id, String display_name, String name, String slug, String image_url, + String displayType, String topicType) { + this.id = id; + this.display_name = display_name; + this.name = name; + this.slug = slug; + imageUrl = image_url; + this.displayType = displayType; + this.topicType = topicType; + } + +} diff --git a/src/main/java/be/bigindustries/klout/User.java b/src/main/java/be/bigindustries/klout/User.java new file mode 100644 index 0000000..01ba34d --- /dev/null +++ b/src/main/java/be/bigindustries/klout/User.java @@ -0,0 +1,229 @@ +package be.bigindustries.klout; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.node.ArrayNode; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.URL; + +/** + * The User class stores all the information pertaining to a klout id user. + * Each user object has a kloutId, nick name, klout score, and bucket. It also provides + * the day change, week change, and month change of the klout score. With this class + * you can also retrieve the user's topics, influencers, and influencees. + * + * @author Anish Visaria + */ +public class User { + + private String kloutId, nick, bucket; + private double score, dayChange, weekChange, monthChange; + private HttpURLConnection conn; + private String api_key; + private final String USER_AGENT = "Mozilla/5.0"; + + + /** + * Parses JSON of the user given by the klout id and stores in fields. + * + * @param id klout id of user + * @param api_key your api key + * @throws IOException + */ + public User(String id, String api_key) throws IOException { + String content = getContentBody("http://api.klout.com/v2/user.json/" + id + "?key=" + api_key); + this.api_key = api_key; + + ObjectMapper objectMapper = new ObjectMapper(); + JsonNode jsonNode = objectMapper.readTree(content); + + // real parsing starts + kloutId = jsonNode.get("kloutId").textValue(); + nick = jsonNode.get("nick").textValue(); + score = jsonNode.get("score").get("score").asDouble(); + bucket = jsonNode.get("score").get("bucket").textValue(); + + dayChange = jsonNode.get("scoreDeltas").get("dayChange").asDouble(0.0); + weekChange = jsonNode.get("scoreDeltas").get("weekChange").asDouble(0.0); + monthChange = jsonNode.get("scoreDeltas").get("monthChange").asDouble(0.0); + } + + /** + * Returns klout id. + * + * @return klout id + */ + public String kloutid() { + return kloutId; + } + + /** + * Returns nick name of user. + * + * @return nick name + */ + public String nick() { + return nick; + } + + /** + * Returns score. + * + * @return klout score + */ + public double score() { + return score; + } + + /** + * Returns bucket of score. + * + * @return bucket + */ + public String bucket() { + return bucket; + } + + /** + * Returns day change in score. + * + * @return day change + */ + public double dayChange() { + return dayChange; + } + + /** + * Returns week change in score. + * + * @return week change + */ + public double weekChange() { + return weekChange; + } + + /** + * Returns month change in score. + * + * @return month change + */ + public double monthChange() { + return monthChange; + } + + /** + * Retrieves topics of this user. + * + * @return array of topics + * @throws IOException + */ + public Topic[] getTopics() throws IOException { + String content = getContentBody("http://api.klout.com/v2/user.json/" + kloutId + "/topics?key=" + api_key); + + + ObjectMapper objectMapper = new ObjectMapper(); + ArrayNode arrayNode = objectMapper.readValue(content, ArrayNode.class); + + Topic[] t = new Topic[arrayNode.size()]; + + for (int i = 0; i < arrayNode.size(); i++) { + JsonNode jsonNode = arrayNode.get(i); + Topic temp = new Topic(jsonNode.get("id").textValue(), jsonNode.get("displayName").textValue(), + jsonNode.get("name").textValue(), jsonNode.get("slug").textValue(), + jsonNode.get("imageUrl").textValue(), jsonNode.get("displayType").textValue(), + jsonNode.get("topicType").textValue()); + t[i] = temp; + } + + return t; + + } + + + /** + * Returns User[] of influencers. + * + * @return influencers + * @throws IOException + */ + public User[] getInfluencers() throws IOException { + String content = getContentBody("http://api.klout.com/v2/user.json/" + kloutId + "/influence?key=" + api_key); + + ObjectMapper objectMapper = new ObjectMapper(); + JsonNode jsonNode = objectMapper.readTree(content); + + ArrayNode arrayNode = objectMapper.readValue(jsonNode.get("myInfluencers").toString(), ArrayNode.class); + + User[] users = new User[arrayNode.size()]; + + for (int i = 0; i < arrayNode.size(); i++) { + JsonNode ent = arrayNode.get(i).get("entity"); + String id = ent.get("id").textValue(); + User temp = new User(id, api_key); + users[i] = temp; + } + + return users; + } + + + /** + * Returns User[] of influencees. + * + * @return influencees + * @throws IOException + */ + public User[] getInfluencees() throws IOException { + String content = getContentBody("http://api.klout.com/v2/user.json/" + kloutId + "/influence?key=" + api_key); + + ObjectMapper objectMapper = new ObjectMapper(); + JsonNode jsonNode = objectMapper.readTree(content); + + ArrayNode arrayNode = objectMapper.readValue(jsonNode.get("myInfluencees").toString(), ArrayNode.class); + + User[] users = new User[arrayNode.size()]; + + for (int i = 0; i < arrayNode.size(); i++) { + JsonNode ent = arrayNode.get(i).get("entity"); + String id = ent.get("id").textValue(); + User temp = new User(id, api_key); + users[i] = temp; + } + + return users; + } + + + private String getContentBody(String url) throws IOException { + URL obj = new URL(url); + conn = (HttpURLConnection) obj.openConnection(); + + // default is GET + conn.setRequestMethod("GET"); + + conn.setUseCaches(false); + + // act like a browser + conn.setRequestProperty("User-Agent", USER_AGENT); + conn.setRequestProperty("Accept", + "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); + conn.setRequestProperty("Accept-Language", "en-US,en;q=0.5"); + + BufferedReader in = + new BufferedReader(new InputStreamReader(conn.getInputStream())); + String inputLine; + StringBuffer response = new StringBuffer(); + + while ((inputLine = in.readLine()) != null) { + response.append(inputLine); + } + in.close(); + + return response.toString(); + } + +}