Class: Textecho::Base
- Inherits:
-
Object
- Object
- Textecho::Base
- Defined in:
- lib/textecho/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#input_message ⇒ Object
Returns the value of attribute input_message.
-
#locale ⇒ Object
Returns the value of attribute locale.
-
#msg_source ⇒ Object
Returns the value of attribute msg_source.
-
#output_list ⇒ Object
Returns the value of attribute output_list.
-
#output_message ⇒ Object
Returns the value of attribute output_message.
-
#params ⇒ Object
Returns the value of attribute params.
-
#shortcode ⇒ Object
Returns the value of attribute shortcode.
Instance Method Summary collapse
-
#add_msg(msg) ⇒ Object
@@host= ‘localhost:8083’.
- #debug ⇒ Object
- #disabled_message(locale = nil) ⇒ Object
- #handle_message(src, msg, shortcode, locale = nil, params = {}) ⇒ Object
- #help(resp) ⇒ Object
- #help_prefix ⇒ Object
- #msgs ⇒ Object
- #process ⇒ Object
- #setup ⇒ Object
Instance Attribute Details
#input_message ⇒ Object
Returns the value of attribute input_message.
6 7 8 |
# File 'lib/textecho/base.rb', line 6 def end |
#locale ⇒ Object
Returns the value of attribute locale.
6 7 8 |
# File 'lib/textecho/base.rb', line 6 def locale @locale end |
#msg_source ⇒ Object
Returns the value of attribute msg_source.
6 7 8 |
# File 'lib/textecho/base.rb', line 6 def msg_source @msg_source end |
#output_list ⇒ Object
Returns the value of attribute output_list.
6 7 8 |
# File 'lib/textecho/base.rb', line 6 def output_list @output_list end |
#output_message ⇒ Object
Returns the value of attribute output_message.
6 7 8 |
# File 'lib/textecho/base.rb', line 6 def end |
#params ⇒ Object
Returns the value of attribute params.
6 7 8 |
# File 'lib/textecho/base.rb', line 6 def params @params end |
#shortcode ⇒ Object
Returns the value of attribute shortcode.
6 7 8 |
# File 'lib/textecho/base.rb', line 6 def shortcode @shortcode end |
Instance Method Details
#add_msg(msg) ⇒ Object
@@host= ‘localhost:8083’
39 40 41 42 |
# File 'lib/textecho/base.rb', line 39 def add_msg(msg) self.=msg #update to latest self.output_list << msg end |
#debug ⇒ Object
7 8 9 |
# File 'lib/textecho/base.rb', line 7 def debug false end |
#disabled_message(locale = nil) ⇒ Object
13 14 15 |
# File 'lib/textecho/base.rb', line 13 def (locale=nil) ["Sorry this application (#{self.class.to_s}) is not enabled currently. Please try again later"] end |
#handle_message(src, msg, shortcode, locale = nil, params = {}) ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/textecho/base.rb', line 28 def (src, msg, shortcode,locale=nil,params={}) setup self.locale=locale self.msg_source=src self.shortcode=shortcode self.=msg.downcase self.params=params.clone puts "inspect is #{self.inspect} " if debug process() end |
#help(resp) ⇒ Object
23 24 25 26 27 |
# File 'lib/textecho/base.rb', line 23 def help(resp) raise "help response needs to be hash" if !resp.is_a? Hash self.locale="en" if !resp.keys.include? self.locale # set locale to english if not proper return self.help_prefix + resp[self.locale] end |
#help_prefix ⇒ Object
20 21 22 |
# File 'lib/textecho/base.rb', line 20 def help_prefix "Help Message: " end |
#msgs ⇒ Object
10 11 12 |
# File 'lib/textecho/base.rb', line 10 def msgs self.output_list end |
#process ⇒ Object
43 44 45 46 47 48 |
# File 'lib/textecho/base.rb', line 43 def process() self.="[#{self.input_message}] from #{self.msg_source} rcvd on #{self.shortcode}" puts "outbound message is "+ self. if debug self.add_msg(self.) self.output_list #should return arrayge of mesages end |
#setup ⇒ Object
17 18 19 |
# File 'lib/textecho/base.rb', line 17 def setup self.output_list = [] end |