Sha256: e56c2cc73dddf50170f9edc76b29bf53a1df00e1d3ad764d8473c08470c7d3a0

Contents?: true

Size: 737 Bytes

Versions: 6

Compression:

Stored size: 737 Bytes

Contents

module Services
  module Hubspot
    module Contacts
      class Search
        def initialize(email:)
          @email = email
        end

        def call
          search_api = ::Hubspot::Crm::Contacts::SearchApi.new
          search_api.do_search(search_request, auth_names: 'oauth2').results
        end

        private

        def search_request
          filter = ::Hubspot::Crm::Contacts::Filter.new(
            property_name: 'email',
            operator: 'EQ',
            value: @email
          )
          filter_group = ::Hubspot::Crm::Contacts::FilterGroup.new(filters: [filter])
          ::Hubspot::Crm::Contacts::PublicObjectSearchRequest.new(filter_groups: [filter_group])
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
hubspot-api-client-9.0.0 sample-apps/companies-app/app/lib/services/hubspot/contacts/search.rb
hubspot-api-client-8.0.1 sample-apps/companies-app/app/lib/services/hubspot/contacts/search.rb
hubspot-api-client-8.0.0 sample-apps/companies-app/app/lib/services/hubspot/contacts/search.rb
hubspot-api-client-7.3.0 sample-apps/companies-app/app/lib/services/hubspot/contacts/search.rb
hubspot-api-client-7.2.0 sample-apps/companies-app/app/lib/services/hubspot/contacts/search.rb
hubspot-api-client-7.1.1 sample-apps/companies-app/app/lib/services/hubspot/contacts/search.rb