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
84 85 86 |
# File 'app/models/wco/leadset.rb', line 84 def self.list [[nil,nil]] + all.map { |ttt| [ ttt.company_url, ttt.id ] } end |
Instance Method Details
#convs ⇒ Object
49 |
# File 'app/models/wco/leadset.rb', line 49 def convs; conversations; end |
#customer_id ⇒ Object
stripe
66 |
# File 'app/models/wco/leadset.rb', line 66 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
58 59 60 |
# File 'app/models/wco/leadset.rb', line 58 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
81 82 83 |
# File 'app/models/wco/leadset.rb', line 81 def to_s company_url end |