fix it from failing to build

This commit is contained in:
Tommy Parnell
2015-05-01 05:24:41 -04:00
parent d4ce7ccded
commit e5c8540e92
13 changed files with 71 additions and 41 deletions

View File

@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Moq;
using Newtonsoft.Json;
using NUnit.Framework;
@@ -6,7 +7,6 @@ using RestSharp;
using Untappd.Net.Client;
using Untappd.Net.Request;
using Untappd.Net.Responses.BeerInfo;
using System.Threading.Tasks;
namespace Untappd.Net.UnitTests.Request
{
@@ -19,7 +19,7 @@ namespace Untappd.Net.UnitTests.Request
var mockCreds = new Mock<IUnAuthenticatedUntappdCredentials>();
mockCreds.Setup(a => a.ClientId).Returns("id");
mockCreds.Setup(a => a.ClientSecret).Returns("secret");
var bodyParam = new Dictionary<string, string> {{"key", "value"}};
var bodyParam = new Dictionary<string, object> {{"key", "value"}};
var client = new Mock<IRestClient>();
var request = new Mock<IRestRequest>();
request.Setup(a => a.AddParameter(It.IsAny<string>(), It.IsAny<string>()));
@@ -67,7 +67,7 @@ namespace Untappd.Net.UnitTests.Request
public void ConfirmConfigureGetRequestClearsParams()
{
var constructorTest = new Repository();
constructorTest.Request.Parameters.Add(new Parameter(){Name = "param"});
constructorTest.Request.Parameters.Add(new Parameter {Name = "param"});
Assert.IsTrue(constructorTest.Request.Parameters.Count > 0);
constructorTest.ConfigureRequest("endpoint");
Assert.IsTrue(constructorTest.Request.Parameters.Count == 0);

View File

@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.IO;
using Newtonsoft.Json;
using NUnit.Framework;
@@ -16,7 +17,6 @@ using Untappd.Net.Responses.UserInfo;
using Untappd.Net.Responses.VenueInfo;
using UserDistinctBeers = Untappd.Net.Responses.UserDistinctBeer;
using UserWishList = Untappd.Net.Responses.UserWishlist;
using System;
namespace Untappd.Net.UnitTests
{
@@ -31,7 +31,7 @@ namespace Untappd.Net.UnitTests
{
var credentials = new AuthenticatedUntappdCredentials("");
Dictionary<string, string> parameters = new Dictionary<string, string>();
Dictionary<string, object> parameters = new Dictionary<string, object>();
parameters.Add("q", "wild rose");
var repo = new Repository();

View File

@@ -1,9 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;
using Untappd.Net.Request;

View File

@@ -1,6 +1,8 @@
namespace Untappd.Net.Exception
using System;
namespace Untappd.Net.Exception
{
[System.Serializable]
[Serializable]
public class EndpointConfigurationException : BaseUntappdException
{
/// <summary>

View File

@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.Generic;
using RestSharp;
namespace Untappd.Net.Request

View File

@@ -1,9 +1,7 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Newtonsoft.Json;
using RestSharp;
using Untappd.Net.Client;
using System.Threading.Tasks;
using System.Threading;
namespace Untappd.Net.Request
{

View File

@@ -14,7 +14,7 @@ namespace Untappd.Net.Request
/// <param name="urlParameter">this is the main parameter for a request. ie v4/user/checkins/urlParameter. Consult the untappd docs, this can be null for a few requests</param>
/// <param name="bodyParameters">Any additional params you wish to add to the request</param>
/// <returns></returns>
public TResult Get<TResult>(IUnAuthenticatedUntappdCredentials credentials, string urlParameter, IDictionary<string, string> bodyParameters = null)
public TResult Get<TResult>(IUnAuthenticatedUntappdCredentials credentials, string urlParameter, IDictionary<string, object> bodyParameters = null)
where TResult : IUnAuthenticatedRequest, new()
{
var result = new TResult();
@@ -32,7 +32,7 @@ namespace Untappd.Net.Request
/// <param name="urlParameter"></param>
/// <param name="bodyParameters"></param>
/// <returns></returns>
public Task<TResult> GetAsync<TResult>(IUnAuthenticatedUntappdCredentials credentials, string urlParameter, IDictionary<string, string> bodyParameters = null)
public Task<TResult> GetAsync<TResult>(IUnAuthenticatedUntappdCredentials credentials, string urlParameter, IDictionary<string, object> bodyParameters = null)
where TResult : IUnAuthenticatedRequest, new()
{
var result = new TResult();
@@ -50,7 +50,7 @@ namespace Untappd.Net.Request
/// <param name="urlParameter">this is the main parameter for a request. ie v4/user/checkins/urlParameter. Consult the untappd docs, this can be null for a few requests</param>
/// <param name="bodyParameters">Any additional params you wish to add to the request</param>
/// <returns></returns>
public TResult Get<TResult>(IAuthenticatedUntappdCredentials credentials, string urlParameter = "", IDictionary<string, string> bodyParameters = null)
public TResult Get<TResult>(IAuthenticatedUntappdCredentials credentials, string urlParameter = "", IDictionary<string, object> bodyParameters = null)
where TResult : IAuthenticatedRequest, new()
{
var result = new TResult();
@@ -67,7 +67,7 @@ namespace Untappd.Net.Request
/// <param name="urlParameter"></param>
/// <param name="bodyParameters"></param>
/// <returns></returns>
public Task<TResult> GetAsync<TResult>(IAuthenticatedUntappdCredentials credentials, string urlParameter = "", IDictionary<string, string> bodyParameters = null)
public Task<TResult> GetAsync<TResult>(IAuthenticatedUntappdCredentials credentials, string urlParameter = "", IDictionary<string, object> bodyParameters = null)
where TResult : IAuthenticatedRequest, new()
{
var result = new TResult();

View File

@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Untappd.Net.Client;
using Untappd.Net.Client;
namespace Untappd.Net.Request
{

View File

@@ -10,23 +10,25 @@ namespace Untappd.Net.Responses.Actions
private short _rating;
private string _shout;
public Method RequestMethod { get{ return Method.POST;} }
public string EndPoint { get { return "/v4/checkin/add"; } }
public string EndPoint { get { return "v4/checkin/add"; } }
public IDictionary<string, object> BodyParameters
{
get
{
var dict = new Dictionary<string, object>();
dict.Add("gmt_offset", gmt_offset);
dict.Add("timezone", timezone);
dict.Add("bid", bid);
var dict = new Dictionary<string, object>
{
{"gmt_offset", gmt_offset},
{"timezone", timezone},
{"bid", bid}
};
if (geolat.HasValue)
{
dict.Add("geolat", geolat);
dict.Add("geolat", geolat.Value);
}
if (geolng.HasValue)
{
dict.Add("geolng", geolat);
dict.Add("geolng", geolng.Value);
}
if (!string.IsNullOrWhiteSpace(shout) && shout.Length <= 140)
{

View File

@@ -0,0 +1,40 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using RestSharp;
using Untappd.Net.Request;
namespace Untappd.Net.Responses.Actions
{
public class PendingFriends : IAction
{
public Method RequestMethod { get; private set; }
public string EndPoint { get { return "v4/user/pending"; }}
public IDictionary<string, object> BodyParameters
{
get
{
var dict = new Dictionary<string, object>();
if (Offset.HasValue)
{
dict.Add("offset", Offset.Value);
}
if (Limit.HasValue)
{
dict.Add("limit", Limit.Value);
}
return dict;
}
}
public int? Offset { get; set; }
public int? Limit { get; set; }
public PendingFriends()
{
}
}
}

View File

@@ -10,7 +10,7 @@ namespace Untappd.Net.Responses.Actions
public Method RequestMethod { get; private set; }
public IDictionary<string, object> BodyParameters { get; private set; }
public string CheckinId { get; private set; }
public string EndPoint { get { return string.Format(" /v4/checkin/toast/{0}", CheckinId); } }
public string EndPoint { get { return string.Format("v4/checkin/toast/{0}", CheckinId); } }
/// <summary>
///
/// </summary>

View File

@@ -1,6 +1,5 @@
using System;
using Newtonsoft.Json;
using Untappd.Net.Request;
namespace Untappd.Net
{

View File

@@ -50,6 +50,9 @@
<Compile Include="Request\IAction.cs" />
<Compile Include="Request\RepositoryGet.cs" />
<Compile Include="Request\RepositoryPost.cs" />
<Compile Include="Responses\Actions\CheckIn.cs" />
<Compile Include="Responses\Actions\PendingFriends.cs" />
<Compile Include="Responses\Actions\ToastUntoast.cs" />
<Compile Include="SingleObjectArrayConverter.cs" />
<Compile Include="Client\AuthenticatedUntappdCredentials.cs" />
<Compile Include="Client\IAuthenticatedUntappdCredentials.cs" />
@@ -82,9 +85,7 @@
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Folder Include="Responses\Actions\" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.