Sha256: 9ca0daeea9a415f417504434d1955ffc186cf9cd94075d4be380c7aea95979bd

Contents?: true

Size: 746 Bytes

Versions: 6

Compression:

Stored size: 746 Bytes

Contents

module Services
  module Hubspot
    module Companies
      class Search
        def initialize(domain)
          @domain = domain
        end

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

        private

        def search_request
          filter = ::Hubspot::Crm::Companies::Filter.new(
            property_name: 'domain',
            operator: 'EQ',
            value: @domain
          )
          filter_group = ::Hubspot::Crm::Companies::FilterGroup.new(filters: [filter])
          ::Hubspot::Crm::Companies::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/companies/search.rb
hubspot-api-client-8.0.1 sample-apps/companies-app/app/lib/services/hubspot/companies/search.rb
hubspot-api-client-8.0.0 sample-apps/companies-app/app/lib/services/hubspot/companies/search.rb
hubspot-api-client-7.3.0 sample-apps/companies-app/app/lib/services/hubspot/companies/search.rb
hubspot-api-client-7.2.0 sample-apps/companies-app/app/lib/services/hubspot/companies/search.rb
hubspot-api-client-7.1.1 sample-apps/companies-app/app/lib/services/hubspot/companies/search.rb