Class: OStatus::PortableContacts

Inherits:
Object
  • Object
show all
Defined in:
lib/ostatus/portable_contacts.rb

Overview

Holds information about the extended contact information in the Feed given in the Portable Contacts specification.

Instance Method Summary collapse

Constructor Details

#initialize(parent) ⇒ PortableContacts

Instantiates a OStatus::PortableContacts object from either a given root that contains all <poco:*> tags as an ratom Person

or a Hash containing the properties.


11
12
13
14
15
16
17
# File 'lib/ostatus/portable_contacts.rb', line 11

def initialize(parent)
  if parent.is_a? Hash
    @options = parent
  else
    @parent = parent
  end
end

Instance Method Details

#anniversaryObject



49
# File 'lib/ostatus/portable_contacts.rb', line 49

def anniversary; get_date(:anniversary); end

#birthdayObject



48
# File 'lib/ostatus/portable_contacts.rb', line 48

def birthday;    get_date(:birthday); end

#connectedObject

Returns a boolean that indicates that a bi-directional connection has been established between the user and the contact, if it is able to assert this.



54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/ostatus/portable_contacts.rb', line 54

def connected
  return @options[:connected] unless @options.nil?
  str = @parent.poco_connected

  if str == "true"
    true
  elsif str == "false"
    false
  else
    nil
  end
end

#display_nameObject



34
# File 'lib/ostatus/portable_contacts.rb', line 34

def display_name;         get_prop(:display_name, 'displayName'); end

#display_name=(value) ⇒ Object



35
# File 'lib/ostatus/portable_contacts.rb', line 35

def display_name= value;  set_prop(:display_name, value, 'displayName'); end

#genderObject



28
# File 'lib/ostatus/portable_contacts.rb', line 28

def gender;               get_prop(:gender); end

#gender=(value) ⇒ Object



29
# File 'lib/ostatus/portable_contacts.rb', line 29

def gender= value;        set_prop(:gender, value); end

#idObject



19
# File 'lib/ostatus/portable_contacts.rb', line 19

def id;                   get_prop(:id); end

#id=(value) ⇒ Object



20
# File 'lib/ostatus/portable_contacts.rb', line 20

def id= value;            set_prop(:id, value); end

#nameObject



22
# File 'lib/ostatus/portable_contacts.rb', line 22

def name;                 get_prop(:name); end

#name=(value) ⇒ Object



23
# File 'lib/ostatus/portable_contacts.rb', line 23

def name= value;          set_prop(:name, value); end

#nicknameObject



25
# File 'lib/ostatus/portable_contacts.rb', line 25

def nickname;             get_prop(:nickname); end

#nickname=(value) ⇒ Object



26
# File 'lib/ostatus/portable_contacts.rb', line 26

def nickname= value;      set_prop(:nickname, value); end

#noteObject



31
# File 'lib/ostatus/portable_contacts.rb', line 31

def note;                 get_prop(:note); end

#note=(value) ⇒ Object



32
# File 'lib/ostatus/portable_contacts.rb', line 32

def note= value;          set_prop(:note, value); end

#preferred_usernameObject



37
38
39
# File 'lib/ostatus/portable_contacts.rb', line 37

def preferred_username         
  get_prop(:preferred_username, 'preferredUsername')
end

#preferred_username=(value) ⇒ Object



41
42
43
# File 'lib/ostatus/portable_contacts.rb', line 41

def preferred_username= value
  set_prop(:preferred_username, value, 'preferredUsername')
end

#publishedObject



46
# File 'lib/ostatus/portable_contacts.rb', line 46

def published; get_datetime(:published); end

#updatedObject



45
# File 'lib/ostatus/portable_contacts.rb', line 45

def updated;   get_datetime(:updated); end