Class: Adhearsion::VoIP::Asterisk::ConfigFileGenerators::Voicemail::EmailDefinition
Constant Summary
collapse
- EMAIL_VARIABLE_CONVENIENCES =
{
:name => '${VM_NAME}',
:duration => '${VM_DUR}',
:message_number => '${VM_MSGNUM}',
:mailbox => '${VM_MAILBOX}',
:caller_id => '${VM_CALLERID}',
:date => '${VM_DATE}',
:caller_id_number => '${VM_CIDNUM}',
:caller_id_name => '${VM_CIDNAME}'
}
AsteriskConfigGenerator::SECTION_TITLE
Instance Attribute Summary collapse
Instance Method Summary
collapse
create_sanitary_hash_from, #to_sanitary_hash, warning_message
Constructor Details
Returns a new instance of EmailDefinition.
158
159
160
161
|
# File 'lib/adhearsion/voip/asterisk/config_generators/voicemail.conf.rb', line 158
def initialize
@properties = {}
super
end
|
Instance Attribute Details
#properties ⇒ Object
Returns the value of attribute properties.
157
158
159
|
# File 'lib/adhearsion/voip/asterisk/config_generators/voicemail.conf.rb', line 157
def properties
@properties
end
|
Instance Method Details
#[](email_variable) ⇒ Object
163
164
165
166
167
168
169
|
# File 'lib/adhearsion/voip/asterisk/config_generators/voicemail.conf.rb', line 163
def [](email_variable)
if EMAIL_VARIABLE_CONVENIENCES.has_key? email_variable
EMAIL_VARIABLE_CONVENIENCES[email_variable]
else
raise ArgumentError, "Unrecognized variable #{email_variable.inspect}"
end
end
|
#attach_recordings(true_or_false) ⇒ Object
181
182
183
|
# File 'lib/adhearsion/voip/asterisk/config_generators/voicemail.conf.rb', line 181
def attach_recordings(true_or_false)
boolean :attach => true_or_false
end
|
#attach_recordings? ⇒ Boolean
185
186
187
|
# File 'lib/adhearsion/voip/asterisk/config_generators/voicemail.conf.rb', line 185
def attach_recordings?
properties[:attach] == 'yes'
end
|
#body(str) ⇒ Object
189
190
191
192
193
194
195
196
|
# File 'lib/adhearsion/voip/asterisk/config_generators/voicemail.conf.rb', line 189
def body(str)
str = str.gsub("\r", '').gsub("\n", '\n')
if str.length > 512
raise ArgumentError, "Asterisk has an email body limit of 512 characters! Your body is too long!\n" +
("-" * 10) + "\n" + str
end
string :emailbody => str
end
|
#command(cmd) ⇒ Object
202
203
204
|
# File 'lib/adhearsion/voip/asterisk/config_generators/voicemail.conf.rb', line 202
def command(cmd)
string :mailcmd => cmd
end
|
171
172
173
|
# File 'lib/adhearsion/voip/asterisk/config_generators/voicemail.conf.rb', line 171
def disable!
raise NotImpementedError
end
|
#from(options) ⇒ Object
175
176
177
178
179
|
# File 'lib/adhearsion/voip/asterisk/config_generators/voicemail.conf.rb', line 175
def from(options)
name, email = options.values_at :name, :email
string :serveremail => email
string :fromstring => name
end
|
#subject(str) ⇒ Object
198
199
200
|
# File 'lib/adhearsion/voip/asterisk/config_generators/voicemail.conf.rb', line 198
def subject(str)
string :emailsubject => str
end
|