Module: Rubotnik
- Defined in:
- lib/rubotnik.rb,
lib/rubotnik/cli.rb,
lib/rubotnik/helpers.rb,
lib/rubotnik/version.rb,
lib/rubotnik/autoloader.rb,
lib/rubotnik/message_dispatch.rb,
lib/rubotnik/postback_dispatch.rb
Defined Under Namespace
Modules: Autoloader, Helpers
Classes: CLI, Generator, MessageDispatch, PostbackDispatch
Constant Summary
collapse
- VERSION =
"0.2.0"
Class Method Summary
collapse
Class Method Details
.route(event, &block) ⇒ Object
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/rubotnik.rb', line 25
def self.route(event, &block)
Bot.on(event, &block) unless [:message, :postback].include?(event)
Bot.on event do |e|
case e
when Facebook::Messenger::Incoming::Message
Rubotnik::MessageDispatch.new(e).route(&block)
when Facebook::Messenger::Incoming::Postback
Rubotnik::PostbackDispatch.new(e).route(&block)
end
end
end
|
.set_profile(*payloads) ⇒ Object
37
38
39
40
41
|
# File 'lib/rubotnik.rb', line 37
def self.set_profile(*payloads)
payloads.each do |payload|
Facebook::Messenger::Profile.set(payload, access_token: ENV['ACCESS_TOKEN'])
end
end
|
.subscribe(token) ⇒ Object
21
22
23
|
# File 'lib/rubotnik.rb', line 21
def self.subscribe(token)
Facebook::Messenger::Subscriptions.subscribe(access_token: token)
end
|