A scala wrapper for the linkedin REST APIs.
This makes using the LinkedIn REST APIs easier.
It uses scribe for oauth internally, and handles the authentication, request signing, parsing requests,
and returns scala objects in scala collections.
(Note, uses the great scribe-java library from https://github.com/fernandezpablo85/scribe-java)
If you want an overview, see the presentation at: http://prezi.com/1y9kflmo2wnz/scalali/
So far the APIs supported include:
- Authentication
- Profile
- Connections
- Voldemort API
A snippet from: src/scripts/demo.scala
import com.dragade.scalali._
val scalali = new ScalaLi(apiKey, secretKey)
val (url, requestToken) = scalali.initialize()
val accessToken = scalali.verify(requestToken,verifier)
val myProfile = scalali.myProfile(accessToken)
myProfile match {
case None => println(“No profile found for you!”)
case Some(p) => println(“Name: %s %s”.format(p.firstName, p.lastName))
}
//partition connections into those with pics&headlines and those without
val conns = scalali.myConnections(accessToken)
val (complete, incomplete) = conns.partition(p => p.picture.isDefined && p.headline.isDefined)
complete.foreach(p => println(“Name:%s %s\t%s\t%s”.format(p.firstName, p.lastName, p.headline.get, p.picture.get)))
First get your API keys from http://developer.linkedin.com
You can edit demo.scala to use them for playing with the demo, but otherwise you’ll pass these
into ScalaLi
Then get sbt 0.11.0
from https://github.com/harrah/xsbt
Follow the instructions for creating the sbt runner script:
https://github.com/harrah/xsbt/wiki/Setup
sbt
The first time you run sbt it will download its own copy of scala 2.9.1, plus other stuff it needs.
This is separate from the version of scala you’re using yourself. Don’t worry about it.
First create a file called ~/.sbt/plugins/build.sbt
with:
resolvers += “sbt-idea-repo” at “http://mpeltonen.github.com/maven/”
addSbtPlugin(“com.github.mpeltonen” % “sbt-idea” % “0.11.0”)
Once you’re in sbt, you can do:
> gen-idea
this will generate the .idea files and you can then open the project in IntelliJ.
If you have the sbt plugin in IntelliJ, you can just click the green play button
to start up sbt in IntelliJ.
> compile
> console
scala> :load src/scripts/demo.scala
the jar is target/scala-2.9.1/scalali_2.9.1-1.0.jar