Class: Mass::Outreach
- Inherits:
-
BlackStack::Base
- Object
- BlackStack::Base
- Mass::Outreach
- Defined in:
- lib/base-line/outreach.rb
Instance Attribute Summary collapse
-
#company ⇒ Object
Returns the value of attribute company.
-
#lead ⇒ Object
Returns the value of attribute lead.
-
#profile ⇒ Object
Returns the value of attribute profile.
-
#profile_type ⇒ Object
Returns the value of attribute profile_type.
-
#type ⇒ Object
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
-
#child_class_instance ⇒ Object
crate an instance of the profile type using the class defined in the ‘desc` attribute.
-
#class_name_from_outreach_type ⇒ Object
convert the outreach_type into the ruby class to create an instance.
-
#initialize(h) ⇒ Outreach
constructor
A new instance of Outreach.
Constructor Details
#initialize(h) ⇒ Outreach
Returns a new instance of Outreach.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/base-line/outreach.rb', line 9 def initialize(h) super(h) self.type = Mass::OutreachType.new(h['outreach_type_desc']) if h['outreach_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 |
Instance Attribute Details
#company ⇒ Object
Returns the value of attribute company.
3 4 5 |
# File 'lib/base-line/outreach.rb', line 3 def company @company end |
#lead ⇒ Object
Returns the value of attribute lead.
3 4 5 |
# File 'lib/base-line/outreach.rb', line 3 def lead @lead end |
#profile ⇒ Object
Returns the value of attribute profile.
3 4 5 |
# File 'lib/base-line/outreach.rb', line 3 def profile @profile end |
#profile_type ⇒ Object
Returns the value of attribute profile_type.
3 4 5 |
# File 'lib/base-line/outreach.rb', line 3 def profile_type @profile_type end |
#type ⇒ Object
Returns the value of attribute type.
3 4 5 |
# File 'lib/base-line/outreach.rb', line 3 def type @type end |
Class Method Details
.object_name ⇒ Object
5 6 7 |
# File 'lib/base-line/outreach.rb', line 5 def self.object_name 'outreach' end |
Instance Method Details
#child_class_instance ⇒ Object
crate an instance of the profile type using the class defined in the ‘desc` attribute. override the base method
34 35 36 37 38 39 40 |
# File 'lib/base-line/outreach.rb', line 34 def child_class_instance outreach_type = self.desc['outreach_type'] key = self.class_name_from_outreach_type raise "Source code of outreach type #{outreach_type} not found. Create a class #{key} in the folder `/lib` of your mass-sdk." unless Kernel.const_defined?(key) ret = Kernel.const_get(key).new(self.desc) return ret end |
#class_name_from_outreach_type ⇒ Object
convert the outreach_type into the ruby class to create an instance. example: Apollo –> Mass::ApolloAPI
27 28 29 30 |
# File 'lib/base-line/outreach.rb', line 27 def class_name_from_outreach_type outreach_type = self.desc['outreach_type'] "Mass::#{outreach_type}" end |