ManageIQ / inventory_refresh

Apache License 2.0
1 stars 23 forks source link

Add a .from_hash method to Persister #30

Closed agrare closed 6 years ago

agrare commented 6 years ago

Add a class method to build a persister from a hash

@Ladas I prefer this method over passing the type in the json and having the .from_hash do the constantize because it allows the caller (i.e. the backend persister) to build the class and constantize it over the builder of the json payload (i.e. the collector) from having to know the full class name.

This lets me have the collector reference the persister by name (i.e. "Default") rather than by a full class name which should be internal knowledge.

Ladas commented 6 years ago

@agrare yes, that should be the way forward. Could you add some specs to satisfy the code climate?

agrare commented 6 years ago

@Ladas :+1: yes working on that now

miq-bot commented 6 years ago

This pull request is not mergeable. Please rebase and repush.

agrare commented 6 years ago

@Ladas okay done

miq-bot commented 6 years ago

Checked commits https://github.com/agrare/inventory_refresh/compare/8072aae6834abadb39e3390dc83ef14d1436fd92~...21104a22d5adff37dc759d61b6131c04e7166e20 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 4 files checked, 0 offenses detected Everything looks fine. :star: