Sha256: 03616595e4bf76a2d29becb0ccd9e475548dcc781748e058f4d15f857e5562f3

Contents?: true

Size: 1.43 KB

Versions: 4

Compression:

Stored size: 1.43 KB

Contents

module Seedy
  class Leads < Record
    self.columns = {
      :id => :guid,
      :date_entered => :date_time,
      :date_modified => :date_time,
      :modified_user_id => :association,
      :created_by => :association,
      :description => :description,
      :deleted => 0,
      :assigned_user_id => :association,
      :team_id => :association,
      :first_name => :first_name,
      :last_name => :last_name,
      :title => :title,
      :department => :department,
      :phone_mobile => :phone,
      :phone_work => :phone,
      :primary_address_street => :address_street,
      :primary_address_city => :city,
      :primary_address_state => :state,
      :primary_address_postalcode => :zip,
      :primary_address_country => :country,
      :website => :website,
      :contact_id => :association,
      :account_id => :association,
      :opportunity_id => :association,
    }

    class << self
      def build(user, team, contact, opp, account)
        lead = Leads.new
        lead.associate(user,team,contact,opp,account)
        lead
      end
    end
    
    def associate(user, team, contact, opp, account)
      write_attribute(:modified_user_id, user.id)
      write_attribute(:assigned_user_id, user.id)
      write_attribute(:team_id, team)
      write_attribute(:created_by, user.id)
      write_attribute(:contact_id, contact)
      write_attribute(:account_id, account)
      write_attribute(:opportunity_id, opp)
    end
  end 
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
seedy-0.6.6 lib/seedy/records/leads.rb
seedy-0.6.5 lib/seedy/records/leads.rb
seedy-0.6.4 lib/seedy/records/leads.rb
seedy-0.6.3 lib/seedy/records/leads.rb