Module: Hubspot::Discovery::BaseModuleClient::ClassMethods
- Defined in:
- lib/hubspot/discovery/base_module_client.rb
Instance Method Summary collapse
- #api_classes ⇒ Object
- #api_modules ⇒ Object
- #base_module ⇒ Object
- #define_classes_methods ⇒ Object
- #define_methods ⇒ Object
- #define_modules_methods ⇒ Object
Instance Method Details
#api_classes ⇒ Object
17 18 19 |
# File 'lib/hubspot/discovery/base_module_client.rb', line 17 def api_classes [] end |
#api_modules ⇒ Object
13 14 15 |
# File 'lib/hubspot/discovery/base_module_client.rb', line 13 def api_modules [] end |
#base_module ⇒ Object
7 8 9 10 11 |
# File 'lib/hubspot/discovery/base_module_client.rb', line 7 def base_module modules = name.split('::') modules.pop modules.join('::') end |
#define_classes_methods ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/hubspot/discovery/base_module_client.rb', line 34 def define_classes_methods api_classes.each do |api_class| define_method("#{api_class}_api") do Kernel.const_get("#{self.class.base_module}::#{Hubspot::Helpers::CamelCase.new.format(__method__.to_s)}").new(params) end end end |
#define_methods ⇒ Object
21 22 23 24 |
# File 'lib/hubspot/discovery/base_module_client.rb', line 21 def define_methods define_modules_methods define_classes_methods end |
#define_modules_methods ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/hubspot/discovery/base_module_client.rb', line 26 def define_modules_methods api_modules.each do |api_module| define_method(api_module) do Kernel.const_get("#{self.class.base_module}::#{Hubspot::Helpers::CamelCase.new.format(__method__.to_s)}::Client").new(params) end end end |