added /api/resource/{id} route to fancy

stopped scheduler from running during integration tests.
This commit is contained in:
Keivan Beigi 2013-05-24 14:28:13 -07:00
parent e8d8588199
commit 90fa261a00
5 changed files with 33 additions and 4 deletions

View file

@ -1,18 +1,23 @@
using Nancy;
using Nancy.Routing;
using NzbDrone.Common;
using NzbDrone.Api.Extensions;
using System.Linq;
namespace NzbDrone.Api.System
{
public class SystemModule : NzbDroneApiModule
{
private readonly IEnvironmentProvider _environmentProvider;
private readonly IRouteCacheProvider _routeCacheProvider;
public SystemModule(IEnvironmentProvider environmentProvider)
public SystemModule(IEnvironmentProvider environmentProvider, IRouteCacheProvider routeCacheProvider)
: base("system")
{
_environmentProvider = environmentProvider;
_routeCacheProvider = routeCacheProvider;
Get["/status"] = x => GetStatus();
Get["/routes"] = x => GetRoutes();
}
private Response GetStatus()
@ -29,9 +34,15 @@ namespace NzbDrone.Api.System
IsMono = EnvironmentProvider.IsMono,
IsProduction = EnvironmentProvider.IsProduction,
IsDebug = EnvironmentProvider.IsDebug,
IsLinux = EnvironmentProvider.IsLinux
IsLinux = EnvironmentProvider.IsLinux,
}.AsResponse();
}
private Response GetRoutes()
{
return _routeCacheProvider.GetCache().Values.AsResponse();
}
}
}