New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support new endpoints and move Customer, Plan and Data Sources outside of Import namespace #32
Conversation
ds = ChartMogul::DataSource.create!(name: 'TestDS') | ||
ds.send(:set_uuid, 'ds_5ee8bf93-b0b4-4722-8a17-6b624a3af072') | ||
|
||
data_source = described_class.retrieve(ds.uuid) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps in this line you also need to use explicit uuid instead of method. Because who knows what happened when you did ds.send(:set_uuid,...
):
data_source = described_class.retrieve('ds_5ee8bf93-b0b4-4722-8a17-6b624a3af072')
In general I think it is better to use explicit values in tests, so that if you change something, then you'll need to change test as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
) | ||
plan.send(:set_uuid, 'pl_5ee8bf93-b0b4-4722-8a17-6b624a3af072') | ||
|
||
plan = described_class.retrieve(plan.uuid) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
plan = described_class.retrieve('pl_5ee8bf93-b0b4-4722-8a17-6b624a3af072')
plan.interval_count = 2 | ||
plan.update! | ||
|
||
plan = described_class.retrieve(plan.uuid) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same with uuid (that's my opinion, of course we can discuss if someone diasgrees)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
|
||
it 'retrieves existing data source matching uuid', uses_api: true do | ||
ds = ChartMogul::DataSource.create!(name: 'TestDS') | ||
ds.send(:set_uuid, 'ds_5ee8bf93-b0b4-4722-8a17-6b624a3af072') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do you need to do this set_uuid?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so the UUID is not randomly generated and VCR won't know how to handle the request
include API::Actions::Destroy | ||
|
||
def self.find_by_external_id(external_id) | ||
all(external_id: external_id).first |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is bit misleading method. If you have 2 Recurly connectors, you'll be not able to retrieve one of them. In general, if you have two connectors and customers have same external_ids, then only one will be returned here :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, but this is not a newly introduced method. Maybe it's better to cover this one in another PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, just noticed it and wanted to make @ytvinay aware
3ad41c9
to
3caebba
Compare
This PR adds support for new ChartMogul API endpoints and also move some classes outside the
Import
namespace in order to be compliant with our soon to be published new API structure. Stay tuned.The current
ChartMogul::Import::Customer
,ChartMogul::Import::DataSource
andChartMogul::Import::Plan
will lose theImport
namespace as we move towards a simpler API structure. For now, no changes are made toEnrichment
andMetrics
namespaces.Along with that, some new endpoints will now have support: