Module: Hubspot::Discovery::BaseModuleClient::ClassMethods

Defined in:
lib/hubspot/discovery/base_module_client.rb

Instance Method Summary collapse

Instance Method Details

#api_classesObject



17
18
19
# File 'lib/hubspot/discovery/base_module_client.rb', line 17

def api_classes
  []
end

#api_modulesObject



13
14
15
# File 'lib/hubspot/discovery/base_module_client.rb', line 13

def api_modules
  []
end

#base_moduleObject



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_methodsObject



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_methodsObject



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_methodsObject



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