Class: Wco::Leadset

Inherits:
Object
  • Object
show all
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

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

.listObject



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

#convsObject



48
# File 'app/models/wco/leadset.rb', line 48

def convs; conversations; end

#customer_idObject

stripe



65
# File 'app/models/wco/leadset.rb', line 65

field :customer_id

#domainObject

for anti-spam



17
# File 'app/models/wco/leadset.rb', line 17

def domain; company_url; end

#next_serverhostObject



57
58
59
# File 'app/models/wco/leadset.rb', line 57

def next_serverhost
  serverhosts.first
end

#normalize_company_urlObject



14
15
16
# File 'app/models/wco/leadset.rb', line 14

def normalize_company_url
  company_url.downcase!
end

#to_sObject



80
81
82
# File 'app/models/wco/leadset.rb', line 80

def to_s
  company_url
end