Skip to content

Commit 27bef83

Browse files
Ivan KamkinIvan Kamkin
authored andcommitted
Access token env var renamed
Config with token fixed in snippets
1 parent 1d7aa07 commit 27bef83

32 files changed

+96
-89
lines changed

Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ npm-test:
3131
npm test
3232

3333
.PHONY: test
34-
test: npm-test example
34+
test: npm-test example snippets
3535

3636
.PHONY: cover
3737
cover:
@@ -65,6 +65,11 @@ publish-docker: init test
6565
example:
6666
./scripts/run_example.sh
6767

68+
.PHONY: snippets
69+
snippets:
70+
chmod +x scripts/*
71+
./scripts/run_snippets.sh
72+
6873
.PHONY: insert-example
6974
insert-example:
7075
./scripts/insert-example.bash

example.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ async function generateBarcode(api) {
2323

2424
async function scanBarcode(api, fileName) {
2525

26-
const requestFile = new RequestFile('file', fileName, fs.readFileSync(fileName));
27-
const scanRequest = new Barcode.ScanMultipartRequestWrapper(requestFile);
26+
const scanRequest = new Barcode.ScanMultipartRequestWrapper(fs.readFileSync(fileName));
2827
const result = await api.scanMultipart(scanRequest);
2928

3029
return result.body.barcodes;

snippets/generate/appearance/generateBody.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ const path = require('path');
33
const Barcode = require('aspose-barcode-cloud-node');
44

55
function makeConfiguration() {
6-
const envToken = process.env['TEST_CONFIGURATION_JWT_TOKEN'];
6+
const envToken = process.env['TEST_CONFIGURATION_ACCESS_TOKEN'];
7+
console.log("Start config");
78
if (!envToken) {
89
return new Barcode.Configuration(
910
'Client Id from https://dashboard.aspose.cloud/applications',
@@ -15,14 +16,15 @@ function makeConfiguration() {
1516
return new Barcode.Configuration(
1617
null,
1718
null,
18-
envToken,
19-
null
19+
null,
20+
envToken
2021
);
2122
}
2223
}
2324
const config = makeConfiguration();
2425

2526
async function generateBarcode(api, fileName) {
27+
2628
const imageParams = new Barcode.BarcodeImageParams();
2729
imageParams.foregroundColor = "#FF0000";
2830
imageParams.backgroundColor = "#FFFF00";
@@ -44,10 +46,11 @@ async function generateBarcode(api, fileName) {
4446

4547
fs.writeFileSync(fileName, generated.body);
4648
}
47-
4849
const genApi = new Barcode.GenerateApi(config);
50+
4951
const fileName = path.resolve('testdata', 'Code39.png');
5052

53+
5154
generateBarcode(genApi, fileName)
5255
.then(() => {
5356
console.log('Barcode saved to ' + fileName);

snippets/generate/appearance/generateGet.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const path = require('path');
33
const Barcode = require('aspose-barcode-cloud-node');
44

55
function makeConfiguration() {
6-
const envToken = process.env['TEST_CONFIGURATION_JWT_TOKEN'];
6+
const envToken = process.env['TEST_CONFIGURATION_ACCESS_TOKEN'];
77
if (!envToken) {
88
return new Barcode.Configuration(
99
'Client Id from https://dashboard.aspose.cloud/applications',
@@ -15,8 +15,8 @@ function makeConfiguration() {
1515
return new Barcode.Configuration(
1616
null,
1717
null,
18-
envToken,
19-
null
18+
null,
19+
envToken
2020
);
2121
}
2222
}

snippets/generate/appearance/generateMultipart.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const path = require('path');
33
const Barcode = require('aspose-barcode-cloud-node');
44

55
function makeConfiguration() {
6-
const envToken = process.env['TEST_CONFIGURATION_JWT_TOKEN'];
6+
const envToken = process.env['TEST_CONFIGURATION_ACCESS_TOKEN'];
77
if (!envToken) {
88
return new Barcode.Configuration(
99
'Client Id from https://dashboard.aspose.cloud/applications',
@@ -15,8 +15,8 @@ function makeConfiguration() {
1515
return new Barcode.Configuration(
1616
null,
1717
null,
18-
envToken,
19-
null
18+
null,
19+
envToken
2020
);
2121
}
2222
}

snippets/generate/save/generateBody.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const path = require('path');
33
const Barcode = require('aspose-barcode-cloud-node');
44

55
function makeConfiguration() {
6-
const envToken = process.env['TEST_CONFIGURATION_JWT_TOKEN'];
6+
const envToken = process.env['TEST_CONFIGURATION_ACCESS_TOKEN'];
77
if (!envToken) {
88
return new Barcode.Configuration(
99
'Client Id from https://dashboard.aspose.cloud/applications',
@@ -15,8 +15,8 @@ function makeConfiguration() {
1515
return new Barcode.Configuration(
1616
null,
1717
null,
18-
envToken,
19-
null
18+
null,
19+
envToken
2020
);
2121
}
2222
}

snippets/generate/save/generateGet.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const path = require('path');
33
const Barcode = require('aspose-barcode-cloud-node');
44

55
function makeConfiguration() {
6-
const envToken = process.env['TEST_CONFIGURATION_JWT_TOKEN'];
6+
const envToken = process.env['TEST_CONFIGURATION_ACCESS_TOKEN'];
77
if (!envToken) {
88
return new Barcode.Configuration(
99
'Client Id from https://dashboard.aspose.cloud/applications',
@@ -15,8 +15,8 @@ function makeConfiguration() {
1515
return new Barcode.Configuration(
1616
null,
1717
null,
18-
envToken,
19-
null
18+
null,
19+
envToken
2020
);
2121
}
2222
}

snippets/generate/save/generateMultipart.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const path = require('path');
33
const Barcode = require('aspose-barcode-cloud-node');
44

55
function makeConfiguration() {
6-
const envToken = process.env['TEST_CONFIGURATION_JWT_TOKEN'];
6+
const envToken = process.env['TEST_CONFIGURATION_ACCESS_TOKEN'];
77
if (!envToken) {
88
return new Barcode.Configuration(
99
'Client Id from https://dashboard.aspose.cloud/applications',
@@ -15,8 +15,8 @@ function makeConfiguration() {
1515
return new Barcode.Configuration(
1616
null,
1717
null,
18-
envToken,
19-
null
18+
null,
19+
envToken
2020
);
2121
}
2222
}

snippets/generate/set-colorscheme/generateBody.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const path = require('path');
33
const Barcode = require('aspose-barcode-cloud-node');
44

55
function makeConfiguration() {
6-
const envToken = process.env['TEST_CONFIGURATION_JWT_TOKEN'];
6+
const envToken = process.env['TEST_CONFIGURATION_ACCESS_TOKEN'];
77
if (!envToken) {
88
return new Barcode.Configuration(
99
'Client Id from https://dashboard.aspose.cloud/applications',
@@ -15,8 +15,8 @@ function makeConfiguration() {
1515
return new Barcode.Configuration(
1616
null,
1717
null,
18-
envToken,
19-
null
18+
null,
19+
envToken
2020
);
2121
}
2222
}

snippets/generate/set-colorscheme/generateGet.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const path = require('path');
33
const Barcode = require('aspose-barcode-cloud-node');
44

55
function makeConfiguration() {
6-
const envToken = process.env['TEST_CONFIGURATION_JWT_TOKEN'];
6+
const envToken = process.env['TEST_CONFIGURATION_ACCESS_TOKEN'];
77
if (!envToken) {
88
return new Barcode.Configuration(
99
'Client Id from https://dashboard.aspose.cloud/applications',
@@ -15,8 +15,8 @@ function makeConfiguration() {
1515
return new Barcode.Configuration(
1616
null,
1717
null,
18-
envToken,
19-
null
18+
null,
19+
envToken
2020
);
2121
}
2222
}

0 commit comments

Comments
 (0)