Class: Wco::Leadset
- Inherits:
-
Object
- Object
- Wco::Leadset
- Includes:
- Mongoid::Document, Mongoid::Paranoia, Mongoid::Timestamps
- Defined in:
- app/models/wco/leadset.rb
Constant Summary collapse
- PAGE_PARAM_NAME =
'leadsets_page'
Class Method Summary collapse
Instance Method Summary collapse
- #convs ⇒ Object
-
#customer_id ⇒ Object
stripe.
-
#domain ⇒ Object
for anti-spam.
- #next_serverhost ⇒ Object
- #normalize_company_url ⇒ Object
- #to_s ⇒ Object
Class Method Details
.from_email(email) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'app/models/wco/leadset.rb', line 18 def self.from_email email _domain = email.split('@')[1] words = _domain.split('.') if %w| com net gov org |.include?( words[-2] ) words = words[-3, 3] else words = words[-2, 2] end _domain = words.join('.') find_or_create_by( company_url: _domain ) end |
.list ⇒ Object
83 84 85 |
# File 'app/models/wco/leadset.rb', line 83 def self.list [[nil,nil]] + all.map { |ttt| [ ttt.company_url, ttt.id ] } end |
Instance Method Details
#convs ⇒ Object
48 |
# File 'app/models/wco/leadset.rb', line 48 def convs; conversations; end |
#customer_id ⇒ Object
stripe
65 |
# File 'app/models/wco/leadset.rb', line 65 field :customer_id |
#domain ⇒ Object
for anti-spam
17 |
# File 'app/models/wco/leadset.rb', line 17 def domain; company_url; end |
#next_serverhost ⇒ Object
57 58 59 |
# File 'app/models/wco/leadset.rb', line 57 def next_serverhost serverhosts.first end |
#normalize_company_url ⇒ Object
14 15 16 |
# File 'app/models/wco/leadset.rb', line 14 def normalize_company_url company_url.downcase! end |
#to_s ⇒ Object
80 81 82 |
# File 'app/models/wco/leadset.rb', line 80 def to_s company_url end |