ish_models 0.0.33.182 → 0.0.33.184

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2955b69e5c3cb7c88715600adfc9a661d18bc5a244a91d39f16528152d0bbcc5
4
- data.tar.gz: 898ce52f6c280db8503702374b64a34f7ecb20b8bcce9dc2d333e468e7577013
3
+ metadata.gz: 3e6eff98102df0e1c876a6efbead562210b0d6863d9a75574aef191c778a011b
4
+ data.tar.gz: 5a5b1eaab82f0ccb24304b8ee61821504c3940e8cca6e54ef4ec161c5394dc7d
5
5
  SHA512:
6
- metadata.gz: 6e3b705030a52fe4a626fc8c666de6b578ae04dc01ae0a5abb44d505fe48be96e567d197848be5462ce291ed6f6419a32ba8d78dae5d5e05d55a2ec42bd400df
7
- data.tar.gz: f3f899139297bd7e575a36562014f43df35791b8d0829c2830a19fc2e706adcf09f9c23925b57efafdbe71a59efd408039dcbc9f91bfba3309fcadfd478ccf87
6
+ metadata.gz: d35fb3fc9226c8720e083090b86bca77399bfa62a99cc4c1e3650688a25a4f9f9ab1dc59c825f258f6e25016cf7c5fafb6b223d1b16553555858783b9b7c11f2
7
+ data.tar.gz: af86d30206881902dc9654d38a903f6b1a7fbd41f81c1719b959478ddcf2ab691ae03d83edbec538098137bc4812427ab3d08326052fc4da4821f426ef878025
@@ -1,12 +1,14 @@
1
1
 
2
2
  #
3
- # This looks like it sends a single email?
3
+ # Sends a single email, or a campaign.
4
4
  #
5
5
 
6
6
  class Ish::EmailContext
7
7
  include Mongoid::Document
8
8
  include Mongoid::Timestamps
9
9
 
10
+ field :title
11
+
10
12
  PAGE_PARAM_NAME = 'email_contexts_page'
11
13
 
12
14
  FROM_EMAILS = %w| piousbox@gmail.com victor@piousbox.com victor@wasya.co no-reply@piousbox.com |
@@ -16,8 +18,13 @@ class Ish::EmailContext
16
18
  [ [nil, nil] ] + FROM_EMAILS.map { |i| [i, i] }
17
19
  end
18
20
 
19
- field :to_email
20
- validates_presence_of :to_email
21
+ TYPE_SINGLE = 'TYPE_SINGLE'
22
+ TYPE_CAMPAIGN = 'TYPE_CAMPAIGN'
23
+ field :type, default: TYPE_SINGLE
24
+ def self.types_list
25
+ [ [TYPE_SINGLE, TYPE_SINGLE], [TYPE_CAMPAIGN, TYPE_CAMPAIGN] ]
26
+ end
27
+
21
28
 
22
29
  field :subject
23
30
  validates_presence_of :subject
@@ -30,11 +37,27 @@ class Ish::EmailContext
30
37
  field :rendered_str
31
38
 
32
39
  field :sent_at, type: DateTime
40
+ field :scheduled_at, type: DateTime
41
+
42
+ def leads
43
+ if self.type == TYPE_CAMPAIGN
44
+ return ::EmailCampaignLead.where( email_campaign_id: self.id.to_s ).includes( :lead ).map { |p| p.lead }
45
+ end
46
+ end
47
+
33
48
 
34
49
  #
35
50
  # For templating:
36
51
  #
37
- field :name
52
+ field :tmpl_name
53
+
54
+ field :to_email
55
+ validates_presence_of :to_email, if: -> { type == TYPE_SINGLE }
56
+
57
+ #
58
+ # For tracking
59
+ #
60
+ attr_reader :tid
38
61
 
39
62
  end
40
63
  EmailContext = Ish::EmailContext
@@ -1,4 +1,5 @@
1
- class Ish::Campaign
1
+
2
+ class Ish::EmailCampaign
2
3
  include Mongoid::Document
3
4
  include Mongoid::Timestamps
4
5
 
@@ -12,12 +13,16 @@ class Ish::Campaign
12
13
  field :subject
13
14
  field :body
14
15
 
16
+ ## @TODO: tags instead?
15
17
  field :is_done, :type => Boolean, :default => false
16
18
  field :is_trash, :type => Boolean, :default => false
19
+ field :tag # 'hired_com_ror', not enumerated for now _vp_ 20180103
17
20
 
21
+ ## @TODO: sent on, scheduled_on, ...
18
22
  field :applied_on, :type => Time
19
23
 
20
- field :tag # 'hired_com_ror', not enumerated for now _vp_ 20180103
21
- field :location
24
+ ## Need tracking!
25
+
26
+ ## this looks like an email_context, copy from there.
22
27
 
23
28
  end
data/lib/ish_models.rb CHANGED
@@ -43,8 +43,8 @@ require 'gameui/marker'
43
43
  require 'gameui/premium_purchase'
44
44
 
45
45
  require 'ish/cache_key'
46
- require 'ish/campaign'
47
46
  require 'ish/crawler'
47
+ # require 'ish/email_campaign' ## context + leadset is a campaign.
48
48
  require 'ish/email_context'
49
49
  require 'ish/email_template'
50
50
  require 'ish/email_unsubscribe'
data/lib/video.rb CHANGED
@@ -29,14 +29,15 @@ class Video
29
29
  field :is_public, :type => Boolean, :default => false
30
30
  field :is_feature, :type => Boolean, :default => false
31
31
 
32
- field :x, :type => Float
33
- field :y, :type => Float
32
+ field :x, type: Float
33
+ field :y, type: Float
34
+ field :z, type: Float
34
35
 
35
36
  field :lang, :type => String, :default => 'en'
36
37
 
37
- field :youtube_id, :type => String
38
- validates :youtube_id, :uniqueness => true, allow_nil: true
39
-
38
+ field :youtube_id
39
+ validates_uniqueness_of :youtube_id, allow_blank: true, case_sensitive: false
40
+ before_save { youtube_id.present? || youtube_id = nil }
40
41
 
41
42
  belongs_to :user_profile, :optional => true, :class_name => 'Ish::UserProfile', :inverse_of => :videos
42
43
 
@@ -44,12 +45,6 @@ class Video
44
45
  [['', nil]] + Video.unscoped.order_by( :created_at => :desc ).map { |item| [ "#{item.created_at.strftime('%Y%m%d')} #{item.name}", item.id ] }
45
46
  end
46
47
 
47
- set_callback( :create, :before ) do |doc|
48
- if doc.is_public
49
- doc.city.add_newsitem( doc ) unless doc.city.blank?
50
- doc.site.add_newsitem( doc ) unless doc.site.blank?
51
- end
52
- end
53
48
 
54
49
  field :issue
55
50
  field :subhead
@@ -84,10 +79,6 @@ class Video
84
79
  s3_region: ::S3_CREDENTIALS[:region]
85
80
  validates_attachment_content_type :thumb, :content_type => ["image/jpg", "image/jpeg", "image/png", "image/gif", 'application/octet-stream' ]
86
81
 
87
- set_callback :update, :after do |doc|
88
- Site.update_all updated_at: Time.now
89
- end
90
-
91
82
  ## copy-paste
92
83
  field :premium_tier, type: Integer, default: 0 # how many stars need to spend, to get access? 0 = free
93
84
  def is_premium
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ish_models
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.33.182
4
+ version: 0.0.33.184
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox
@@ -123,7 +123,6 @@ files:
123
123
  - lib/gameui/marker.rb
124
124
  - lib/gameui/premium_purchase.rb
125
125
  - lib/ish/cache_key.rb
126
- - lib/ish/campaign.rb
127
126
  - lib/ish/configuration.rb
128
127
  - lib/ish/crawler.rb
129
128
  - lib/ish/email_context.rb
@@ -141,6 +140,7 @@ files:
141
140
  - lib/ish/payment.rb
142
141
  - lib/ish/premium_item.rb
143
142
  - lib/ish/railtie.rb
143
+ - lib/ish/trash/email_campaign.rb
144
144
  - lib/ish/user_profile.rb
145
145
  - lib/ish/utils.rb
146
146
  - lib/ish_models.rb