Class: Msn::Contact
- Inherits:
-
Object
- Object
- Msn::Contact
- Defined in:
- lib/msn/contact.rb
Overview
A contact returned from Msn::Messenger#get_contacts.
Instance Attribute Summary collapse
-
#allow ⇒ Object
Is the contact in your allow list?.
-
#block ⇒ Object
Is the contact in your blocked list?.
-
#display_name ⇒ Object
The contact’s display name.
-
#email ⇒ Object
The contact’s email.
-
#pending ⇒ Object
Is the contact in your pending list? (you stil didn’t approve her).
-
#reverse ⇒ Object
Is the contact in your reverse list? (does she has you?).
Instance Method Summary collapse
-
#initialize(email, display_name = nil) ⇒ Contact
constructor
:nodoc:.
-
#to_s ⇒ Object
:nodoc:.
Constructor Details
#initialize(email, display_name = nil) ⇒ Contact
:nodoc:
23 24 25 26 |
# File 'lib/msn/contact.rb', line 23 def initialize(email, display_name = nil) @email = email @display_name = display_name end |
Instance Attribute Details
#allow ⇒ Object
Is the contact in your allow list?
11 12 13 |
# File 'lib/msn/contact.rb', line 11 def allow @allow end |
#block ⇒ Object
Is the contact in your blocked list?
14 15 16 |
# File 'lib/msn/contact.rb', line 14 def block @block end |
#display_name ⇒ Object
The contact’s display name
8 9 10 |
# File 'lib/msn/contact.rb', line 8 def display_name @display_name end |
#email ⇒ Object
The contact’s email
5 6 7 |
# File 'lib/msn/contact.rb', line 5 def email @email end |
#pending ⇒ Object
Is the contact in your pending list? (you stil didn’t approve her)
20 21 22 |
# File 'lib/msn/contact.rb', line 20 def pending @pending end |
#reverse ⇒ Object
Is the contact in your reverse list? (does she has you?)
17 18 19 |
# File 'lib/msn/contact.rb', line 17 def reverse @reverse end |
Instance Method Details
#to_s ⇒ Object
:nodoc:
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/msn/contact.rb', line 29 def to_s if display_name && display_name.length > 0 str = "#{display_name} <#{email}>" else str = "#{email}" end if allow || reverse || pending str << ' (' pieces = [] pieces << 'allow' if allow pieces << 'block' if block pieces << 'reverse' if reverse pieces << 'pending' if pending str << pieces.join(', ') str << ')' end str end |