Sha256: fcb7941f55d959a68eb2c77fc4f7d78ec1852554bff1f6e8990ba3c33be2aad3
Contents?: true
Size: 614 Bytes
Versions: 1
Compression:
Stored size: 614 Bytes
Contents
require 'pleiades' class Line::ApiController < ApplicationController def client @client ||= Line::Bot::Client.new { |config| config.channel_secret = ENV["LINE_CHANNEL_SECRET"] config.channel_token = ENV["LINE_CHANNEL_TOKEN"] } end def callback body = request.body.read signature = request.env['HTTP_X_LINE_SIGNATURE'] client.validate_signature(body, signature) || head(:bad_request) events = client.parse_events_from(body) events.each do |event| command = Pleiades::Command.get(event) command.call head :ok if command.success? end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pleiades-0.1.1 | lib/pleiades/generators/pleiades/setup/templates/api_controller.rb |