From 133920ae58e35643463c716989b4906d02afb920 Mon Sep 17 00:00:00 2001 From: Tobias Klika Date: Thu, 2 Apr 2015 22:54:15 +0200 Subject: [PATCH] remove xml attributes from reviews --- src/OnePeek.Api/AppRatingEndpoint.cs | 5 +++-- src/OnePeek.Api/OnePeek.Api.csproj | 1 + src/OnePeek.Entities/AppReviews.cs | 10 ---------- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/src/OnePeek.Api/AppRatingEndpoint.cs b/src/OnePeek.Api/AppRatingEndpoint.cs index de807d6..e74ed46 100644 --- a/src/OnePeek.Api/AppRatingEndpoint.cs +++ b/src/OnePeek.Api/AppRatingEndpoint.cs @@ -26,17 +26,18 @@ namespace OnePeek.Api IEnumerable xel = XDocument.Parse(xml).Elements().First().Descendants(); - AppReviews result = Deserialize.Xml(xml); + AppReviews result = new AppReviews(); result.Id = appId; result.StoreType = store; result.StoreCultureType = storeCulture; result.Sorting = sorting; + result.StoreDataModifiedDate = DateTime.Parse(xel.Get("updated")); // parse markers result.PrevPageMarkerId = Utils.GetQueryPart(xel.FirstOrDefault(x => x.Name.LocalName == "link" && x.Attribute("rel").Value == "prev"), "href", "beforeMarker"); result.NextPageMarkerId = Utils.GetQueryPart(xel.FirstOrDefault(x => x.Name.LocalName == "link" && x.Attribute("rel").Value == "next"), "href", "afterMarker"); - // create images + // append reviews result.Reviews = xel.Where(x => x.Name.LocalName == "entry").Select(x => { IEnumerable childs = x.Descendants(); diff --git a/src/OnePeek.Api/OnePeek.Api.csproj b/src/OnePeek.Api/OnePeek.Api.csproj index 4a10474..1cc9501 100644 --- a/src/OnePeek.Api/OnePeek.Api.csproj +++ b/src/OnePeek.Api/OnePeek.Api.csproj @@ -45,6 +45,7 @@ + diff --git a/src/OnePeek.Entities/AppReviews.cs b/src/OnePeek.Entities/AppReviews.cs index 67c172e..fe41116 100644 --- a/src/OnePeek.Entities/AppReviews.cs +++ b/src/OnePeek.Entities/AppReviews.cs @@ -4,12 +4,10 @@ using System.Xml.Serialization; namespace OnePeek.Entities { - [XmlRoot("feed")] public partial class AppReviews { public string Id { get; set; } - [XmlElement("updated")] public DateTime? StoreDataModifiedDate { get; set; } public StoreType StoreType { get; set; } @@ -26,28 +24,20 @@ namespace OnePeek.Entities } - [XmlRoot("entry")] public partial class AppReview { - [XmlElement("reviewId")] public string Id { get; set; } - [XmlElement("updated")] public DateTime CreatedDate { get; set; } - [XmlElement("name")] public string Author { get; set; } - [XmlElement("content")] public string Text { get; set; } - [XmlElement("userRating")] public byte Rating { get; set; } - [XmlElement("device")] public string Device { get; set; } - [XmlElement("productVersion")] public string AppVersion { get; set; } } }