diff options
author | Peter Kozak <spag@golwen.net> | 2013-03-13 10:03:39 -0400 |
---|---|---|
committer | Peter Kozak <spag@golwen.net> | 2013-03-13 10:03:39 -0400 |
commit | d2cfd8203e0108db3b49d10a7ca3990f49667a9e (patch) | |
tree | bda25a43321b871f6fa2f27fc04d5a9a5d149dd6 | |
parent | 3e1092b532d34141d77f1e9176831e2bf82845ac (diff) |
list_members method added
-rw-r--r-- | app/models/conference.rb | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/app/models/conference.rb b/app/models/conference.rb index 6c89d60..880b958 100644 --- a/app/models/conference.rb +++ b/app/models/conference.rb @@ -49,9 +49,27 @@ class Conference < ActiveRecord::Base def to_s name end + + def list_conference + require 'freeswitch_event' + result = FreeswitchAPI.api_result(FreeswitchAPI.api('conference', "conference#{self.id}", 'xml_list')) + if result =~ /^\<\?xml/ + return Hash.from_xml(result) + end + return nil + end + + def list_members + data = self.list_conference + if data.blank? + return {} + end + + return data.fetch('conferences',{}).fetch('conference',{}).fetch('members',{}).fetch('member',{}) + end + private - def start_and_end_dates_must_make_sense errors.add(:end, 'must be later than the start') if self.end < self.start end |