Class: Adhearsion::VoIP::Asterisk::ConfigFileGenerators::Voicemail::ContextDefinition::MailboxDefinition

Inherits:
Object
  • Object
show all
Defined in:
lib/adhearsion/voip/asterisk/config_generators/voicemail.conf.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(mailbox_number) ⇒ MailboxDefinition

Returns a new instance of MailboxDefinition.



108
109
110
111
112
113
# File 'lib/adhearsion/voip/asterisk/config_generators/voicemail.conf.rb', line 108

def initialize(mailbox_number)
  check_numeric mailbox_number
  @mailbox_number = mailbox_number
  @definition = {}
  super()
end

Instance Attribute Details

#mailbox_numberObject (readonly)

Returns the value of attribute mailbox_number.



107
108
109
# File 'lib/adhearsion/voip/asterisk/config_generators/voicemail.conf.rb', line 107

def mailbox_number
  @mailbox_number
end

Instance Method Details

#email(str) ⇒ Object



124
125
126
# File 'lib/adhearsion/voip/asterisk/config_generators/voicemail.conf.rb', line 124

def email(str)
  @definition[:email] = str
end

#name(str) ⇒ Object



120
121
122
# File 'lib/adhearsion/voip/asterisk/config_generators/voicemail.conf.rb', line 120

def name(str)
  @definition[:name] = str
end

#pin_number(number) ⇒ Object



115
116
117
118
# File 'lib/adhearsion/voip/asterisk/config_generators/voicemail.conf.rb', line 115

def pin_number(number)
  check_numeric number
  @definition[:pin_number] = number
end

#to_hashObject



128
129
130
# File 'lib/adhearsion/voip/asterisk/config_generators/voicemail.conf.rb', line 128

def to_hash
  @definition
end

#to_sObject



132
133
134
# File 'lib/adhearsion/voip/asterisk/config_generators/voicemail.conf.rb', line 132

def to_s
  %(#{mailbox_number} => #{@definition[:pin_number]},#{@definition[:name]},#{@definition[:email]})[/^(.+?),*$/,1]
end