Class: AdobeConnect::TelephonyProfile

Inherits:
Base
  • Object
show all
Defined in:
lib/adobe_connect/telephony_profile.rb

Overview

Public: Represents a Group in a Connect environment.

Instance Attribute Summary collapse

Attributes inherited from Base

#errors, #id, #service

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#ac_obj_node_name, #ac_obj_type, create, #delete, #delete_method_prefix, #initialize, #method_prefix, #permissions_update, #save, #save_errors, #set_attrs, #update_attributes

Constructor Details

This class inherits a constructor from AdobeConnect::Base

Instance Attribute Details

#conf_numberObject

Returns the value of attribute conf_number.



5
6
7
# File 'lib/adobe_connect/telephony_profile.rb', line 5

def conf_number
  @conf_number
end

#locationObject

Returns the value of attribute location.



5
6
7
# File 'lib/adobe_connect/telephony_profile.rb', line 5

def location
  @location
end

#nameObject

Returns the value of attribute name.



5
6
7
# File 'lib/adobe_connect/telephony_profile.rb', line 5

def name
  @name
end

#principal_idObject

Returns the value of attribute principal_id.



5
6
7
# File 'lib/adobe_connect/telephony_profile.rb', line 5

def principal_id
  @principal_id
end

#provider_idObject

Returns the value of attribute provider_id.



5
6
7
# File 'lib/adobe_connect/telephony_profile.rb', line 5

def provider_id
  @provider_id
end

#statusObject

Returns the value of attribute status.



5
6
7
# File 'lib/adobe_connect/telephony_profile.rb', line 5

def status
  @status
end

Class Method Details

.configObject



46
47
48
49
# File 'lib/adobe_connect/telephony_profile.rb', line 46

def self.config
  super.merge({ :ac_obj_type => 'profile', :delete_method_is_plural => false,
    :ac_obj_node_name => 'telephony-profile', :ac_method_prefix => 'telephony_profile' })
end

.find_by_name(name, principal_id = nil, service = AdobeConnect::Service.new) ⇒ Object

Public: Find the specified profile on the Connect server.

name - Profile’s name on Connect server principal_id - ID of user on Connect server that the Telephony

Profile belongs to. Will use API user by default.

Returns an AdobeConnect::TelephonyProfile or nil.



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/adobe_connect/telephony_profile.rb', line 58

def self.find_by_name(name, principal_id = nil, service = AdobeConnect::Service.new)
  params = {}
  params.merge!(:principal_id => principal_id) unless principal_id.nil?

  response = service.telephony_profile_list(params)

  matching_profiles = response.at_xpath('//telephony-profiles').children.select{|c|
    name_node = c.children.select{|ch| ch.name == 'profile-name' }[0]
    name_node.text == name
  }

  if matching_profiles.count == 1
    prof_id = matching_profiles[0].attr('profile-id')
    resp = service.telephony_profile_info(:profile_id => prof_id)
    self.load_from_xml(resp.at_xpath('//telephony-profile'), principal_id)
  end
end

.load_from_xml(p, principal_id) ⇒ Object (private)



77
78
79
80
81
82
83
84
85
# File 'lib/adobe_connect/telephony_profile.rb', line 77

def self.load_from_xml(p, principal_id)
  self.new({
      :name => p.at_xpath('//profile-name').text,
      :id => p.attr('profile-id'),
      :status => p.attr('profile-status'),
      :principal_id => principal_id,
      :provider_id => p.attr('provider-id')
    })
end

Instance Method Details

#attrsObject

telephony_profile_options - A hash with the following keys:

name        - The profile's name.
status      - Status of the profile (enabled or disabled)
conf_number - Conference number associated with profile
location    - Country code for conference number, required
              if conf_number present
principal_id- ID of User that the profile should belong
              to, defaults to logged in user
provider_id - ID of the telephony provider


20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/adobe_connect/telephony_profile.rb', line 20

def attrs
  atrs = { :profile_name => self.name }

  if !self.id.nil?
    atrs.merge!(:profile_id => self.id)
  end

  [:id, :status].each do |atr|
    if !self.send(atr).nil?
      atrs.merge!("profile_#{atr}".to_sym => self.send(atr))
    end
  end

  [:principal_id, :provider_id].each do |atr|
    if !self.send(atr).nil?
      atrs.merge!(atr => self.send(atr))
    end
  end

  if !self.conf_number.nil? && !self.location.nil?
    atrs.merge!(:conf_number => self.conf_number, :location => self.location)
  end

  atrs
end