Sha256: 13c31e67f8a114f812d7d1a96449c0ea78af28885b0509955c472c85c8217dce
Contents?: true
Size: 1.06 KB
Versions: 3
Compression:
Stored size: 1.06 KB
Contents
# frozen_string_literal: true 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
lita-locker-1.2.0 | lib/lita/handlers/locker_http.rb |
lita-locker-1.1.1 | lib/lita/handlers/locker_http.rb |
lita-locker-1.1.0 | lib/lita/handlers/locker_http.rb |