Class: Telephony::CallCenter

Inherits:
Object
  • Object
show all
Defined in:
app/models/telephony/call_center.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ CallCenter

Returns a new instance of CallCenter.



19
20
21
22
23
24
# File 'app/models/telephony/call_center.rb', line 19

def initialize opts
  @name = opts['name']
  @host = opts['host']
  @username = opts['username']
  @password = opts['password']
end

Instance Attribute Details

#hostObject (readonly)

Returns the value of attribute host.



5
6
7
# File 'app/models/telephony/call_center.rb', line 5

def host
  @host
end

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'app/models/telephony/call_center.rb', line 5

def name
  @name
end

#passwordObject (readonly)

Returns the value of attribute password.



5
6
7
# File 'app/models/telephony/call_center.rb', line 5

def password
  @password
end

#usernameObject (readonly)

Returns the value of attribute username.



5
6
7
# File 'app/models/telephony/call_center.rb', line 5

def username
  @username
end

Class Method Details

.allObject



11
12
13
# File 'app/models/telephony/call_center.rb', line 11

def self.all
  @config.map { |entry| new entry }
end

.find_by_name(name) ⇒ Object



15
16
17
# File 'app/models/telephony/call_center.rb', line 15

def self.find_by_name name
  all.detect { |call_center| call_center.name == name }
end

.load(rails_env, config_path = 'config/call_centers.yml') ⇒ Object



7
8
9
# File 'app/models/telephony/call_center.rb', line 7

def self.load rails_env, config_path = 'config/call_centers.yml'
  @config ||= YAML.load_file(config_path)[rails_env]
end