Class: Elastix::Extension
Instance Attribute Summary collapse
-
#devinfo_secret ⇒ Object
Returns the value of attribute devinfo_secret.
-
#extension ⇒ Object
Returns the value of attribute extension.
-
#name ⇒ Object
Returns the value of attribute name.
-
#outboundcid ⇒ Object
Returns the value of attribute outboundcid.
-
#record_in ⇒ Object
Returns the value of attribute record_in.
-
#record_out ⇒ Object
Returns the value of attribute record_out.
-
#sipname ⇒ Object
Returns the value of attribute sipname.
Class Method Summary collapse
Instance Method Summary collapse
- #==(extension) ⇒ Object
- #destroy ⇒ Object
-
#initialize(params) ⇒ Extension
constructor
A new instance of Extension.
- #save ⇒ Object
- #to_hash ⇒ Object
- #update_attributes(params) ⇒ Object
Methods inherited from Base
close_db_connection, establish_connection, establish_db_connection, establish_web_connection, reload, web_connected?
Constructor Details
#initialize(params) ⇒ Extension
Returns a new instance of Extension.
5 6 7 |
# File 'lib/elastix/extension.rb', line 5 def initialize params params.each_pair{|key,value| instance_variable_set "@#{key}", value} end |
Instance Attribute Details
#devinfo_secret ⇒ Object
Returns the value of attribute devinfo_secret.
3 4 5 |
# File 'lib/elastix/extension.rb', line 3 def devinfo_secret @devinfo_secret end |
#extension ⇒ Object
Returns the value of attribute extension.
3 4 5 |
# File 'lib/elastix/extension.rb', line 3 def extension @extension end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/elastix/extension.rb', line 3 def name @name end |
#outboundcid ⇒ Object
Returns the value of attribute outboundcid.
3 4 5 |
# File 'lib/elastix/extension.rb', line 3 def outboundcid @outboundcid end |
#record_in ⇒ Object
Returns the value of attribute record_in.
3 4 5 |
# File 'lib/elastix/extension.rb', line 3 def record_in @record_in end |
#record_out ⇒ Object
Returns the value of attribute record_out.
3 4 5 |
# File 'lib/elastix/extension.rb', line 3 def record_out @record_out end |
#sipname ⇒ Object
Returns the value of attribute sipname.
3 4 5 |
# File 'lib/elastix/extension.rb', line 3 def sipname @sipname end |
Class Method Details
.all ⇒ Object
48 49 50 51 52 |
# File 'lib/elastix/extension.rb', line 48 def self.all Sip.uniq.pluck(:id).map do |extension| get_extension_object(extension) if exist?(extension) end end |
.create(params) ⇒ Object
42 43 44 45 46 |
# File 'lib/elastix/extension.rb', line 42 def self.create params e = Extension.new(params) e.save e end |
.find(extension) ⇒ Object
38 39 40 |
# File 'lib/elastix/extension.rb', line 38 def self.find extension get_extension_object(extension) if exist?(extension) end |
Instance Method Details
#==(extension) ⇒ Object
29 30 31 |
# File 'lib/elastix/extension.rb', line 29 def == extension self.to_hash == extension.to_hash end |
#destroy ⇒ Object
9 10 11 12 |
# File 'lib/elastix/extension.rb', line 9 def destroy @@elastix.get("#{@@base_address}/config.php?type=setup&display=extensions&extdisplay=#{self.extension}&action=del") Base.reload end |
#save ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/elastix/extension.rb', line 14 def save if Extension.exist? extension update_extension_object else new_extension_object end Base.reload end |
#to_hash ⇒ Object
33 34 35 |
# File 'lib/elastix/extension.rb', line 33 def to_hash Hash[self.instance_variables.map{|var| [var.to_s.delete("@"), self.instance_variable_get(var)]}] end |