Module: Insightly2::Resources::Object::Attributes
Defined Under Namespace
Modules: ClassMethods
Class Method Summary
collapse
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
48
49
50
51
52
53
54
55
56
|
# File 'lib/insightly2/resources/object/attributes.rb', line 48
def method_missing(name, *args, &block)
attribute = name.to_s.upcase
if __getobj__.key?(name.to_s.upcase) || __getobj__.key?(name.to_s.camelcase)
self.class.define_attribute_accessor(name)
deserialize_attribute(name, self.class.attributes[name.to_sym])
else
super
end
end
|
Class Method Details
.included(base) ⇒ Object
34
35
36
37
|
# File 'lib/insightly2/resources/object/attributes.rb', line 34
def self.included(base)
base.extend(ClassMethods)
super
end
|
Instance Method Details
#attributes ⇒ Object
39
40
41
42
43
44
45
46
|
# File 'lib/insightly2/resources/object/attributes.rb', line 39
def attributes
{}.tap do |result|
__getobj__.keys.each do |key|
attribute = key.to_s.downcase
result[attribute] = public_send(attribute)
end
end
end
|