Module: Maestrano::Connector::Rails::Concerns::SubEntityBase::ClassMethods

Defined in:
app/models/maestrano/connector/rails/concerns/sub_entity_base.rb

Instance Method Summary collapse

Instance Method Details

#connec_entity_nameObject



19
20
21
22
23
# File 'app/models/maestrano/connector/rails/concerns/sub_entity_base.rb', line 19

def connec_entity_name
  return entity_name unless external?

  raise 'Forbidden call: cannot call connec_entity_name for an external entity'
end

#creation_mapper_classesObject

{ ‘External Entity’ => CreationLalaMapper, ‘Other external entity’ => CreationLiliMapper } or { ‘Connec Entity’ => CreationLalaMapper, ‘Other connec entity’ => CreationLiliMapper }



41
42
43
# File 'app/models/maestrano/connector/rails/concerns/sub_entity_base.rb', line 41

def creation_mapper_classes
  mapper_classes
end

#entity_nameObject



9
10
11
# File 'app/models/maestrano/connector/rails/concerns/sub_entity_base.rb', line 9

def entity_name
  raise 'Not implemented'
end

#external?Boolean

Returns:

  • (Boolean)


5
6
7
# File 'app/models/maestrano/connector/rails/concerns/sub_entity_base.rb', line 5

def external?
  raise 'Not implemented'
end

#external_entity_nameObject



13
14
15
16
17
# File 'app/models/maestrano/connector/rails/concerns/sub_entity_base.rb', line 13

def external_entity_name
  return entity_name if external?

  raise 'Forbidden call: cannot call external_entity_name for a connec entity'
end

#mapper_classesObject

{ ‘External Entity’ => LalaMapper, ‘Other external entity’ => LiliMapper } or { ‘Connec Entity’ => LalaMapper, ‘Other connec entity’ => LiliMapper }



35
36
37
# File 'app/models/maestrano/connector/rails/concerns/sub_entity_base.rb', line 35

def mapper_classes
  {}
end

#names_hashObject



25
26
27
28
29
30
31
# File 'app/models/maestrano/connector/rails/concerns/sub_entity_base.rb', line 25

def names_hash
  if external?
    {external_entity: entity_name.downcase}
  else
    {connec_entity: entity_name.downcase}
  end
end

#referencesObject

'External Entity' => ['organization_id'],
'Other external entity' => ['an array of the connec reference fields']



49
50
51
# File 'app/models/maestrano/connector/rails/concerns/sub_entity_base.rb', line 49

def references
  {}
end