Skip to content

Commit

Permalink
Merge pull request #69 from Cox-Automotive/fix-get-login-role
Browse files Browse the repository at this point in the history
Fix get login role
  • Loading branch information
americk0 committed Apr 20, 2021
2 parents da8e772 + 7d0b339 commit b8ef7da
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 17 deletions.
5 changes: 2 additions & 3 deletions dist/alks.cjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,6 @@ class alks {
* @param {Object} props - An object containing the following properties
* @param {string} props.accountId - The 12-digit account ID associated with the custom role
* @param {string} props.role - The user's role associated with the account
* @param {number} props.maxKeyDuration - The maximum key duration for this account
* @returns {Promise<Object>}
* @example
* alks.getLoginRole({
Expand All @@ -730,8 +729,8 @@ class alks {
*/
getLoginRole(props) {
const {accountId, role} = props;
return this._doFetch(`loginRoles/id/${accountId}/${role}`, null).then((results) =>
pick(results, ['account', 'role', 'iamKeyActive', 'maxKeyDuration']))
return this._doFetch(`loginRoles/id/${accountId}/${role}`, null, 'GET').then((results) =>
pick(results.loginRole, ['account', 'role', 'iamKeyActive', 'maxKeyDuration']))
}

/**
Expand Down
5 changes: 2 additions & 3 deletions dist/alks.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,6 @@ class alks {
* @param {Object} props - An object containing the following properties
* @param {string} props.accountId - The 12-digit account ID associated with the custom role
* @param {string} props.role - The user's role associated with the account
* @param {number} props.maxKeyDuration - The maximum key duration for this account
* @returns {Promise<Object>}
* @example
* alks.getLoginRole({
Expand All @@ -727,8 +726,8 @@ class alks {
*/
getLoginRole(props) {
const {accountId, role} = props;
return this._doFetch(`loginRoles/id/${accountId}/${role}`, null).then((results) =>
pick(results, ['account', 'role', 'iamKeyActive', 'maxKeyDuration']))
return this._doFetch(`loginRoles/id/${accountId}/${role}`, null, 'GET').then((results) =>
pick(results.loginRole, ['account', 'role', 'iamKeyActive', 'maxKeyDuration']))
}

/**
Expand Down
2 changes: 1 addition & 1 deletion dist/alks.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions dist/alks.umd.js
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,6 @@
* @param {Object} props - An object containing the following properties
* @param {string} props.accountId - The 12-digit account ID associated with the custom role
* @param {string} props.role - The user's role associated with the account
* @param {number} props.maxKeyDuration - The maximum key duration for this account
* @returns {Promise<Object>}
* @example
* alks.getLoginRole({
Expand All @@ -725,7 +724,7 @@
alks.prototype.getLoginRole = function getLoginRole (props) {
var accountId = props.accountId;
var role = props.role;
return this._doFetch(("loginRoles/id/" + accountId + "/" + role), null).then(function (results) { return pick(results, ['account', 'role', 'iamKeyActive', 'maxKeyDuration']); })
return this._doFetch(("loginRoles/id/" + accountId + "/" + role), null, 'GET').then(function (results) { return pick(results.loginRole, ['account', 'role', 'iamKeyActive', 'maxKeyDuration']); })
};

/**
Expand Down
1 change: 0 additions & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@ declare namespace ALKS {
export interface GetLoginRoleProps {
accountId: string;
role: string;
maxKeyDuration: number;
}

export interface GetAccessTokenProps extends Partial<AlksProps> {
Expand Down
5 changes: 2 additions & 3 deletions src/alks.js
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,6 @@ class alks {
* @param {Object} props - An object containing the following properties
* @param {string} props.accountId - The 12-digit account ID associated with the custom role
* @param {string} props.role - The user's role associated with the account
* @param {number} props.maxKeyDuration - The maximum key duration for this account
* @returns {Promise<Object>}
* @example
* alks.getLoginRole({
Expand All @@ -729,8 +728,8 @@ class alks {
*/
getLoginRole(props) {
const {accountId, role} = props
return this._doFetch(`loginRoles/id/${accountId}/${role}`, null).then((results) =>
pick(results, ['account', 'role', 'iamKeyActive', 'maxKeyDuration']))
return this._doFetch(`loginRoles/id/${accountId}/${role}`, null, 'GET').then((results) =>
pick(results.loginRole, ['account', 'role', 'iamKeyActive', 'maxKeyDuration']))
}

/**
Expand Down
10 changes: 6 additions & 4 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -716,10 +716,12 @@ describe('alks.js', function() {

const _fetch = fetchMock.sandbox().mock(`${baseUrl}/loginRoles/id/${accountId}/${role}`, {
body: {
account,
role,
iamKeyActive,
maxKeyDuration
loginRole: {
account,
role,
iamKeyActive,
maxKeyDuration
}
},
status: 200
})
Expand Down

0 comments on commit b8ef7da

Please sign in to comment.