Class: Lead
- Inherits:
-
Object
- Object
- Lead
- Defined in:
- lib/leadcreator.rb
Instance Method Summary collapse
- #create(name:, last_name:, email:, company:, job_title:, phone:, website:) ⇒ Object
-
#initialize(instance_url:, client_id:, client_secret:, oauth_token:) ⇒ Lead
constructor
A new instance of Lead.
Constructor Details
#initialize(instance_url:, client_id:, client_secret:, oauth_token:) ⇒ Lead
Returns a new instance of Lead.
8 9 10 11 12 13 14 15 |
# File 'lib/leadcreator.rb', line 8 def initialize(instance_url:, client_id:, client_secret:, oauth_token:) credential = {:instance_url => instance_url, :client_id => client_id, :client_secret => client_secret, :oauth_token => oauth_token } @client = Restforce.new(credential) end |
Instance Method Details
#create(name:, last_name:, email:, company:, job_title:, phone:, website:) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/leadcreator.rb', line 18 def create(name:, last_name:, email:, company:, job_title:, phone:, website:) raise ArgumentError.new 'last_name and company are required' if company.empty? || last_name.empty? attributes = { FirstName: name, LastName: last_name, Email: email, Company: company, Title: job_title, Phone: phone, Website: website } @client.create!('Lead', attributes) end |