rikas / zoho_hub

Zoho CRM API V2 Wrapper
MIT License
25 stars 30 forks source link

Custom request path? #39

Closed artsyca closed 4 years ago

artsyca commented 5 years ago

The convention of Rails is to use PascalCase class names, whereas Zoho of course prefers the uniquely eccentric Pascal_Snake_Case or Title_Case_Underscored so a module named MyModule in rails would need to be called My_Module in Zoho --

At present the ZohoHub::BaseRecord will not insert underscores and I've monkey patched my class thusly:

class MyModule < ZohoHub::BaseRecord
  ..
  class << self
    def request_path
      # TODO: is there any other way to override this?
      ZohoHub::BaseRecord.request_path('My_Modules')
    end
  end
  ..
end

Is this the correct way to proceed?

Fabien-Wecasa commented 5 years ago

To override the zoho_hub default behavior, you can simply define request_path:

class MyModule < ZohoHub::BaseRecord
  request_path 'My_Modules'
  ...