fix Action parameter "url", so batch adding is working now

This commit is contained in:
2014-06-17 10:45:24 +02:00
parent 7cad855f9c
commit 556e8004f3
4 changed files with 43 additions and 13 deletions
+37 -6
View File
@@ -70,25 +70,56 @@ namespace PocketSharp.Tests
[Fact]
public async Task ItemViaActionsIsAdded()
{
var uri = new Uri("http://frontendplay.com/story/4015/string-indexer-for-text-resources-in-nancy");
List<PocketAction> actions = new List<PocketAction>();
PocketAction action = new PocketAction()
actions.Add(new PocketAction()
{
Uri = uri,
Uri = new Uri("http://frontendplay.com/story/4015/string-indexer-for-text-resources-in-nancy"),
Action = "add",
Time = DateTime.Now
};
});
bool success = await client.SendAction(action);
bool success = await client.SendActions(actions);
Assert.True(success);
IEnumerable<PocketItem> items = await client.Search("String Indexer");
IEnumerable<PocketItem> items = await client.Search("in nancy");
Assert.NotNull(items);
Assert.True(items.Count() > 0);
itemsToDelete.Add(items.First().ID);
}
[Fact]
public async Task ItemsViaActionsIsAdded()
{
List<PocketAction> actions = new List<PocketAction>();
actions.Add(new PocketAction()
{
Uri = new Uri("http://frontendplay.com/story/4015/string-indexer-for-text-resources-in-nancy"),
Action = "add",
Time = DateTime.Now
});
actions.Add(new PocketAction()
{
Uri = new Uri("http://frontendplay.com/story/4013/build-a-custom-razor-viewbase-in-nancy"),
Action = "add",
Time = DateTime.Now
});
bool success = await client.SendActions(actions);
Assert.True(success);
IEnumerable<PocketItem> items = await client.Search("in nancy");
Assert.NotNull(items);
Assert.True(items.Count() == 2);
itemsToDelete.AddRange(items.Select(item => item.ID));
}
}
}
+3 -2
View File
@@ -1,4 +1,5 @@
using System;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
@@ -120,7 +121,7 @@ namespace PocketSharp.Models
if (!String.IsNullOrEmpty(TweetID))
parameters.Add("ref_id", TweetID);
if (Uri != null)
parameters.Add("uri", Uri.ToString());
parameters.Add("url", Uri.OriginalString);
return parameters;
}
+2 -2
View File
@@ -14,7 +14,7 @@ namespace PocketSharp.Models
/// <value>
/// The action results.
/// </value>
[JsonProperty("action_results")]
public bool[] ActionResults { get; set; }
//[JsonProperty("action_results")]
//public bool[] ActionResults { get; set; }
}
}
+1 -3
View File
@@ -316,9 +316,7 @@ namespace PocketSharp
"actions", JsonConvert.SerializeObject(actionParameters.Select(action => action.Convert()))
}};
Modify result = (await Request<Modify>("send", cancellationToken, parameters));
return result.ActionResults != null ? !result.ActionResults.Contains(false) : result.Status;
return (await Request<Modify>("send", cancellationToken, parameters)).Status;
}