Sha256: 92e107edc8e24c1676969d2ceb8d01edf9846b456cbed26e47a795a7dd3db4dc

Contents?: true

Size: 498 Bytes

Versions: 6

Compression:

Stored size: 498 Bytes

Contents

require 'sinatra'
require 'nokogiri'

get '/' do
  params[:echostr]
end

post '/' do
  request.body.rewind
  weixin_params = WeiBackend::Utils.parse_params request.body.read
  handler = WeiBackend::MessageDispatcher.new
  results = handler.on weixin_params[:MsgType], weixin_params

  haml results[:format].to_sym, :views => File.dirname(__FILE__)+'/wei-templates', :locals => results[:model]
end

helpers do
  def cdata content
    "<![CDATA[#{content}]]>"
  end
end

extend WeiBackend::Delegator

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
wei-backend-0.0.6 lib/wei-backend/main.rb
wei-backend-0.0.5 lib/wei-backend/main.rb
wei-backend-0.0.4 lib/wei-backend/main.rb
wei-backend-0.0.3 lib/wei-backend/main.rb
wei-backend-0.0.2 lib/wei-backend/main.rb
wei-backend-0.0.1 lib/wei-backend/main.rb