diff --git a/PlexRequests.Api.Interfaces/IPlexApi.cs b/PlexRequests.Api.Interfaces/IPlexApi.cs new file mode 100644 index 000000000..3ce0ee7d0 --- /dev/null +++ b/PlexRequests.Api.Interfaces/IPlexApi.cs @@ -0,0 +1,40 @@ +#region Copyright +// /************************************************************************ +// Copyright (c) 2016 Jamie Rees +// File: IPlexApi.cs +// Created By: Jamie Rees +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// ************************************************************************/ +#endregion +using System; + +using PlexRequests.Api.Models; + +namespace PlexRequests.Api.Interfaces +{ + public interface IPlexApi + { + PlexAuthentication SignIn(string username, string password); + PlexFriends GetUsers(string authToken); + PlexSearch SearchContent(string authToken, string searchTerm, Uri plexFullHost); + + } +} \ No newline at end of file diff --git a/PlexRequests.Api.Interfaces/PlexRequests.Api.Interfaces.csproj b/PlexRequests.Api.Interfaces/PlexRequests.Api.Interfaces.csproj index 1a0290cd1..005a42c47 100644 --- a/PlexRequests.Api.Interfaces/PlexRequests.Api.Interfaces.csproj +++ b/PlexRequests.Api.Interfaces/PlexRequests.Api.Interfaces.csproj @@ -46,11 +46,18 @@ + + + + {CB37A5F8-6DFC-4554-99D3-A42B502E4591} + PlexRequests.Api.Models + + + \ No newline at end of file diff --git a/PlexRequests.Api.Models/Properties/AssemblyInfo.cs b/PlexRequests.Api.Models/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..2774b1281 --- /dev/null +++ b/PlexRequests.Api.Models/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("PlexRequests.Api.Models")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("PlexRequests.Api.Models")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("cb37a5f8-6dfc-4554-99d3-a42b502e4591")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/PlexRequests.Api/Models/Tv/Authentication.cs b/PlexRequests.Api.Models/Tv/Authentication.cs similarity index 100% rename from PlexRequests.Api/Models/Tv/Authentication.cs rename to PlexRequests.Api.Models/Tv/Authentication.cs diff --git a/PlexRequests.Api/Models/Tv/TvSearchResult.cs b/PlexRequests.Api.Models/Tv/TvSearchResult.cs similarity index 100% rename from PlexRequests.Api/Models/Tv/TvSearchResult.cs rename to PlexRequests.Api.Models/Tv/TvSearchResult.cs diff --git a/PlexRequests.Api/Models/Tv/TvShow.cs b/PlexRequests.Api.Models/Tv/TvShow.cs similarity index 100% rename from PlexRequests.Api/Models/Tv/TvShow.cs rename to PlexRequests.Api.Models/Tv/TvShow.cs diff --git a/PlexRequests.Api/Models/Tv/TvShowImages.cs b/PlexRequests.Api.Models/Tv/TvShowImages.cs similarity index 100% rename from PlexRequests.Api/Models/Tv/TvShowImages.cs rename to PlexRequests.Api.Models/Tv/TvShowImages.cs diff --git a/PlexRequests.Api/PlexApi.cs b/PlexRequests.Api/PlexApi.cs index c8d66b744..9fc190e6b 100644 --- a/PlexRequests.Api/PlexApi.cs +++ b/PlexRequests.Api/PlexApi.cs @@ -26,6 +26,7 @@ #endregion using System; +using PlexRequests.Api.Interfaces; using PlexRequests.Api.Models; using PlexRequests.Helpers; @@ -33,13 +34,13 @@ using RestSharp; namespace PlexRequests.Api { - public class PlexApi + public class PlexApi : IPlexApi { static PlexApi() { Version = AssemblyHelper.GetAssemblyVersion(); } - private static string Version { get; set; } + private static string Version { get; } public PlexAuthentication SignIn(string username, string password) { diff --git a/PlexRequests.Api/PlexRequests.Api.csproj b/PlexRequests.Api/PlexRequests.Api.csproj index 0190d6ff8..e9b578476 100644 --- a/PlexRequests.Api/PlexRequests.Api.csproj +++ b/PlexRequests.Api/PlexRequests.Api.csproj @@ -67,16 +67,6 @@ - - - - - - - - - - @@ -93,6 +83,10 @@ {95834072-A675-415D-AA8F-877C91623810} PlexRequests.Api.Interfaces + + {CB37A5F8-6DFC-4554-99D3-A42B502E4591} + PlexRequests.Api.Models + {1252336D-42A3-482A-804C-836E60173DFA} PlexRequests.Helpers diff --git a/PlexRequests.Services/AvailabilityUpdateService.cs b/PlexRequests.Services/AvailabilityUpdateService.cs index a0fbee580..1a7d01d16 100644 --- a/PlexRequests.Services/AvailabilityUpdateService.cs +++ b/PlexRequests.Services/AvailabilityUpdateService.cs @@ -36,7 +36,6 @@ using Mono.Data.Sqlite; using NLog; -using PlexRequests.Api.Models; using PlexRequests.Core; using PlexRequests.Core.SettingModels; using PlexRequests.Helpers; diff --git a/PlexRequests.Services/PlexRequests.Services.csproj b/PlexRequests.Services/PlexRequests.Services.csproj index 163fbc612..0d96051ad 100644 --- a/PlexRequests.Services/PlexRequests.Services.csproj +++ b/PlexRequests.Services/PlexRequests.Services.csproj @@ -85,6 +85,10 @@ + + {CB37A5F8-6DFC-4554-99D3-A42B502E4591} + PlexRequests.Api.Models + {8cb8d235-2674-442d-9c6a-35fcaeeb160d} PlexRequests.Api diff --git a/PlexRequests.UI.Tests/BootstrapperExtensions.cs b/PlexRequests.UI.Tests/BootstrapperExtensions.cs new file mode 100644 index 000000000..52e656311 --- /dev/null +++ b/PlexRequests.UI.Tests/BootstrapperExtensions.cs @@ -0,0 +1,45 @@ +#region Copyright +// /************************************************************************ +// Copyright (c) 2016 Jamie Rees +// File: BootstrapperExtensions.cs +// Created By: Jamie Rees +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// ************************************************************************/ +#endregion +using System.Collections.Generic; + +using Nancy.Bootstrapper; +using Nancy.Session; + +namespace PlexRequests.UI.Tests +{ + public static class BootstrapperExtensions + { + public static void WithSession(this IPipelines pipeline, IDictionary session) + { + pipeline.BeforeRequest.AddItemToEndOfPipeline(ctx => + { + ctx.Request.Session = new Session(session); + return null; + }); + } + } +} \ No newline at end of file diff --git a/PlexRequests.UI.Tests/PlexRequests.UI.Tests.csproj b/PlexRequests.UI.Tests/PlexRequests.UI.Tests.csproj index c4f41f81a..07171162c 100644 --- a/PlexRequests.UI.Tests/PlexRequests.UI.Tests.csproj +++ b/PlexRequests.UI.Tests/PlexRequests.UI.Tests.csproj @@ -17,6 +17,8 @@ False UnitTest + + true @@ -36,6 +38,10 @@ 4 + + ..\packages\CsQuery.1.3.3\lib\net40\CsQuery.dll + True + ..\packages\FluentScheduler.3.1.46\lib\net40\FluentScheduler.dll True @@ -44,6 +50,22 @@ ..\packages\Moq.4.2.1510.2205\lib\net40\Moq.dll True + + ..\packages\Nancy.1.4.3\lib\net40\Nancy.dll + True + + + ..\packages\Nancy.Testing.1.4.1\lib\net40\Nancy.Testing.dll + True + + + ..\packages\Nancy.Viewengines.Razor.1.4.3\lib\net40\Nancy.ViewEngines.Razor.dll + True + + + ..\packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll + True + ..\packages\NUnit.3.0.1\lib\net45\nunit.framework.dll True @@ -54,6 +76,10 @@ + + ..\packages\Microsoft.AspNet.Razor.2.0.30506.0\lib\net40\System.Web.Razor.dll + True + @@ -64,13 +90,24 @@ + + + + + {95834072-A675-415D-AA8F-877C91623810} + PlexRequests.Api.Interfaces + + + {DD7DC444-D3BF-4027-8AB9-EFC71F5EC581} + PlexRequests.Core + {566EFA49-68F8-4716-9693-A6B3F2624DEA} PlexRequests.Services @@ -100,6 +137,13 @@ + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + +