Module: BusinessCentral::Object::ObjectHelper

Included in:
Client
Defined in:
lib/business_central/object/object_helper.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(object_name, **params) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/business_central/object/object_helper.rb', line 8

def method_missing(object_name, **params)
  if BusinessCentral::Object.const_defined?(object_name.to_s.to_class_sym)
    klass = BusinessCentral::Object.const_get(object_name.to_s.to_class_sym)
    klass.new(self, **params)
  else
    BusinessCentral::Object::Base.new(self, **params.merge!({ object_name: object_name }))
  end
end

Instance Method Details

#respond_to_missing?(_object_name, _include_all) ⇒ Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/business_central/object/object_helper.rb', line 17

def respond_to_missing?(_object_name, _include_all)
  true
end