esme-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vdic...@apache.org
Subject svn commit: r979025 - /incubator/esme/trunk/server/src/main/scala/org/apache/esme/api/TwitterAPI.scala
Date Sun, 25 Jul 2010 11:38:10 GMT
Author: vdichev
Date: Sun Jul 25 11:38:10 2010
New Revision: 979025

URL: http://svn.apache.org/viewvc?rev=979025&view=rev
Log:
ESME-213 Creating and destroying a friendship relation now works with user_id parameter

Modified:
    incubator/esme/trunk/server/src/main/scala/org/apache/esme/api/TwitterAPI.scala

Modified: incubator/esme/trunk/server/src/main/scala/org/apache/esme/api/TwitterAPI.scala
URL: http://svn.apache.org/viewvc/incubator/esme/trunk/server/src/main/scala/org/apache/esme/api/TwitterAPI.scala?rev=979025&r1=979024&r2=979025&view=diff
==============================================================================
--- incubator/esme/trunk/server/src/main/scala/org/apache/esme/api/TwitterAPI.scala (original)
+++ incubator/esme/trunk/server/src/main/scala/org/apache/esme/api/TwitterAPI.scala Sun Jul
25 11:38:10 2010
@@ -94,7 +94,11 @@ abstract class TwitterAPI {
     case Req(ApiPath ::> "statuses" ::> "retweeted_to_me", this.method, GetRequest)
=> () => timeline(ToMe)
 
     case Req(ApiPath ::> "friendships" ::> "create" ::> last, this.method, PostRequest)
=> () => createFriendship(last)
+    case Req(ApiPath ::> "friendships" ::> "create", this.method, PostRequest)
+      if S.param("user_id").isDefined => createFriendship
     case Req(ApiPath ::> "friendships" ::> "destroy" ::> last, this.method, PostRequest)
=> () => destroyFriendship(last)
+    case Req(ApiPath ::> "friendships" ::> "destroy", this.method, PostRequest)
+      if S.param("user_id").isDefined => destroyFriendship
     case Req(ApiPath ::> "friendships" ::> "exists", this.method, GetRequest) =>
existsFriendship
 
     case Req(ApiPath ::> "account" ::> "verify_credentials", this.method, GetRequest)
=> verifyCredentials
@@ -286,6 +290,12 @@ abstract class TwitterAPI {
     }
   }
   
+  def createFriendship(): Box[TwitterResponse] = {
+    for (user_id <- S.param("user_id");
+         response <- createFriendship(user_id))
+    yield response
+  }
+  
   def destroyFriendship(other: String): Box[TwitterResponse] = {
     for (user <- calcUser;
          other <- User.findFromWeb(other) ?~ S.?("base_twitter_api_err_user_not_found"))
@@ -296,6 +306,12 @@ abstract class TwitterAPI {
         Right(Map("hash" -> Map("error" -> S.?("base_twitter_api_err_user_not_unfollow"))))
     }
   }
+
+  def destroyFriendship(): Box[TwitterResponse] = {
+    for (user_id <- S.param("user_id");
+         response <- destroyFriendship(user_id))
+    yield response
+  }
   
   def existsFriendship(): Box[TwitterResponse] = {
     for (req <- S.request;



Mime
View raw message