Skip to content

Commit

Permalink
Add Client#getRestapi
Browse files Browse the repository at this point in the history
  • Loading branch information
r7kamura committed Aug 9, 2015
1 parent 20c086b commit 989fc59
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,16 @@ export default class Client {
).then(source => new Method(source));
}

/**
* @param {String} restapiId
* @return {Promise}
*/
getRestapi({ restapiId }) {
return this.getFetcher().get(
`${this._getBaseUrl()}/restapis/${restapiId}`
).then(source => new Restapi(source));
}

/**
* @param {String} restapiId
* @return {Promise}
Expand Down
18 changes: 18 additions & 0 deletions test/client-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,24 @@ describe('Client', () => {
});
});

describe('#getRestapi', () => {
it('does not raise any error', (done) => {
client.use(
Mock,
{
body: JSON.stringify({}),
headers: {
'Content-Type': 'application/json'
}
}
).getRestapi({
restapiId: 'restapiId'
}).then(() => {
done();
});
});
});

describe('#getRootResource', () => {
it('does not raise any error', (done) => {
client.use(
Expand Down

0 comments on commit 989fc59

Please sign in to comment.