Module: ZohoHub::WithAttributes::ClassMethods

Defined in:
lib/zoho_hub/with_attributes.rb

Instance Method Summary collapse

Instance Method Details

#attribute_translation(translation = nil) ⇒ Object



38
39
40
41
42
43
44
# File 'lib/zoho_hub/with_attributes.rb', line 38

def attribute_translation(translation = nil)
  @attribute_translation ||= {}

  return @attribute_translation unless translation

  @attribute_translation = translation
end

#attributes(*attributes) ⇒ Object



28
29
30
31
32
33
34
35
36
# File 'lib/zoho_hub/with_attributes.rb', line 28

def attributes(*attributes)
  @attributes ||= []

  return @attributes unless attributes

  attr_accessor(*attributes)

  @attributes += attributes
end

#zoho_key_translationObject



46
47
48
# File 'lib/zoho_hub/with_attributes.rb', line 46

def zoho_key_translation
  @attribute_translation.to_a.map(&:rotate).to_h
end