-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
257 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import statements from './statements'; | ||
import invoices from './invoices'; | ||
import contactDetails from './contactDetails'; | ||
|
||
const billing = (configuration) => { | ||
return { | ||
statements: statements(configuration), | ||
invoices: invoices(configuration), | ||
contactDetails: contactDetails(configuration) | ||
} | ||
}; | ||
|
||
export default billing; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import urljoin from 'url-join'; | ||
import http, { utils } from '../../http'; | ||
|
||
export const invoices = (configuration, http) => { | ||
const invoicesBaseUrl = urljoin(configuration.apiBaseUrl, 'account', 'billing', 'invoices'); | ||
const {get} = http; | ||
|
||
return { | ||
encoding: { | ||
list: (limit, offset) => { | ||
let url = urljoin(invoicesBaseUrl, 'encoding'); | ||
let getParams = utils.buildGetParamString({ | ||
limit : limit, | ||
offset: offset | ||
}); | ||
if (getParams.length > 0) { | ||
url = urljoin(url, getParams); | ||
} | ||
return get(configuration, url); | ||
} | ||
}, | ||
player: { | ||
list: (limit, offset) => { | ||
let url = urljoin(invoicesBaseUrl, 'player'); | ||
let getParams = utils.buildGetParamString({ | ||
limit : limit, | ||
offset: offset | ||
}); | ||
if (getParams.length > 0) { | ||
url = urljoin(url, getParams); | ||
} | ||
return get(configuration, url); | ||
} | ||
}, | ||
analytics: { | ||
list: (limit, offset) => { | ||
let url = urljoin(invoicesBaseUrl, 'analytics'); | ||
let getParams = utils.buildGetParamString({ | ||
limit : limit, | ||
offset: offset | ||
}); | ||
if (getParams.length > 0) { | ||
url = urljoin(url, getParams); | ||
} | ||
return get(configuration, url); | ||
} | ||
} | ||
} | ||
}; | ||
|
||
export default (configuration) => { return invoices(configuration, http); }; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import urljoin from 'url-join'; | ||
import http, { utils } from '../../http'; | ||
|
||
export const statements = (configuration, http) => { | ||
const statementsBaseUrl = urljoin(configuration.apiBaseUrl, 'account', 'billing', 'statements'); | ||
const {get} = http; | ||
|
||
return { | ||
encoding: { | ||
list: (limit, offset) => { | ||
let url = urljoin(statementsBaseUrl, 'encoding'); | ||
let getParams = utils.buildGetParamString({ | ||
limit : limit, | ||
offset: offset | ||
}); | ||
if (getParams.length > 0) { | ||
url = urljoin(url, getParams); | ||
} | ||
return get(configuration, url); | ||
} | ||
}, | ||
player: { | ||
list: (limit, offset) => { | ||
let url = urljoin(statementsBaseUrl, 'player'); | ||
let getParams = utils.buildGetParamString({ | ||
limit : limit, | ||
offset: offset | ||
}); | ||
if (getParams.length > 0) { | ||
url = urljoin(url, getParams); | ||
} | ||
return get(configuration, url); | ||
} | ||
}, | ||
analytics: { | ||
list: (limit, offset) => { | ||
let url = urljoin(statementsBaseUrl, 'analytics'); | ||
let getParams = utils.buildGetParamString({ | ||
limit : limit, | ||
offset: offset | ||
}); | ||
if (getParams.length > 0) { | ||
url = urljoin(url, getParams); | ||
} | ||
return get(configuration, url); | ||
} | ||
} | ||
} | ||
}; | ||
|
||
export default (configuration) => { return statements(configuration, http); }; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import { invoices } from '../../../bitmovin/account/billing/invoices' | ||
import { getConfiguration } from '../../utils'; | ||
import { | ||
mockGet, | ||
mockHttp, | ||
assertItReturnsUnderlyingPromise, | ||
assertItCallsCorrectUrl, | ||
testSetup, | ||
} from '../../assertions'; | ||
|
||
let testConfiguration = getConfiguration(); | ||
|
||
describe('account', () => { | ||
beforeEach(testSetup); | ||
describe('billing', () => { | ||
describe('invoices/encodings', () => { | ||
const client = invoices(testConfiguration, mockHttp); | ||
describe('list', () => { | ||
assertItCallsCorrectUrl('GET', '/v1/account/billing/invoices/encoding', client.encoding.list); | ||
assertItReturnsUnderlyingPromise(mockGet, client.encoding.list); | ||
}); | ||
|
||
describe('list with limit offset', () => { | ||
const limit = 100; | ||
const offset = 15; | ||
const expectedGetParameters = '\\?limit\=' + limit + '\&offset=' + offset; | ||
|
||
assertItCallsCorrectUrl('GET', '/v1/account/billing/invoices/encoding' + expectedGetParameters, () => client.encoding.list(limit, offset)); | ||
assertItReturnsUnderlyingPromise(mockGet, client.encoding.list); | ||
}); | ||
}); | ||
|
||
describe('invoices/player', () => { | ||
const client = invoices(testConfiguration, mockHttp); | ||
describe('list', () => { | ||
assertItCallsCorrectUrl('GET', '/v1/account/billing/invoices/player', client.player.list); | ||
assertItReturnsUnderlyingPromise(mockGet, client.player.list); | ||
}); | ||
|
||
describe('list with limit offset', () => { | ||
const limit = 100; | ||
const offset = 15; | ||
const expectedGetParameters = '\\?limit\=' + limit + '\&offset=' + offset; | ||
|
||
assertItCallsCorrectUrl('GET', '/v1/account/billing/invoices/player' + expectedGetParameters, () => client.player.list(limit, offset)); | ||
assertItReturnsUnderlyingPromise(mockGet, client.encoding.list); | ||
}); | ||
}); | ||
|
||
describe('invoices/analytics', () => { | ||
const client = invoices(testConfiguration, mockHttp); | ||
describe('list', () => { | ||
assertItCallsCorrectUrl('GET', '/v1/account/billing/invoices/analytics', client.analytics.list); | ||
assertItReturnsUnderlyingPromise(mockGet, client.player.list); | ||
}); | ||
|
||
describe('list with limit offset', () => { | ||
const limit = 100; | ||
const offset = 15; | ||
const expectedGetParameters = '\\?limit\=' + limit + '\&offset=' + offset; | ||
|
||
assertItCallsCorrectUrl('GET', '/v1/account/billing/invoices/analytics' + expectedGetParameters, () => client.analytics.list(limit, offset)); | ||
assertItReturnsUnderlyingPromise(mockGet, client.encoding.list); | ||
}); | ||
}); | ||
}); | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import { statements } from '../../../bitmovin/account/billing/statements'; | ||
import { getConfiguration } from '../../utils'; | ||
import { | ||
mockGet, | ||
mockHttp, | ||
assertItReturnsUnderlyingPromise, | ||
assertItCallsCorrectUrl, | ||
testSetup, | ||
} from '../../assertions'; | ||
|
||
let testConfiguration = getConfiguration(); | ||
|
||
describe('account', () => { | ||
beforeEach(testSetup); | ||
describe('billing', () => { | ||
describe('statements/encodings', () => { | ||
const client = statements(testConfiguration, mockHttp); | ||
describe('list', () => { | ||
assertItCallsCorrectUrl('GET', '/v1/account/billing/statements/encoding', client.encoding.list); | ||
assertItReturnsUnderlyingPromise(mockGet, client.encoding.list); | ||
}); | ||
|
||
describe('list with limit offset', () => { | ||
const limit = 100; | ||
const offset = 15; | ||
const expectedGetParameters = '\\?limit\=' + limit + '\&offset=' + offset; | ||
|
||
assertItCallsCorrectUrl('GET', '/v1/account/billing/statements/encoding' + expectedGetParameters, () => client.encoding.list(limit, offset)); | ||
assertItReturnsUnderlyingPromise(mockGet, client.encoding.list); | ||
}); | ||
}); | ||
|
||
describe('statements/player', () => { | ||
const client = statements(testConfiguration, mockHttp); | ||
describe('list', () => { | ||
assertItCallsCorrectUrl('GET', '/v1/account/billing/statements/player', client.player.list); | ||
assertItReturnsUnderlyingPromise(mockGet, client.player.list); | ||
}); | ||
|
||
describe('list with limit offset', () => { | ||
const limit = 100; | ||
const offset = 15; | ||
const expectedGetParameters = '\\?limit\=' + limit + '\&offset=' + offset; | ||
|
||
assertItCallsCorrectUrl('GET', '/v1/account/billing/statements/player' + expectedGetParameters, () => client.player.list(limit, offset)); | ||
assertItReturnsUnderlyingPromise(mockGet, client.encoding.list); | ||
}); | ||
}); | ||
|
||
describe('statements/analytics', () => { | ||
const client = statements(testConfiguration, mockHttp); | ||
describe('list', () => { | ||
assertItCallsCorrectUrl('GET', '/v1/account/billing/statements/analytics', client.analytics.list); | ||
assertItReturnsUnderlyingPromise(mockGet, client.player.list); | ||
}); | ||
|
||
describe('list with limit offset', () => { | ||
const limit = 100; | ||
const offset = 15; | ||
const expectedGetParameters = '\\?limit\=' + limit + '\&offset=' + offset; | ||
|
||
assertItCallsCorrectUrl('GET', '/v1/account/billing/statements/analytics' + expectedGetParameters, () => client.analytics.list(limit, offset)); | ||
assertItReturnsUnderlyingPromise(mockGet, client.encoding.list); | ||
}); | ||
}); | ||
}); | ||
}); | ||
|