Skip to content

Commit

Permalink
Fix user followedBy api (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
yukihirai0505 committed Oct 23, 2017
1 parent 239dbe9 commit 9366660
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
9 changes: 4 additions & 5 deletions src/main/scala/com/yukihirai0505/sInstagram/Instagram.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import com.yukihirai0505.com.scala.model.Response
import com.yukihirai0505.sInstagram.model._
import com.yukihirai0505.sInstagram.responses.auth.{AccessToken, Auth, SignedAccessToken}
import com.yukihirai0505.sInstagram.responses.comments.MediaCommentsFeed
import com.yukihirai0505.sInstagram.responses.common.{NoDataResponse, Pagination}
import com.yukihirai0505.sInstagram.responses.common.{NoDataResponse, Pagination, User}
import com.yukihirai0505.sInstagram.responses.likes.LikesFeed
import com.yukihirai0505.sInstagram.responses.locations.{LocationInfo, LocationSearchFeed}
import com.yukihirai0505.sInstagram.responses.media.{MediaFeed, MediaInfoFeed}
Expand Down Expand Up @@ -386,14 +386,13 @@ class Instagram(auth: Auth) {
/**
* Get the next page for list of 'users' the authenticated is followed by.
*
* @param userId
* @param cursor
*/
def getUserFollowedByList(userId: String, cursor: Option[String] = None): Future[Response[UserFeed]] = {
def getUserFollowedByList(cursor: Option[String] = None): Future[Response[UserFeed]] = {
val params: Map[String, Option[String]] = Map(
QueryParam.CURSOR -> Option(cursor.mkString)
QueryParam.CURSOR -> cursor
)
request(Verbs.GET, Methods.USERS_ID_FOLLOWED_BY format userId, Some(params))
request(Verbs.GET, Methods.USERS_FOLLOWED_BY, Some(params))
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ object Methods {
*
* Required scope: relationships
*/
val USERS_ID_FOLLOWED_BY: String = "/users/%s/followed-by"
val USERS_FOLLOWED_BY: String = "/users/self/followed-by"

/**
* Get information about the current user's relationship
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ class InstagramSpec extends FlatSpec with Matchers {
}

"getUserFollowedByList" should "return a Some[UserFeed]" in {
val request = Await.result(instagram.getUserFollowedByList(userId.getOrElse("")), 10 seconds)
val request = Await.result(instagram.getUserFollowedByList(), 10 seconds)
request should be(anInstanceOf[Response[UserFeed]])
}

Expand Down

0 comments on commit 9366660

Please sign in to comment.