Skip to content

Commit 448674e

Browse files
authored
Merge pull request #58 from aspose-pdf-cloud/develop
update to 21.11
2 parents c10f205 + 12e8fc5 commit 448674e

File tree

7 files changed

+67
-59
lines changed

7 files changed

+67
-59
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ project.lock.json
207207
src/Settings/servercreds.json
208208

209209
.swagger-codegen/
210+
.vscode/
210211

211212
build-out/
212213
nuget.exe

README.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,16 @@ Extract Text & Images of a PDF document online https://products.aspose.app/pdf/p
2222
- Extract various elements of PDF files & make PDF documents optimized.
2323

2424
## Read & Write PDF Formats
25-
2625
PDF, EPUB, HTML, TeX, SVG, XML, XPS, FDF, XFDF
26+
2727
## Save PDF As
2828
XLS, XLSX, PPTX, DOC, DOCX, MobiXML, JPEG, EMF, PNG, BMP, GIF, TIFF, Text
29+
2930
## Read PDF Formats
3031
MHT, PCL, PS, XSLFO, MD
3132

32-
## Enhancements in Version 21.10
33-
- A new version of Aspose.PDF Cloud was prepared using the latest version of Aspose.PDF for .Net.
34-
35-
## Enhancements in Version 21.9
36-
- A new version of Aspose.PDF Cloud was prepared using the latest version of Aspose.PDF for .Net.
33+
## Enhancements in Version 21.11
34+
- A new version of Aspose.PDF Cloud was prepared using the latest version of Aspose.PDF for .NET.
3735

3836
## Unit Tests
3937
Aspose PDF SDK includes a suite of unit tests. These Unit Tests also serves as examples of how to use the Aspose PDF SDK.
@@ -50,6 +48,7 @@ The DLLs included in the package may not be the latest version. We recommend usi
5048
Install-Package RestSharp
5149
Install-Package Newtonsoft.Json
5250
```
51+
5352
## Convert PDF to Epub in Dotnet
5453

5554
```csharp

src/Aspose.Pdf.Cloud.Sdk.Test/TestBase.cs

Lines changed: 49 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -23,68 +23,70 @@
2323
// </summary>
2424
// --------------------------------------------------------------------------------------------------------------------
2525

26+
using System;
2627
using System.IO;
27-
using System.Net.Http;
28-
using System.Threading.Tasks;
2928
using Aspose.Pdf.Cloud.Sdk.Api;
3029
using Aspose.Pdf.Cloud.Sdk.Client;
3130
using Newtonsoft.Json;
3231
using NUnit.Framework;
3332

34-
namespace Aspose.Pdf.Cloud.Sdk.Test
35-
{
36-
public abstract class TestsBase
37-
{
38-
private const string BaseProductUri = @"https://api.aspose.cloud";
33+
namespace Aspose.Pdf.Cloud.Sdk.Test {
3934

40-
protected const string TestDataFolder = @"..\..\..\..\testData";
41-
private const string ServerCredsFile = @"..\..\..\Settings\servercreds.json";
35+
public abstract class TestsBase {
4236

43-
protected const string TempFolder = "TempPdfCloud";
37+
private const string BaseProductUri = @"https://api.aspose.cloud";
38+
protected const string TestDataFolder = @"..\..\..\..\testData";
39+
private const string ServerCredsFile = @"Settings\servercreds.json";
40+
protected const string TempFolder = "TempPdfCloud";
4441

45-
private Keys keys;
46-
47-
[SetUp]
48-
public virtual void SetUp()
49-
{
50-
// To run tests with your own credentials please uncomment following line of code
51-
// this.keys = new Keys { AppKey = "your app key", AppSID = "your app sid" };
52-
if (null == keys)
53-
{
54-
keys = JsonConvert.DeserializeObject<Keys>(File.ReadAllText(ServerCredsFile));
55-
}
42+
private class Keys {
43+
public string AppSID { get; set; }
44+
public string AppKey { get; set; }
45+
}
5646

57-
if (string.IsNullOrEmpty(keys?.AppKey) || string.IsNullOrEmpty(keys.AppSID))
58-
{
59-
throw new FileNotFoundException("servercreds.json doesn't contain AppKey and AppSid");
60-
}
47+
private Keys keys;
6148

62-
Configuration = new Configuration(keys.AppKey, keys.AppSID, BaseProductUri);
63-
PdfApi = new PdfApi(Configuration);
64-
}
65-
66-
[TearDown]
67-
public virtual void TearDown()
68-
{
49+
private string _GetServercredsJson() {
50+
DirectoryInfo di = Directory.GetParent(Directory.GetCurrentDirectory());
51+
while (di != null) {
52+
string servercreds_json = Path.Combine(di.FullName, ServerCredsFile);
53+
if (File.Exists(servercreds_json)) {
54+
return servercreds_json;
6955
}
56+
di = Directory.GetParent(di.FullName);
57+
}
58+
return null;
59+
}
7060

71-
protected PdfApi PdfApi { get; set; }
72-
protected Configuration Configuration { get; private set; }
61+
private Keys _GetKeys() {
62+
return JsonConvert.DeserializeObject<Keys>(File.ReadAllText(_GetServercredsJson()));
63+
}
7364

65+
[SetUp]
66+
public virtual void SetUp() {
67+
Console.WriteLine(TestContext.CurrentContext.Test.Name);
68+
// To run tests with your own credentials please uncomment following line of code
69+
// this.keys = new Keys { AppKey = "your app key", AppSID = "your app sid" };
70+
if (keys == null) {
71+
keys = _GetKeys();
72+
}
73+
if (string.IsNullOrEmpty(keys.AppKey) || string.IsNullOrEmpty(keys.AppSID)) {
74+
throw new FileNotFoundException("servercreds.json doesn't contain AppSID and/or AppKey");
75+
}
76+
Configuration = new Configuration(keys.AppKey, keys.AppSID, BaseProductUri);
77+
PdfApi = new PdfApi(Configuration);
78+
}
7479

75-
protected void UploadFile(string sourcePath, string serverFileName)
76-
{
77-
using (var file = File.OpenRead(Path.Combine(TestDataFolder, sourcePath)))
78-
{
79-
var response = PdfApi.UploadFile(Path.Combine(TempFolder, serverFileName), file);
80-
}
81-
}
80+
[TearDown]
81+
public virtual void TearDown() { }
8282

83-
private class Keys
84-
{
85-
public string AppSID { get; set; }
83+
protected PdfApi PdfApi { get; set; }
84+
protected Configuration Configuration { get; private set; }
8685

87-
public string AppKey { get; set; }
88-
}
86+
protected void UploadFile(string sourcePath, string serverFileName) {
87+
using (var file = File.OpenRead(Path.Combine(TestDataFolder, sourcePath))) {
88+
Model.FilesUploadResult response = PdfApi.UploadFile(Path.Combine(TempFolder, serverFileName), file);
89+
}
8990
}
90-
}
91+
}
92+
}

src/Aspose.Pdf.Cloud.Sdk/Aspose.Pdf.Cloud.Sdk.nuspec

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,14 @@ https://stackoverflow.com/questions/tagged/aspose.pdf</description>
4747

4848
<!-- Dependencies are automatically installed when the package is installed -->
4949
<dependencies>
50-
<dependency id="NewtonSoft.Json" version="12.0.3" />
51-
<dependency id="RestSharp" version="106.12.0" />
50+
<group targetFramework=".NETFramework4.5">
51+
<dependency id="NewtonSoft.Json" version="12.0.3" />
52+
<dependency id="RestSharp" version="106.12.0" />
53+
</group>
54+
<group targetFramework=".NETStandard2.0">
55+
<dependency id="NewtonSoft.Json" version="12.0.3" />
56+
<dependency id="RestSharp" version="106.12.0" />
57+
</group>
5258
</dependencies>
5359
</metadata>
5460
<files>

src/Aspose.Pdf.Cloud.Sdk/Client/ApiClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ private RestRequest PrepareRequest(
205205

206206
// add custom header
207207
request.AddHeader(AsposeClientHeaderName, ".net sdk");
208-
request.AddHeader(AsposeClientVersionHeaderName, "21.10.0");
208+
request.AddHeader(AsposeClientVersionHeaderName, "21.11.0");
209209

210210
// add header parameter, if any
211211
foreach(var param in headerParams)

src/Aspose.Pdf.Cloud.Sdk/Client/Configuration.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ public static String ToDebugReport()
222222
.GetReferencedAssemblies()
223223
.Where(x => x.Name == "System.Core").First().Version.ToString() + "\n";
224224
report += " Version of the API: 3.0\n";
225-
report += " SDK Package Version: 21.10.0\n";
225+
report += " SDK Package Version: 21.11.0\n";
226226

227227
return report;
228228
}

src/Aspose.Pdf.Cloud.Sdk/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@
2828
// You can specify all the values or you can default the Build and Revision Numbers
2929
// by using the '*' as shown below:
3030
// [assembly: AssemblyVersion("1.0.*")]
31-
[assembly: AssemblyVersion("21.10.0")]
32-
[assembly: AssemblyFileVersion("21.10.0")]
31+
[assembly: AssemblyVersion("21.11.0")]
32+
[assembly: AssemblyFileVersion("21.11.0")]

0 commit comments

Comments
 (0)