Permalink
Browse files

Code refactored

  • Loading branch information...
1 parent 02a360b commit c55885a92c1826a51a6380f9bc104e859850dab3 @Imranshaikh Imranshaikh committed with avinasha Sep 26, 2013
Showing with 7 additions and 4 deletions.
  1. +6 −3 apps/salesforce/salesforce.rb
  2. +1 −1 public/javascripts/sb.sample.payload.js
@@ -19,6 +19,10 @@ def ticket_created
[500, e.message]
end
+ if contact
+ send_note(ticket, contact)
+ end
+
comment_on_ticket(ticket, html)
[200, "Ticket sent to Salesforce"]
end
@@ -50,7 +54,7 @@ def create_contact(requester)
return unless settings.should_create_contact.to_s == '1'
firstname = split_name(requester).first
lastname = split_name(requester).last
- new_contact_id = @client.create('Contact', { :FirstName => firstname, :LastName => lastname, :Email => requester.email } )
+ new_contact_id = @client.create('Contact', { "FirstName" => firstname, "LastName" => lastname, "Email" => requester.email } )
find_contact_by_id(new_contact_id)
end
@@ -76,7 +80,6 @@ def contact_info_html(contact)
def find_email(email)
email_id = @client.search("FIND {#{email}}")
- binding.pry
find_contact_by_id(email_id[0]['Id']) rescue nil
end
@@ -89,7 +92,7 @@ def contact_url(contact)
end
def send_note(ticket, contact)
- @client.create('Note', { :Body => generate_note_content(ticket), :ParentId => contact.Id, :Title => ticket.summary })
+ @client.create('Note', { "Body" => generate_note_content(ticket), "ParentId" => contact.Id, "Title" => ticket.summary })
end

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

0 comments on commit c55885a

Please sign in to comment.