Skip to content

Commit d073925

Browse files
author
dmoser
committed
Merge branch 'release/v1.1.18'
2 parents dbfa553 + a9f06ad commit d073925

File tree

8 files changed

+257
-4
lines changed

8 files changed

+257
-4
lines changed

bitmovin/account/account.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import urljoin from 'url-join';
22
import http from '../http';
33
import organizations from './organizations/organizations.js';
4-
import contactDetails from './billing/contactDetails.js';
4+
import billing from './billing/billing';
55

66
export const account = (configuration, http) => {
77
const { get, post } = http;
@@ -37,7 +37,7 @@ export const account = (configuration, http) => {
3737
information,
3838
login,
3939
changePassword,
40-
contactDetails: contactDetails(configuration),
40+
billing: billing(configuration),
4141
organizations: organizations(configuration)
4242
};
4343
};
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import statements from './statements';
2+
import invoices from './invoices';
3+
import contactDetails from './contactDetails';
4+
5+
const billing = (configuration) => {
6+
return {
7+
statements: statements(configuration),
8+
invoices: invoices(configuration),
9+
contactDetails: contactDetails(configuration)
10+
}
11+
};
12+
13+
export default billing;
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import urljoin from 'url-join';
2+
import http, { utils } from '../../http';
3+
4+
export const invoices = (configuration, http) => {
5+
const invoicesBaseUrl = urljoin(configuration.apiBaseUrl, 'account', 'billing', 'invoices');
6+
const {get} = http;
7+
8+
return {
9+
encoding: {
10+
list: (limit, offset) => {
11+
let url = urljoin(invoicesBaseUrl, 'encoding');
12+
let getParams = utils.buildGetParamString({
13+
limit : limit,
14+
offset: offset
15+
});
16+
if (getParams.length > 0) {
17+
url = urljoin(url, getParams);
18+
}
19+
return get(configuration, url);
20+
}
21+
},
22+
player: {
23+
list: (limit, offset) => {
24+
let url = urljoin(invoicesBaseUrl, 'player');
25+
let getParams = utils.buildGetParamString({
26+
limit : limit,
27+
offset: offset
28+
});
29+
if (getParams.length > 0) {
30+
url = urljoin(url, getParams);
31+
}
32+
return get(configuration, url);
33+
}
34+
},
35+
analytics: {
36+
list: (limit, offset) => {
37+
let url = urljoin(invoicesBaseUrl, 'analytics');
38+
let getParams = utils.buildGetParamString({
39+
limit : limit,
40+
offset: offset
41+
});
42+
if (getParams.length > 0) {
43+
url = urljoin(url, getParams);
44+
}
45+
return get(configuration, url);
46+
}
47+
}
48+
}
49+
};
50+
51+
export default (configuration) => { return invoices(configuration, http); };
52+
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import urljoin from 'url-join';
2+
import http, { utils } from '../../http';
3+
4+
export const statements = (configuration, http) => {
5+
const statementsBaseUrl = urljoin(configuration.apiBaseUrl, 'account', 'billing', 'statements');
6+
const {get} = http;
7+
8+
return {
9+
encoding: {
10+
list: (limit, offset) => {
11+
let url = urljoin(statementsBaseUrl, 'encoding');
12+
let getParams = utils.buildGetParamString({
13+
limit : limit,
14+
offset: offset
15+
});
16+
if (getParams.length > 0) {
17+
url = urljoin(url, getParams);
18+
}
19+
return get(configuration, url);
20+
}
21+
},
22+
player: {
23+
list: (limit, offset) => {
24+
let url = urljoin(statementsBaseUrl, 'player');
25+
let getParams = utils.buildGetParamString({
26+
limit : limit,
27+
offset: offset
28+
});
29+
if (getParams.length > 0) {
30+
url = urljoin(url, getParams);
31+
}
32+
return get(configuration, url);
33+
}
34+
},
35+
analytics: {
36+
list: (limit, offset) => {
37+
let url = urljoin(statementsBaseUrl, 'analytics');
38+
let getParams = utils.buildGetParamString({
39+
limit : limit,
40+
offset: offset
41+
});
42+
if (getParams.length > 0) {
43+
url = urljoin(url, getParams);
44+
}
45+
return get(configuration, url);
46+
}
47+
}
48+
}
49+
};
50+
51+
export default (configuration) => { return statements(configuration, http); };
52+

examples/encoding/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "bitmovin-javascript-examples",
33
"version": "0.0.1",
44
"dependencies": {
5-
"bitmovin-javascript": "1.1.17",
5+
"bitmovin-javascript": "1.1.18",
66
"bluebird": "^3.4.7"
77
}
88
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "bitmovin-javascript",
3-
"version": "1.1.17",
3+
"version": "1.1.18",
44
"scripts": {
55
"lint": "./node_modules/eslint/bin/eslint.js --color ./bitmovin",
66
"test": "node scripts/testRunner.js tests/",
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
import { invoices } from '../../../bitmovin/account/billing/invoices'
2+
import { getConfiguration } from '../../utils';
3+
import {
4+
mockGet,
5+
mockHttp,
6+
assertItReturnsUnderlyingPromise,
7+
assertItCallsCorrectUrl,
8+
testSetup,
9+
} from '../../assertions';
10+
11+
let testConfiguration = getConfiguration();
12+
13+
describe('account', () => {
14+
beforeEach(testSetup);
15+
describe('billing', () => {
16+
describe('invoices/encodings', () => {
17+
const client = invoices(testConfiguration, mockHttp);
18+
describe('list', () => {
19+
assertItCallsCorrectUrl('GET', '/v1/account/billing/invoices/encoding', client.encoding.list);
20+
assertItReturnsUnderlyingPromise(mockGet, client.encoding.list);
21+
});
22+
23+
describe('list with limit offset', () => {
24+
const limit = 100;
25+
const offset = 15;
26+
const expectedGetParameters = '\\?limit\=' + limit + '\&offset=' + offset;
27+
28+
assertItCallsCorrectUrl('GET', '/v1/account/billing/invoices/encoding' + expectedGetParameters, () => client.encoding.list(limit, offset));
29+
assertItReturnsUnderlyingPromise(mockGet, client.encoding.list);
30+
});
31+
});
32+
33+
describe('invoices/player', () => {
34+
const client = invoices(testConfiguration, mockHttp);
35+
describe('list', () => {
36+
assertItCallsCorrectUrl('GET', '/v1/account/billing/invoices/player', client.player.list);
37+
assertItReturnsUnderlyingPromise(mockGet, client.player.list);
38+
});
39+
40+
describe('list with limit offset', () => {
41+
const limit = 100;
42+
const offset = 15;
43+
const expectedGetParameters = '\\?limit\=' + limit + '\&offset=' + offset;
44+
45+
assertItCallsCorrectUrl('GET', '/v1/account/billing/invoices/player' + expectedGetParameters, () => client.player.list(limit, offset));
46+
assertItReturnsUnderlyingPromise(mockGet, client.encoding.list);
47+
});
48+
});
49+
50+
describe('invoices/analytics', () => {
51+
const client = invoices(testConfiguration, mockHttp);
52+
describe('list', () => {
53+
assertItCallsCorrectUrl('GET', '/v1/account/billing/invoices/analytics', client.analytics.list);
54+
assertItReturnsUnderlyingPromise(mockGet, client.player.list);
55+
});
56+
57+
describe('list with limit offset', () => {
58+
const limit = 100;
59+
const offset = 15;
60+
const expectedGetParameters = '\\?limit\=' + limit + '\&offset=' + offset;
61+
62+
assertItCallsCorrectUrl('GET', '/v1/account/billing/invoices/analytics' + expectedGetParameters, () => client.analytics.list(limit, offset));
63+
assertItReturnsUnderlyingPromise(mockGet, client.encoding.list);
64+
});
65+
});
66+
});
67+
});
68+
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
import { statements } from '../../../bitmovin/account/billing/statements';
2+
import { getConfiguration } from '../../utils';
3+
import {
4+
mockGet,
5+
mockHttp,
6+
assertItReturnsUnderlyingPromise,
7+
assertItCallsCorrectUrl,
8+
testSetup,
9+
} from '../../assertions';
10+
11+
let testConfiguration = getConfiguration();
12+
13+
describe('account', () => {
14+
beforeEach(testSetup);
15+
describe('billing', () => {
16+
describe('statements/encodings', () => {
17+
const client = statements(testConfiguration, mockHttp);
18+
describe('list', () => {
19+
assertItCallsCorrectUrl('GET', '/v1/account/billing/statements/encoding', client.encoding.list);
20+
assertItReturnsUnderlyingPromise(mockGet, client.encoding.list);
21+
});
22+
23+
describe('list with limit offset', () => {
24+
const limit = 100;
25+
const offset = 15;
26+
const expectedGetParameters = '\\?limit\=' + limit + '\&offset=' + offset;
27+
28+
assertItCallsCorrectUrl('GET', '/v1/account/billing/statements/encoding' + expectedGetParameters, () => client.encoding.list(limit, offset));
29+
assertItReturnsUnderlyingPromise(mockGet, client.encoding.list);
30+
});
31+
});
32+
33+
describe('statements/player', () => {
34+
const client = statements(testConfiguration, mockHttp);
35+
describe('list', () => {
36+
assertItCallsCorrectUrl('GET', '/v1/account/billing/statements/player', client.player.list);
37+
assertItReturnsUnderlyingPromise(mockGet, client.player.list);
38+
});
39+
40+
describe('list with limit offset', () => {
41+
const limit = 100;
42+
const offset = 15;
43+
const expectedGetParameters = '\\?limit\=' + limit + '\&offset=' + offset;
44+
45+
assertItCallsCorrectUrl('GET', '/v1/account/billing/statements/player' + expectedGetParameters, () => client.player.list(limit, offset));
46+
assertItReturnsUnderlyingPromise(mockGet, client.encoding.list);
47+
});
48+
});
49+
50+
describe('statements/analytics', () => {
51+
const client = statements(testConfiguration, mockHttp);
52+
describe('list', () => {
53+
assertItCallsCorrectUrl('GET', '/v1/account/billing/statements/analytics', client.analytics.list);
54+
assertItReturnsUnderlyingPromise(mockGet, client.player.list);
55+
});
56+
57+
describe('list with limit offset', () => {
58+
const limit = 100;
59+
const offset = 15;
60+
const expectedGetParameters = '\\?limit\=' + limit + '\&offset=' + offset;
61+
62+
assertItCallsCorrectUrl('GET', '/v1/account/billing/statements/analytics' + expectedGetParameters, () => client.analytics.list(limit, offset));
63+
assertItReturnsUnderlyingPromise(mockGet, client.encoding.list);
64+
});
65+
});
66+
});
67+
});
68+

0 commit comments

Comments
 (0)