<% if @error.present? %>

<%= @error.message %>

<% else %>
        

Create contact

# app/lib/services/hubspot/contacts/create.rb

Export to CSV

# app/lib/services/hubspot/contacts/export.rb

<%= link_to('New Contact', new_contact_path, class: 'button', id: 'new-contact') %> <%= link_to('Export To CSV', export_contacts_path(format: :csv), class: 'button', id: 'export') %>
<%= form_tag('/contacts', method: :get, class: 'contacts') do %> <%= text_field_tag(:search, @search_q, placeholder: 'Search by email..', id: 'search') %> <% end %>
    

Search

# app/lib/services/hubspot/contacts/search.rb

<% if flash[:notice] %>
<%= flash[:notice] %>
<% end %> <% @contacts.each do |contact| %> <% end %>
ID Email Name
<%= contact.id %>
<%= contact.properties['email'] %>
<%= contact.properties['fullname'].present? ? contact.properties['fullname'] : contact.properties['email'] %>
<%= button_to "delete", { controller: :contacts, action: :destroy, id: contact.id }, method: :delete, form_class: 'delete-button' %>
<% end %>
    

Delete

# app/lib/services/hubspot/contacts/destroy.rb