class Fakecrm::TypeExtender

Attributes

custom_type[RW]

Public Class Methods

new(custom_type) click to toggle source
# File lib/fakecrm/resource/extensions/type_extender.rb, line 13
def initialize(custom_type)
  self.custom_type = custom_type
end

Public Instance Methods

extend!() click to toggle source
# File lib/fakecrm/resource/extensions/type_extender.rb, line 17
def extend!
  custom_attributes = self.custom_type.custom_attributes
  case self.custom_type.id
  when 'contact'
    TypeExtension.new(Contact).replace!(custom_attributes)
  when 'account'
    TypeExtension.new(Account).replace!(custom_attributes)
  else
    case self.custom_type.kind
    when 'Event'
      TypeExtension.new(Event).add!(custom_attributes)
    when 'Activity'
      TypeExtension.new(Activity).add!(custom_attributes)
    when 'EventContact'
      TypeExtension.new(EventContact).add!(custom_attributes)
    else
      true
    end
  end
end