Sha256: 59f349df500a3788fbb83d21abba48b939fd9f4cd35fad80da582c735533f162
Contents?: true
Size: 813 Bytes
Versions: 8
Compression:
Stored size: 813 Bytes
Contents
module Messenger module Bot class Receiver def self.share(data) messaging_events = data["entry"].first["messaging"] messaging_events.each_with_index do |event, key| if event["message"] && !defined?(message).nil? self.class.send(:message, event) elsif event["postback"] && !defined?(postback).nil? self.class.send(:postback, event) elsif event["delivery"] && !defined?(delivery).nil? self.class.send(:delivery, event) end end end def self.define_event(event, &block) self.class.instance_eval do define_method(event.to_sym) do |event| yield(event, Messenger::Bot::Transmitter.new(event["sender"]["id"])) end end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems