/// <summary> /// Gets the smug mug gallery. /// </summary> /// <typeparam name="T">Can be either <see cref="OriginalSmugMugGallery"/> or <see cref="SmugMugGallery"/></typeparam> /// <param name="smugMugAlbumId">The smug mug album id.</param> /// <param name="smugMugAlbumKey">The smug mug album key.</param> /// <returns>A populated model of either <see cref="OriginalSmugMugGallery"/> or <see cref="SmugMugGallery"/></returns> /// <remarks>The albumID and albumKey can be located by looking in your gallery's url string. `&Data=[albumID]_[albumKey]`</remarks> /// <exception cref="System.Exception">Invalid Type specified, nothing to return.</exception> public T GetSmugMugGallery <T> (string smugMugAlbumId, string smugMugAlbumKey) { // Format the SmugMugFeedUrl with the appropriate input information var url = string.Format( SmugMugGalleryFeedUrl, smugMugAlbumId, smugMugAlbumKey); // Deserialize the RSS feed into an OriginalSmugMugGallery Model var originalGallery = XmlRssReader.Deserialize <OriginalSmugMugGallery> (url); // returns an OriginalSmugMugGallery if requested if (typeof(T) == typeof(OriginalSmugMugGallery)) { return((T)(object)originalGallery); } // Returns a SmugMugGallery if requested if (typeof(T) == typeof(SmugMugGallery)) { return((T)(object)MapSmugMugGalleries(originalGallery)); } // If the request was anything but the above Types, throw an error. throw new Exception("Invalid Type specified, nothing to return."); }
public void ShouldBeAbleToFetchFeed() { Torrents = XmlRssReader.FetchFeed(@"http://www.mininova.org/rss.xml?cat=4"); Assert.IsNotNull(Torrents); Assert.IsTrue(Torrents.Count > 0); }
public OriginalSmugMugGallery GetSmugMugRecentGalleries(string smugMugNickname) { var url = string.Format( SmugMugRecentGalleriesFeedUrl, smugMugNickname); return(XmlRssReader.Deserialize <OriginalSmugMugGallery> (url)); }