-
Notifications
You must be signed in to change notification settings - Fork 1
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
7 changed files
with
52 additions
and
7 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 @@ | ||
class AlphaVantageErrorMessage | ||
_response = undefined | ||
|
||
constructor: (response) -> | ||
_response = response | ||
|
||
format: -> | ||
return attachments: [{ color: '#FF0000', title: 'Error Message', text: _response['Error Message'] }] | ||
|
||
toString: -> | ||
return JSON.stringify(@format()) | ||
|
||
module.exports = AlphaVantageErrorMessage |
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,3 @@ | ||
{ | ||
"Error Message": "Invalid API call." | ||
} |
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,17 @@ | ||
source = '../../../lib/alpha_vantage/error_message' | ||
helper = require('../../test_helper') | ||
expect = require('chai').expect | ||
|
||
AlphaVantageErrorMessage = require(source) | ||
describe 'AlphaVantageErrorMessage', -> | ||
subject = undefined | ||
|
||
beforeEach -> | ||
object = { 'Error Message': 'Invalid API call.' } | ||
subject = new AlphaVantageErrorMessage(object) | ||
|
||
describe '#format', -> | ||
it 'returns a object for slack message', () -> | ||
expect(subject.format().attachments).to.have.ordered.deep.members([ | ||
{ color: '#FF0000', title: 'Error Message', text: 'Invalid API call.' } | ||
]) |
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