Sha256: 090cb881507de408e172ae590c980c762e86104cb2014216607486f19cb9f22e
Contents?: true
Size: 975 Bytes
Versions: 11
Compression:
Stored size: 975 Bytes
Contents
module SlackRubyBotServer module Api module Presenters module StatusPresenter include Roar::JSON::HAL include Roar::Hypermedia include Grape::Roar::Representer link :self do |opts| "#{base_url(opts)}/status" end property :teams_count property :active_teams_count property :ping def ping if SlackRubyBotServer::Config.mongoid? team = Team.asc(:_id).first elsif SlackRubyBotServer::Config.activerecord? team = Team.last else raise 'Unsupported database driver.' end return unless team team.ping! end def teams_count Team.count end def active_teams_count Team.active.count end def base_url(opts) request = Grape::Request.new(opts[:env]) request.base_url end end end end end
Version data entries
11 entries across 11 versions & 1 rubygems