Skip to content
This repository was archived by the owner on Sep 27, 2023. It is now read-only.

Remove v2 code#85

Merged
akiomik merged 1 commit intodevelopmentfrom
remove-v2-code
Jun 17, 2022
Merged

Remove v2 code#85
akiomik merged 1 commit intodevelopmentfrom
remove-v2-code

Conversation

@akiomik
Copy link
Copy Markdown
Contributor

@akiomik akiomik commented Jun 15, 2022

BCODE 関数のv2形式での実装を削除し、v2スタイルの BCODE 関数で実行された際にはエラーを出すようにします。

また、v2に依存している BCODE_LABEL 関数および BCODE_UNIT 関数を廃止します。
これらはすでにドキュメントからも削除されており、usageでも「近日廃止予定」としていたものです。

スクリーンショット 2022-06-15 16 39 36

@akiomik akiomik added the enhancement New feature or request label Jun 15, 2022
@akiomik akiomik requested a review from shoe116 June 15, 2022 07:46
@akiomik akiomik self-assigned this Jun 15, 2022
Comment on lines -18 to +24
company(): object {
company(ticker: string): object {
if (ticker !== '2371') {
const res = new HTTPResnpose()
throw new HttpError('/v3/company', res)
}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

テスト用にfixtureとして用意しているデータが2371のものなので、2371以外のリクエストが来た際には404扱いのエラーを返すようにする

Comment on lines -13 to -15
static putAll(companies: object): void {
Object.keys(companies).forEach(ticker => CompanyCache.put(ticker, companies[ticker][0]))
}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

完全にv2用のI/Fで使いにくい && v3では使わないので削除します。

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

潔い

Comment on lines -20 to -22
public isSupportedTicker(): boolean {
return !!this.company
}
Copy link
Copy Markdown
Contributor Author

@akiomik akiomik Jun 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

v2クライアントでは対象trickerがないに client.company(ticker) がnullを返す可能性があった (HTTPリクエストは成功しているがレスポンス中に当該tickerがない場合) のですが、v3クライアントは対象trickerがないときにはnullではなく例外を出すようになっているため、 isSupportedTicker() でデータが取れたかどうかの確認を行う必要はなくなりました。

Comment on lines +44 to +46
const message =
'BCODE(ticker, FY, FQ, name)の形式は現在サポートしていません。BCODE(ticker, FYFQ, name)をご利用ください。'
throw new Error(message)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

v2形式でアクセスされた場合のエラー文言

@akiomik akiomik merged commit cb95144 into development Jun 17, 2022
@akiomik akiomik deleted the remove-v2-code branch June 17, 2022 01:14
@akiomik akiomik mentioned this pull request Jun 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants