public BaseResult UpdateSubscriber(int groupId, int subscriberId, string firstName, string lastName, string companyName) { var url = $"{this._baseUrl}/subscribers/updateSubscriber/"; var request = new SubscriberUpdateRequest { ApiKey = this._apiKey, GroupId = groupId, SubscriberId = subscriberId, FirstName = firstName, LastName = lastName, CompanyName = companyName }; var xmlRequest = this._parser.Serialize(request); var httpResponse = this._httpClient.Request(url, xmlRequest); if (httpResponse.Status != HttpStatus.Successful) { return(new BaseResult { Status = Status.Error, Message = "Http error" }); } var updateResult = this._parser.Deserialize <BaseResult>(httpResponse.Result); return(updateResult); }
public void SerializeUpdateSubscriberRequest() { IXmlParser xmlParser = new DefaultXmlParser(); var request = new SubscriberUpdateRequest { ApiKey = "44-121312131223", GroupId = 213213, SubscriberId = 981413, FirstName = "Test", LastName = "User", CompanyName = "Test Company" }; var requestXml = xmlParser.Serialize(request); var xml = File.ReadAllText("UpdateSubscriberRequest.xml"); Assert.AreEqual(xml, requestXml); }