Skip to content

Commit

Permalink
Refreshed solution and use of nuget
Browse files Browse the repository at this point in the history
- Updated solution to visual studio 2013
- Built against .NET framework 4.5.1
- Using nuget to resolve dependencies.
  • Loading branch information
bounav committed Sep 22, 2015
1 parent c48be9b commit e98654c
Show file tree
Hide file tree
Showing 93 changed files with 150,864 additions and 40 deletions.
Binary file removed Lib/RestSharp.dll
Binary file not shown.
Binary file removed Lib/nunit.framework.dll
Binary file not shown.
17 changes: 7 additions & 10 deletions SDK/Meli.cs
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
using System;
using System.Web;
using System.Net;
using System.IO;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System.Collections.Specialized;
using RestSharp;
using System.Collections.Generic;

namespace MercadoLibre.SDK
{
public class Meli
{

private RestClient client = new RestClient (ApiUrl);
{
private RestClient client = new RestClient(ApiUrl);
static private string apiUrl = "https://api.mercadolibre.com";
static private string sdkVersion = "MELI-NET-SDK-0.0.1";
static public string ApiUrl {

static public string ApiUrl {
get {
return apiUrl;
}
Expand Down Expand Up @@ -109,14 +106,14 @@ void refreshToken ()

public IRestResponse Get (string resource, List<Parameter> param)
{
bool containsAT = false;
bool containsAccessToken = false;

var request = new RestRequest (resource, Method.GET);
List<string> names = new List<string> ();
foreach (Parameter p in param) {
names.Add (p.Name + "={" + p.Name + "}");
if (p.Name.Equals ("access_token")) {
containsAT = true;
containsAccessToken = true;
}
p.Type = ParameterType.UrlSegment;
request.AddParameter (p);
Expand All @@ -128,7 +125,7 @@ public IRestResponse Get (string resource, List<Parameter> param)

var response = ExecuteRequest (request);

if (!string.IsNullOrEmpty (this.RefreshToken) && (response.StatusCode == HttpStatusCode.NotFound || response.StatusCode == HttpStatusCode.Unauthorized || response.StatusCode == HttpStatusCode.Forbidden) && containsAT) {
if (!string.IsNullOrEmpty (this.RefreshToken) && (response.StatusCode == HttpStatusCode.NotFound || response.StatusCode == HttpStatusCode.Unauthorized || response.StatusCode == HttpStatusCode.Forbidden) && containsAccessToken) {
refreshToken ();

request = new RestRequest (resource, Method.GET);
Expand Down
26 changes: 17 additions & 9 deletions SDK/SDK.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
Expand All @@ -9,7 +9,8 @@
<OutputType>Library</OutputType>
<RootNamespace>MercadoLibre.SDK</RootNamespace>
<AssemblyName>net-sdk</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand All @@ -20,6 +21,7 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>none</DebugType>
Expand All @@ -28,23 +30,29 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="RestSharp, Version=105.2.3.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\RestSharp.105.2.3\lib\net451\RestSharp.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Web" />
<Reference Include="System.Net" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="RestSharp">
<HintPath>..\Lib\RestSharp.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>..\Lib\Newtonsoft.Json.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="AssemblyInfo.cs" />
<Compile Include="Meli.cs" />
<Compile Include="AuthorizationException.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>
Binary file modified SDK/bin/Debug/Newtonsoft.Json.dll
Binary file not shown.
Loading

0 comments on commit e98654c

Please sign in to comment.