Sha256: 5a62f6bf5a6a398afb46c7ff730a4af4d5ab1b29ff39308539fe29f8c641cf80
Contents?: true
Size: 1.29 KB
Versions: 1
Compression:
Stored size: 1.29 KB
Contents
module BusinessCentral module Object module Helper def object(object_name, *params) define_method(object_name) do |argument=nil| object = "@#{object_name}_cache".to_sym if argument.nil? if !instance_variable_defined?(object) instance_variable_set( object, BusinessCentral::Object.const_get("#{object_name.to_s.to_camel_case(true)}".to_sym).new(self, argument) ) else instance_variable_get(object) end else instance_variable_set( object, BusinessCentral::Object.const_get("#{object_name.to_s.to_camel_case(true)}".to_sym).new(self, argument) ) end end end def navigation(object_name, *params) define_method(object_name) do |argument=nil| object = "@#{object_name}_cache".to_sym instance_variable_set( object, BusinessCentral::Object.const_get("#{object_name.to_s.to_camel_case(true)}".to_sym).new( self.client, company_id: company_id(argument), parent: self.class.const_get(:OBJECT), parent_id: id(argument) ) ) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
business-central-1.0.3 | lib/business_central/object/helper.rb |