Sha256: 8617068c8a19d4a7404b7617d296989247e155ea60656b36b315ee9a3f86b648
Contents?: true
Size: 619 Bytes
Versions: 39
Compression:
Stored size: 619 Bytes
Contents
require 'roda' module Opener class ChainedDaemon class Webservice < Roda TOKEN = ENV['PRIVATE_TOKEN'] class_attribute :processor self.processor = ChainedDaemon.new route do |r| response.status = 403 and r.halt if r.params['auth_token'] != TOKEN sentiment = -> do r.params.deep_symbolize_keys! kaf = processor.run r.params[:input], **r.params.except(:input) response['Content-Type'] = 'text/xml' kaf end r.get 'sentiment.kaf', &sentiment r.post 'sentiment.kaf', &sentiment end end end end
Version data entries
39 entries across 39 versions & 1 rubygems