Skip to content

ISIN mapping endpoint was added.#64

Merged
bguban merged 1 commit intodblock:masterfrom
bguban:isin_endpoint
Mar 5, 2020
Merged

ISIN mapping endpoint was added.#64
bguban merged 1 commit intodblock:masterfrom
bguban:isin_endpoint

Conversation

@bguban
Copy link
Copy Markdown
Collaborator

@bguban bguban commented Mar 4, 2020

No description provided.

@dangerpr-bot
Copy link
Copy Markdown

dangerpr-bot commented Mar 4, 2020

1 Warning
⚠️ [DEPRECATION] check is deprecated. Please use check! instead.

Generated by 🚫 Danger

@bguban bguban force-pushed the isin_endpoint branch 2 times, most recently from 3f376ed to 2e86e3e Compare March 4, 2020 12:35
Copy link
Copy Markdown
Owner

@dblock dblock left a comment

Choose a reason for hiding this comment

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

I think we should make it easier for users and have 2 APIs, asin and mapped_asin.

Comment thread CHANGELOG.md Outdated
Comment thread README.md Outdated
Comment thread lib/iex/endpoints/ref_data.rb Outdated
module IEX
module Endpoints
module RefData
def isin_mapping(isins, options = {})
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

The API is asin, why do we call it asin_mapping? Shouldn't it be asin?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I called it as the documentation section was called (https://iexcloud.io/docs/api/#isin-mapping). As for me, it's a very controversial endpoint. It even doesn't return ISINs. It returns symbols that mutch to given ISINs.
Maybe it even would be better to call it ref_data_isin. What do you think?

def isin_mapping(isins, options = {})
response = post('ref-data/isin', { token: publishable_token, isin: isins }.merge(options))

if response.is_a?(Hash) # mapped option was set
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I really dislike these APIs that return two different things depending on what you pass into them. Why don't we make two methods: isin and mapped_isin?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

As you mentioned in another comment the client should not be too opinionated. Keeping it in mind, I think it's better to copy the behavior of IEX endpoint and have two different responses depending on options in the single method.
Again, if split the endpoint to two methods, the end-user can call isin endpoint passing there mapped: true option what causes an error while the response parsing. So it requires an end-user to know the client-specific method mapped_isin.

Comment thread lib/iex/resources.rb Outdated
expect(subject.last).to eq('exchange' => 'ETR', 'iex_id' => 'IEX_464D46474C312D52', 'region' => 'DE', 'symbol' => 'APC-GY')
end

context 'with mapped option', vcr: { cassette_name: 'ref-data/isin_mapped' } do
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

This context does not depend/inherit the parent one. Split them up here so each has its own section.

@dblock
Copy link
Copy Markdown
Owner

dblock commented Mar 5, 2020

LGTM after the spec block change, feel free to merge on green then

@bguban bguban merged commit d998cab into dblock:master Mar 5, 2020
@bguban bguban deleted the isin_endpoint branch March 5, 2020 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants