Method: Mass::Enrichment#initialize

Defined in:
lib/base-line/enrichment.rb

#initialize(h) ⇒ Enrichment

Returns a new instance of Enrichment.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/base-line/enrichment.rb', line 9

def initialize(h)
    super(h)
    self.type = Mass::EnrichmentType.new(h['enrichment_type_desc']) if h['enrichment_type_desc']
    self.profile = Mass::Profile.new(h['profile']).child_class_instance if h['profile']
    self.lead = Mass::Lead.new(h['lead']) if h['lead']
    self.company = Mass::Company.new(h['company']) if h['company']
    self.profile_type = Mass::ProfileType.page(
        id_account: h['id_account'],
        page: 1,
        limit: 1,
        filters: {
            name: h['profile_type']
        }
    ).first.child_class_instance if h['profile_type']
end