sample-apps/contacts-app/app/lib/services/hubspot/contacts/search.rb in hubspot-api-client-1.0.1 vs sample-apps/contacts-app/app/lib/services/hubspot/contacts/search.rb in hubspot-api-client-2.0.0

- old
+ new

@@ -5,25 +5,25 @@ def initialize(email:) @email = email end def call - search_api = ::Hubspot::Client::Crm::Contacts::Api::SearchApi.new + search_api = ::Hubspot::Crm::Contacts::SearchApi.new results = search_api.do_search(body: search_request, auth_names: 'oauth2').results results = add_fullnames(results) results end private def search_request - filter = ::Hubspot::Client::Crm::Contacts::Models::Filter.new( + filter = ::Hubspot::Crm::Contacts::Filter.new( property_name: 'email', operator: 'EQ', value: @email ) - filter_group = ::Hubspot::Client::Crm::Contacts::Models::FilterGroup.new(filters: [filter]) - ::Hubspot::Client::Crm::Contacts::Models::PublicObjectSearchRequest.new(filter_groups: [filter_group]) + filter_group = ::Hubspot::Crm::Contacts::FilterGroup.new(filters: [filter]) + ::Hubspot::Crm::Contacts::PublicObjectSearchRequest.new(filter_groups: [filter_group]) end def add_fullnames(contacts) contacts.each do |contact| fullname = [contact.properties['firstname'], contact.properties['lastname']].reject(&:empty?).join(' ')