Showing with 5,280 additions and 3,242 deletions.
  1. +22 −0 .gitattributes
  2. +1 −0 .gitignore
  3. BIN .nuget/RestSharp.Build.dll
  4. +16 −0 CONTRIBUTING.markdown
  5. +3 −3 README.markdown
  6. +122 −0 RestSharp.Build/NuSpecUpdateTask.cs
  7. +36 −0 RestSharp.Build/Properties/AssemblyInfo.cs
  8. +56 −0 RestSharp.Build/RestSharp.Build.csproj
  9. +159 −4 RestSharp.IntegrationTests/AsyncTests.cs
  10. +23 −2 RestSharp.IntegrationTests/FileTests.cs
  11. +64 −0 RestSharp.IntegrationTests/MultipartFormDataTests.cs
  12. +182 −0 RestSharp.IntegrationTests/RequestBodyTests.cs
  13. +14 −10 RestSharp.IntegrationTests/RestSharp.IntegrationTests.csproj
  14. +1 −1 RestSharp.IntegrationTests/StatusCodeTests.cs
  15. +2 −2 RestSharp.IntegrationTests/packages.config
  16. +52 −52 RestSharp.Mono.sln
  17. +31 −0 RestSharp.Net4/Extensions/ResponseStatusExtensions.cs
  18. +6 −3 RestSharp.Net4/RestSharp.Net4.csproj
  19. +0 −1 RestSharp.Net4/packages.config
  20. +2 −0 RestSharp.Silverlight/RestSharp.Silverlight.csproj
  21. +0 −1 RestSharp.Silverlight/packages.config
  22. +114 −62 RestSharp.Tests/JsonTests.cs
  23. +23 −23 RestSharp.Tests/NamespacedXmlTests.cs
  24. +122 −0 RestSharp.Tests/NuSpecUpdateTask.cs
  25. +21 −0 RestSharp.Tests/RestRequestTests.cs
  26. +24 −11 RestSharp.Tests/RestSharp.Tests.csproj
  27. +16 −0 RestSharp.Tests/SampleClasses/Oddball.cs
  28. +207 −197 RestSharp.Tests/SampleClasses/misc.cs
  29. +3 −0 RestSharp.Tests/SampleData/objectproperty.txt
  30. +18 −0 RestSharp.Tests/SampleData/restsharp.nuspec
  31. +74 −1 RestSharp.Tests/SerializerTests.cs
  32. +693 −562 RestSharp.Tests/SimpleJson.cs
  33. +15 −0 RestSharp.Tests/UrlBuilderTests.cs
  34. +82 −46 RestSharp.Tests/XmlTests.cs
  35. +3 −4 RestSharp.Tests/packages.config
  36. +291 −291 RestSharp.WindowsPhone.Mango/RestSharp.WindowsPhone.Mango.csproj
  37. +0 −1 RestSharp.WindowsPhone.Mango/packages.config
  38. +2 −0 RestSharp.WindowsPhone/RestSharp.WindowsPhone.csproj
  39. +0 −1 RestSharp.WindowsPhone/packages.config
  40. +12 −1 RestSharp.sln
  41. +12 −12 RestSharp/Authenticators/OAuth/HttpPostParameterType.cs
  42. +12 −12 RestSharp/Authenticators/OAuth/OAuthParameterHandling.cs
  43. +13 −13 RestSharp/Authenticators/OAuth/OAuthSignatureMethod.cs
  44. +12 −12 RestSharp/Authenticators/OAuth/OAuthSignatureTreatment.cs
  45. +334 −334 RestSharp/Authenticators/OAuth/OAuthTools.cs
  46. +14 −14 RestSharp/Authenticators/OAuth/OAuthType.cs
  47. +28 −28 RestSharp/Authenticators/OAuth/OAuthWebQueryInfo.cs
  48. +403 −403 RestSharp/Authenticators/OAuth/OAuthWorkflow.cs
  49. +20 −20 RestSharp/Authenticators/OAuth/WebParameter.cs
  50. +243 −243 RestSharp/Authenticators/OAuth1Authenticator.cs
  51. +16 −2 RestSharp/Authenticators/OAuth2Authenticator.cs
  52. +31 −8 RestSharp/Deserializers/JsonDeserializer.cs
  53. +4 −2 RestSharp/Deserializers/XmlAttributeDeserializer.cs
  54. +73 −19 RestSharp/Deserializers/XmlDeserializer.cs
  55. +127 −127 RestSharp/Extensions/MiscExtensions.cs
  56. +1 −1 RestSharp/Extensions/ReflectionExtensions.cs
  57. +32 −41 RestSharp/Http.Async.cs
  58. +11 −5 RestSharp/Http.Sync.cs
  59. +39 −9 RestSharp/Http.cs
  60. +16 −4 RestSharp/IHttp.cs
  61. +91 −1 RestSharp/IRestClient.cs
  62. +11 −0 RestSharp/IRestRequest.cs
  63. +235 −8 RestSharp/RestClient.Async.cs
  64. +0 −19 RestSharp/RestClient.Sync.cs
  65. +56 −15 RestSharp/RestClient.cs
  66. +75 −15 RestSharp/RestClientExtensions.cs
  67. +23 −1 RestSharp/RestRequest.cs
  68. +1 −0 RestSharp/RestResponse.cs
  69. +14 −2 RestSharp/RestSharp.csproj
  70. +7 −2 RestSharp/Serializers/XmlSerializer.cs
  71. +9 −3 RestSharp/SharedAssemblyInfo.cs
  72. +699 −568 RestSharp/SimpleJson.cs
  73. +1 −1 RestSharp/packages.config
  74. BIN Tools/NuGet.exe
  75. +63 −0 build.bat
  76. +2 −1 package.cmd
  77. +24 −0 releasenotes.markdown
  78. +16 −18 restsharp.nuspec
22 changes: 22 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Auto detect text files and perform LF normalization
* text=auto

# Custom for Visual Studio
*.cs diff=csharp
*.sln merge=union
*.csproj merge=union
*.vbproj merge=union
*.fsproj merge=union
*.dbproj merge=union

# Standard to msysgit
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@ Download/
#Ignore files from MonoDevelop
*.pidb
*.userprefs
restsharp-computed.nuspec
Binary file added .nuget/RestSharp.Build.dll
Binary file not shown.
16 changes: 16 additions & 0 deletions CONTRIBUTING.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Follow these guidelines, in no particular order, to improve your chances of having a pull request merged in.

### Before you do anything else

* Before reporting an issue or creating a pull request, discuss it in the Google Group http://groups.google.com/group/restsharp

### Once a contribution is ready to be submitted

* Make each pull request atomic and exclusive; don't send pull requests for a laundry list of changes.
* Even better, commit in small manageable chunks.
* Tabs, not spaces. Bracket style doesn't matter. Do not reformat code you didn't touch.
* Changes to XmlDeserializer or JsonDeserializer must be accompanied by a unit test covering the change.
* No regions except for license header
* Code must build for .NET 3.5 Client Profile, Silverlight 4 and Windows Phone 7
* If you didn't write the code you must provide a reference to where you obtained it and preferably the license.
* Use autocrlf=true `git config --global core.autocrlf true` http://help.github.com/dealing-with-lineendings/
6 changes: 3 additions & 3 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var client = new RestClient("http://example.com");
var request = new RestRequest("resource/{id}", Method.POST);
request.AddParameter("name", "value"); // adds to POST or URL querystring based on Method
request.AddUrlSegment("id", 123); // replaces matching token in request.Resource
request.AddUrlSegment("id", "123"); // replaces matching token in request.Resource
// add parameters for all properties on an object
request.AddObject(object);
Expand All @@ -40,7 +40,7 @@ request.AddHeader("header", "value");
request.AddFile(path);

// execute the request
RestResponse response = client.Execute(request);
IRestResponse response = client.Execute(request);
var content = response.Content; // raw content as string
// or automatically deserialize result
Expand All @@ -67,4 +67,4 @@ asyncHandle.Abort();

[1]: http://restsharp.org
[2]: http://twitter.com/RestSharp
[3]: http://groups.google.com/group/RestSharp
[3]: http://groups.google.com/group/RestSharp
122 changes: 122 additions & 0 deletions RestSharp.Build/NuSpecUpdateTask.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Build.Utilities;
using System.Reflection;
using System.Xml.Linq;
using System.IO;

namespace RestSharp.Build
{
public class NuSpecUpdateTask : Task
{
private Assembly _assembly;

public string Id { get; private set; }

public string Authors { get; private set; }

public string Description { get; private set; }

public string Version { get; private set; }

public string SpecFile { get; set; }

public string SourceAssemblyFile { get; set; }

public NuSpecUpdateTask()
: this(null)
{
}

public NuSpecUpdateTask(Assembly assembly)
{
this._assembly = assembly;
}

public override bool Execute()
{
if (string.IsNullOrEmpty(this.SpecFile)) return false;

var path = Path.GetFullPath(this.SourceAssemblyFile);
this._assembly = this._assembly ?? Assembly.LoadFile(path);

var name = this._assembly.GetName();

this.Id = name.Name;
this.Authors = this.GetAuthors(this._assembly);
this.Description = this.GetDescription(this._assembly);
this.Version = this.GetVersion(this._assembly);

this.GenerateComputedSpecFile();

return true;
}

private void GenerateComputedSpecFile()
{
var doc = XDocument.Load(this.SpecFile);

var metaNode = doc.Descendants("metadata").First();

this.ReplaceToken(metaNode, "id", this.Id);
this.ReplaceToken(metaNode, "authors", this.Authors);
this.ReplaceToken(metaNode, "owners", this.Authors);
this.ReplaceToken(metaNode, "description", this.Description);
this.ReplaceToken(metaNode, "version", this.Version);

doc.Save(this.SpecFile.Replace(".nuspec", "-computed.nuspec"));
}

private void ReplaceToken(XElement metaNode, XName name, string value)
{
var node = metaNode.Element(name);
var token = string.Format("${0}$", name.ToString().TrimEnd('s'));

if (name.ToString().Equals("owners"))
{
token = "$author$";
}

if (node.Value.Equals(token, StringComparison.OrdinalIgnoreCase))
{
node.SetValue(value);
}
}

private string GetDescription(Assembly asm)
{
return this.GetAttribute<AssemblyDescriptionAttribute>(asm).Description;
}

private string GetAuthors(Assembly asm)
{
return this.GetAttribute<AssemblyCompanyAttribute>(asm).Company;
}

private string GetVersion(Assembly asm)
{
var version = asm.GetName().Version.ToString();
var attr = this.GetAttribute<AssemblyInformationalVersionAttribute>(asm);

if (attr != null)
{
version = attr.InformationalVersion;
}

return version;
}

private TAttr GetAttribute<TAttr>(Assembly asm) where TAttr : Attribute
{
var attrs = asm.GetCustomAttributes(typeof(TAttr), false);
if (attrs.Length > 0)
{
return attrs[0] as TAttr;
}

return null;
}
}
}
36 changes: 36 additions & 0 deletions RestSharp.Build/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("RestSharp.Build")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RestSharp.Build")]
[assembly: AssemblyCopyright("Copyright © 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("1cf9b3e7-67bb-4dca-9094-5f8c94ef9587")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
56 changes: 56 additions & 0 deletions RestSharp.Build/RestSharp.Build.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{CCC30138-3D68-44D8-AF1A-D22F769EE8DC}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>RestSharp.Build</RootNamespace>
<AssemblyName>RestSharp.Build</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.Build.Framework" />
<Reference Include="Microsoft.Build.Utilities.v3.5" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="NuSpecUpdateTask.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</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.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
Loading