Class: Lotus::Atom::Organization
- Inherits:
-
Object
- Object
- Lotus::Atom::Organization
- Includes:
- Atom::Xml::Parseable
- Defined in:
- lib/lotus/atom/organization.rb
Overview
This class represents an PortableContacts Organization object.
Constant Summary collapse
- POCO_NAMESPACE =
The XML namespace the specifies this content.
'http://portablecontacts.net/spec/1.0'
Instance Method Summary collapse
-
#initialize(o = {}) {|_self| ... } ⇒ Organization
constructor
A new instance of Organization.
- #to_canonical ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(o = {}) {|_self| ... } ⇒ Organization
Returns a new instance of Organization.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/lotus/atom/organization.rb', line 23 def initialize(o = {}) case o when XML::Reader o.read parse(o) when Hash o.each do |k, v| if k.to_s.include? '_' k = k.to_s.gsub(/_(.)/){"#{$1.upcase}"}.intern end self.send("#{k.to_s}=", v) end else raise ArgumentError, "Got #{o.class} but expected a Hash or XML::Reader" end yield(self) if block_given? end |
Instance Method Details
#to_canonical ⇒ Object
55 56 57 |
# File 'lib/lotus/atom/organization.rb', line 55 def to_canonical to_hash end |
#to_hash ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/lotus/atom/organization.rb', line 42 def to_hash { :name => self.name, :department => self.department, :title => self.title, :type => self.type, :start_date => self.startDate, :end_date => self.endDate, :location => self.location, :description => self.description } end |