benknowles / rubyzoho

Abstracting Zoho’s API into a set of Ruby classes, with reflection of Zoho’s fields using a more familiar ActiveRecord lifecycle, but without ActiveRecord. Works with Rails and Devise.
MIT License
1 stars 0 forks source link

Replace hardcoded default module list with getModules #1

Open benknowles opened 7 years ago

benknowles commented 7 years ago

https://www.zoho.com/crm/help/api/getmodules.html

Need to verify that this doesn't include modules that are "hidden" which leads to an error code when initializing.

benknowles commented 7 years ago

getModules does in fact only return visible modules. The initialization should be reworked to do something like:

available = ["Accounts", "Contacts", ...] # populated from getModules
requested = ["Accounts", "Tasks"] # from configuration
modules_to_init = if requested.empty?
  available
else
  requested & available
end
benknowles commented 7 years ago

@amalc This goes along with the other issue we were discussing previously about opening up rubyzoho into other services. "getModules" has been added to several services like Recruit so this will make initializing the default modules pretty straightforward without having to hardcode everything.

As of today if you try initializing a module that's hidden from the menu it will return an error so we definitely need to replace the hardcoded array at some point.