Class: Kogno::MessengerCtl

Inherits:
Object
  • Object
show all
Defined in:
lib/core/bin_helpers/messenger_ctl.rb

Class Method Summary collapse

Class Method Details

.options(a) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/core/bin_helpers/messenger_ctl.rb', line 5

def options(a)
  page_id = a[3] rescue nil
  case (a[1].to_sym rescue nil)
    when :menu
      if a[2] == 'on'
        Kogno::Messenger::Api.persistent_menu(page_id)
      elsif a[2] == 'off'
        Kogno::Messenger::Api.setting_delete([:persistent_menu])
      end
    when :get_started
      if a[2] == 'on'
        Kogno::Messenger::Api.get_started_button(page_id)
      elsif a[2] == 'off'
        Kogno::Messenger::Api.setting_delete([:get_started], page_id)
      end
    when :update_whitelisted_domains
      Kogno::Messenger::Api.update_whitelisted_domains
    when :ice_breakers
      if a[2] == 'on'
        Kogno::Messenger::Api.ice_breakers()
      elsif a[2] == 'off'
        Kogno::Messenger::Api.setting_delete([:ice_breakers])
      end          
    when :greeting
      if a[2] == 'on'
        Kogno::Messenger::Api.greeting()
      elsif a[2] == 'off'
        Kogno::Messenger::Api.setting_delete([:greting])
      end         
    else
      puts %{Usage: 
        kogno messenger 
            menu on|off
            get_started on|off
            greeting on|off
            ice_breakers on|off                
            update_whitelisted_domains
      }      
  end
end