Sha256: 59267d080b031d2f8cb2dcb822f6c85a150f9fe731ba5825dfb077bba7ecac03
Contents?: true
Size: 554 Bytes
Versions: 2
Compression:
Stored size: 554 Bytes
Contents
class Logman class LogWriter < Sinatra::Base post '/api/write' do json = JSON.parse(request.body.read) bucket = Bucket.where(:write_token=>params[:key]).first if bucket.nil? status 401 return 'Invalid token' end Bucket.set_bucket_collection bucket.bucket_key log = Log.new(json) log.datetime = Time.now if log.datetime.blank? if log.save return status 200 else status 422 log.errors.to_json end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
logman-0.1.0 | lib/modules/log_writer.rb |
logman-0.1.0.alpha | lib/modules/log_writer.rb |