Class: Users::InProductMarketingEmailRecords
- Inherits:
-
Object
- Object
- Users::InProductMarketingEmailRecords
- Defined in:
- app/services/users/in_product_marketing_email_records.rb
Instance Attribute Summary collapse
-
#records ⇒ Object
readonly
Returns the value of attribute records.
Instance Method Summary collapse
- #add(user, campaign: nil, track: nil, series: nil) ⇒ Object
-
#initialize ⇒ InProductMarketingEmailRecords
constructor
A new instance of InProductMarketingEmailRecords.
- #save! ⇒ Object
Constructor Details
#initialize ⇒ InProductMarketingEmailRecords
Returns a new instance of InProductMarketingEmailRecords.
7 8 9 |
# File 'app/services/users/in_product_marketing_email_records.rb', line 7 def initialize @records = [] end |
Instance Attribute Details
#records ⇒ Object (readonly)
Returns the value of attribute records.
5 6 7 |
# File 'app/services/users/in_product_marketing_email_records.rb', line 5 def records @records end |
Instance Method Details
#add(user, campaign: nil, track: nil, series: nil) ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'app/services/users/in_product_marketing_email_records.rb', line 16 def add(user, campaign: nil, track: nil, series: nil) @records << Users::InProductMarketingEmail.new( user: user, campaign: campaign, track: track, series: series, created_at: Time.zone.now, updated_at: Time.zone.now ) end |
#save! ⇒ Object
11 12 13 14 |
# File 'app/services/users/in_product_marketing_email_records.rb', line 11 def save! Users::InProductMarketingEmail.bulk_insert!(@records) @records = [] end |