Sha256: 2244910d9b817bdd1585a7554f76d9d851ea7a2cd52de647be61fe2bfa2121b4
Contents?: true
Size: 1.03 KB
Versions: 11
Compression:
Stored size: 1.03 KB
Contents
module Lita module Handlers # HTTP-related handlers class LockerHttp < Handler namespace 'Locker' include ::Locker::Label include ::Locker::Misc include ::Locker::Regex include ::Locker::Resource http.get '/locker/label/:name', :label_show http.get '/locker/resource/:name', :resource_show def label_show(request, response) name = request.env['router.params'][:name] response.headers['Content-Type'] = 'application/json' unless Label.exists?(name) response.status = 404 return end l = Label.new(name) response.write(l.to_json) end def resource_show(request, response) name = request.env['router.params'][:name] response.headers['Content-Type'] = 'application/json' unless Resource.exists?(name) response.status = 404 return end r = Resource.new(name) response.write(r.to_json) end Lita.register_handler(LockerHttp) end end end
Version data entries
11 entries across 11 versions & 1 rubygems