public void Update() { string requestJson = GetJsonPayload("/contacts/dncApi/request/updateDnc.json"); var restRequest = MockRestResponse(); DoNotContact dnc = new DoNotContact { Call = true, ListId = TEST_LONG, Number = TEST_LONG.ToString(), Text = true }; Client.DncApi.Update(dnc); Assert.AreEqual(Method.PUT, restRequest.Value.Method); var requestBodyParam = restRequest.Value.Parameters.FirstOrDefault(p => p.Type == ParameterType.RequestBody); Assert.That(requestBodyParam.Value, Is.EqualTo(requestJson)); }
public void UpdateDnc() { long listId = 2021478003; string number = "13234324554"; string prefix = "13234"; DoNotContact dncToUpdate = new DoNotContact { ListId = listId, Text = true, Call = true, Number = number }; Client.DncApi.Update(dncToUpdate); var request = new FindDncContactsRequest { DncListId = listId, Prefix = prefix, CallDnc = true, TextDnc = true, Limit = 1, Offset = 0 }; Page<DoNotContact> dnc = Client.DncApi.Find(request); Assert.NotNull(dnc); Assert.AreEqual(dnc.Items.Count, 1); Assert.AreEqual(dnc.Items[0].ListId, listId); Assert.AreEqual(dnc.Items[0].Number, number); Assert.AreEqual(dnc.Items[0].Text, true); Assert.AreEqual(dnc.Items[0].Call, true); //get back initial db stage as before test dncToUpdate.Text = true; dncToUpdate.Call = true; Client.DncApi.Update(dncToUpdate); }
/// <summary> /// Update a Do Not Contact (DNC) contact value. Can toggle whether the DNC is enabled for calls/texts. /// </summary> /// <param name="dnc">DNC item to update</param> /// <exception cref="BadRequestException"> in case HTTP response code is 400 - Bad request, the request was formatted improperly.</exception> /// <exception cref="UnauthorizedException"> in case HTTP response code is 401 - Unauthorized, API Key missing or invalid.</exception> /// <exception cref="AccessForbiddenException"> in case HTTP response code is 403 - Forbidden, insufficient permissions.</exception> /// <exception cref="ResourceNotFoundException"> in case HTTP response code is 404 - NOT FOUND, the resource requested does not exist.</exception> /// <exception cref="InternalServerErrorException"> in case HTTP response code is 500 - Internal Server Error.</exception> /// <exception cref="CallfireApiException"> in case HTTP response code is something different from codes listed above.</exception> /// <exception cref="CallfireClientException"> in case error has occurred in client.</exception> public void Update(DoNotContact dnc) { Client.Put<DoNotContact>(DNC_PATH, dnc); }