-
Notifications
You must be signed in to change notification settings - Fork 2
/
dm.scala
35 lines (35 loc) · 874 Bytes
/
dm.scala
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package org.scala_twitter
import scala.xml._
/**
* Direct Message holder
*/
class DM extends Tweet
{
override def parse(xml:Node):Unit =
{
created_at = (xml \ "created_at").text
msg_id = (xml \ "id").text.toLong
text = (xml \ "text").text
user_id = (xml \ "sender" \ "id").text.toInt
user_name = (xml \ "sender" \ "name").text
screen_name = (xml \ "sender" \ "screen_name").text
location = (xml \ "sender" \ "location").text
user_description = (xml \ "sender" \ "user_description").text
profile_image_url = (xml \ "sender" \ "profile_image_url").text
user_url = (xml \ "sender" \ "url").text
user_protected= (xml \ "sender" \ "protected").text.toBoolean
followers_count = (xml \ "sender" \ "followers_count").text.toInt
}
}
/**
* Companion factory object
*/
object DM
{
def apply(x:Node):DM =
{
var i = new DM
i.parse(x)
return i
}
}