Class: Fetion::Contact

Inherits:
Object
  • Object
show all
Defined in:
lib/rfetion/contact.rb

Constant Summary collapse

STATUS =
{
  "400" => "在线",
  "300" => "离开",
  "600" => "繁忙",
  "0" => "脱机"
}

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#idObject

Returns the value of attribute id.



4
5
6
# File 'lib/rfetion/contact.rb', line 4

def id
  @id
end

#impresaObject

Returns the value of attribute impresa.



4
5
6
# File 'lib/rfetion/contact.rb', line 4

def impresa
  @impresa
end

#mobile_noObject

Returns the value of attribute mobile_no.



4
5
6
# File 'lib/rfetion/contact.rb', line 4

def mobile_no
  @mobile_no
end

#nicknameObject

Returns the value of attribute nickname.



4
5
6
# File 'lib/rfetion/contact.rb', line 4

def nickname
  @nickname
end

#sidObject

Returns the value of attribute sid.



4
5
6
# File 'lib/rfetion/contact.rb', line 4

def sid
  @sid
end

#statusObject

Returns the value of attribute status.



4
5
6
# File 'lib/rfetion/contact.rb', line 4

def status
  @status
end

#uriObject

Returns the value of attribute uri.



4
5
6
# File 'lib/rfetion/contact.rb', line 4

def uri
  @uri
end

Class Method Details

.parse(c) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/rfetion/contact.rb', line 13

def self.parse(c)
  contact = self.new
  contact.id = c['id']
  p = c.children.first
  contact.sid = p["sid"]
  contact.uri = p["su"]
  contact.mobile_no = p["m"]
  contact.nickname = p["n"]
  contact.impresa = p["i"]
  contact.status = p["b"]
  contact
end