Skip to content

Instantly share code, notes, and snippets.

@jackywyz
Created August 24, 2011 02:45
Show Gist options
  • Save jackywyz/1167184 to your computer and use it in GitHub Desktop.
Save jackywyz/1167184 to your computer and use it in GitHub Desktop.
userTimeline
val statusListBuffer = new ListBuffer[Status]
def userTimeline(options : OptionalParam*) : List[Status] =
{
val optionsStr = new StringBuffer("?")
for (n <- (responseXML \\ "status").elements)
statusListBuffer += (Status.fromXml(n))
statusListBuffer.toList
}
}
abstract class Status
{
val createdAt : String
val id : Long
val text : String
val source : String
val truncated : Boolean
val inReplyToStatusId : Option[Long]
val inReplyToUserId : Option[Long]
val inReplyToScreenName : Option[String]
val favorited : Boolean
val user : User
}
object Status
{
def fromXml(node : Node) : Status =
{
new Status {
val createdAt = (node \ "created_at").text
....
}
}
}
@brantYan
Copy link

对不起,我犯了个错误。。。

val statusListBuffer = new ListBuffer[Status]

 for (n <- (responseXML \\ "status").elements)
   statusListBuffer += (Status.fromXml(n))

statusListBuffer.toList

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment