Skip to content

Commit

Permalink
version as int
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathan Hamblen committed Feb 22, 2009
1 parent c5a17b7 commit 20d1a3a
Showing 1 changed file with 14 additions and 4 deletions.
Expand Up @@ -4,24 +4,34 @@ trait Times {
lazy val http = new Http("api.nytimes.com")
val api_key: String
val service: String
val version: String
val version: Int

def exec(action: String, params: Map[String, Any]) =
http("/svc/" + service + "/" + version + action) ?< (params + ("api-key" -> api_key))
http(
("/svc" :: service :: "v" + version :: action :: Nil).mkString("/")
) ?< (params + ("api-key" -> api_key))

def exec(action: String): Http#Request = exec(action, Map[String, Any]())
}

case class People(api_key: String) extends Times {
val service = "timespeople/api";
val version = "v1"
val version = 1

def profile(user_id: Int) = exec("/user/" + user_id + "/profile.js");
}

case class Search(api_key: String) extends Times {
val service = "search"
val version = "v1"
val version = 1

def search(query: String) = exec("/article", Map("query" -> query))
}

case class Community(api_key: String) extends Times {
val service = "community"
val version = 2

def recent = exec("comments/recent.json")
}

0 comments on commit 20d1a3a

Please sign in to comment.