From a15adb421f2bc57e0f9430b2b97d52cc4483d091 Mon Sep 17 00:00:00 2001 From: Paul Irwin Date: Wed, 3 Dec 2014 17:09:55 -0500 Subject: [PATCH] Prepare for 1.12.0-beta1 release Upgrades RestSharp to latest version --- src/Stripe.csproj | 4 +- src/Stripe.nuspec | 14 ++--- src/StripeClient.cs | 136 ++++++++++++++++++++++---------------------- src/packages.config | 2 +- 4 files changed, 79 insertions(+), 77 deletions(-) diff --git a/src/Stripe.csproj b/src/Stripe.csproj index 9cf917a..4d9e2e5 100644 --- a/src/Stripe.csproj +++ b/src/Stripe.csproj @@ -44,9 +44,9 @@ MinimumRecommendedRules.ruleset - + False - ..\packages\RestSharp.104.1\lib\net4\RestSharp.dll + ..\packages\RestSharp.105.0.1\lib\net4\RestSharp.dll diff --git a/src/Stripe.nuspec b/src/Stripe.nuspec index a64f550..df5ecf6 100644 --- a/src/Stripe.nuspec +++ b/src/Stripe.nuspec @@ -2,20 +2,20 @@ Stripe - 1.11.0 + 1.12.0-beta1 Stripe - Nick Berardi + Nick Berardi, Paul Irwin Stripe, Inc Stripe is a simple, developer-friendly way to accept payments online. We believe that enabling transactions on the web is a problem rooted in code, not finance, and we want to help put more websites in business. Stripe is a simple, developer-friendly way to accept payments online. We believe that enabling transactions on the web is a problem rooted in code, not finance, and we want to help put more websites in business. en-US - https://github.com/hoppio/stripe-dotnet - https://github.com/hoppio/stripe-dotnet/raw/master/LICENSE.txt - https://github.com/hoppio/stripe-dotnet/raw/master/nuget/Stripe.Logo.png + https://github.com/nberardi/stripe-dotnet + https://github.com/nberardi/stripe-dotnet/raw/master/LICENSE.txt + https://github.com/nberardi/stripe-dotnet/raw/master/nuget/Stripe.Logo.png false - payment gateway rest api .net40 .net45 + stripe credit card payment gateway rest api .net40 .net45 - + diff --git a/src/StripeClient.cs b/src/StripeClient.cs index a54a8ff..b303a09 100644 --- a/src/StripeClient.cs +++ b/src/StripeClient.cs @@ -7,83 +7,85 @@ namespace Stripe { - /// - public partial class StripeClient - { - public string ApiVersion { get; set; } - public string ApiEndpoint { get; set; } - public string ApiKey { get; private set; } + /// + public partial class StripeClient + { + public string ApiVersion { get; set; } + public string ApiEndpoint { get; set; } + public string ApiKey { get; private set; } - private RestClient _client; + private RestClient _client; - public StripeClient(string apiKey) - { - ApiVersion = "v1"; - ApiEndpoint = "https://api.stripe.com/"; - ApiKey = apiKey; + public StripeClient(string apiKey) + { + ApiVersion = "v1"; + ApiEndpoint = "https://api.stripe.com/"; + ApiKey = apiKey; - // silverlight friendly way to get current version - var assembly = Assembly.GetExecutingAssembly(); - AssemblyName assemblyName = new AssemblyName(assembly.FullName); - var version = assemblyName.Version; + // silverlight friendly way to get current version + var assembly = Assembly.GetExecutingAssembly(); + AssemblyName assemblyName = new AssemblyName(assembly.FullName); + var version = assemblyName.Version; - _client = new RestClient(); - _client.UserAgent = "stripe-dotnet/" + version; - _client.Authenticator = new StripeAuthenticator(apiKey); - _client.BaseUrl = String.Format("{0}{1}", ApiEndpoint, ApiVersion); - } + _client = new RestClient(); + _client.UserAgent = "stripe-dotnet/" + version; + _client.Authenticator = new StripeAuthenticator(apiKey); + _client.BaseUrl = new Uri(String.Format("{0}{1}", ApiEndpoint, ApiVersion)); + } - /// - /// Execute a manual REST request - /// - /// The type of object to create and populate with the returned data. - /// The RestRequest to execute (will use client credentials) - public StripeObject ExecuteObject(RestRequest request) - { - request.OnBeforeDeserialization = (resp) => { - // for individual resources when there's an error to make - // sure that RestException props are populated - if (((int)resp.StatusCode) >= 400) - request.RootElement = ""; - }; + /// + /// Execute a manual REST request + /// + /// The type of object to create and populate with the returned data. + /// The RestRequest to execute (will use client credentials) + public StripeObject ExecuteObject(RestRequest request) + { + request.OnBeforeDeserialization = (resp) => + { + // for individual resources when there's an error to make + // sure that RestException props are populated + if (((int)resp.StatusCode) >= 400) + request.RootElement = ""; + }; - var response = _client.Execute(request); - var json = Deserialize(response.Content); - var obj = new StripeObject(); - obj.SetModel(json); + var response = _client.Execute(request); + var json = Deserialize(response.Content); + var obj = new StripeObject(); + obj.SetModel(json); - return obj; - } + return obj; + } - /// - /// Execute a manual REST request - /// - /// The type of object to create and populate with the returned data. - /// The RestRequest to execute (will use client credentials) - public StripeArray ExecuteArray(RestRequest request) - { - request.OnBeforeDeserialization = (resp) => { - // for individual resources when there's an error to make - // sure that RestException props are populated - if (((int)resp.StatusCode) >= 400) - request.RootElement = ""; - }; + /// + /// Execute a manual REST request + /// + /// The type of object to create and populate with the returned data. + /// The RestRequest to execute (will use client credentials) + public StripeArray ExecuteArray(RestRequest request) + { + request.OnBeforeDeserialization = (resp) => + { + // for individual resources when there's an error to make + // sure that RestException props are populated + if (((int)resp.StatusCode) >= 400) + request.RootElement = ""; + }; - var response = _client.Execute(request); - var json = Deserialize(response.Content); - var obj = new StripeArray(); - obj.SetModel(json); + var response = _client.Execute(request); + var json = Deserialize(response.Content); + var obj = new StripeArray(); + obj.SetModel(json); - return obj; - } + return obj; + } - private IDictionary Deserialize(string input) - { - if (String.IsNullOrEmpty(input)) - return null; + private IDictionary Deserialize(string input) + { + if (String.IsNullOrEmpty(input)) + return null; - var serializer = new JavaScriptSerializer(); - return serializer.Deserialize>(input); - } - } + var serializer = new JavaScriptSerializer(); + return serializer.Deserialize>(input); + } + } } \ No newline at end of file diff --git a/src/packages.config b/src/packages.config index 51edad8..2c4fa22 100644 --- a/src/packages.config +++ b/src/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file