Module: Infusionsoft::Client::Search

Included in:
Infusionsoft::Client
Defined in:
lib/infusionsoft/client/search.rb

Overview

Note:

In order to retrieve the id number for saved searches you will need to utilize

the data_query method and query the table called SavedFilter based on the user_id you are looking for the saved search Id for. Also note that UserId field on the SavedFilter table can contain multiple userId’s separated by a comma, so if you are querying for a report created by userId 6, I recommend appending the wildcard to the end of the userId. Something like $query = array( ‘UserId’ => ’6%’ );

Instance Method Summary collapse

Instance Method Details

#search_get_all_report_columns(saved_search_id, user_id) ⇒ Hash

Gets all possible fields/columns available for return on a saved search/report.

Parameters:

  • saved_search_id (Integer)
  • user_id (Integer)

    the user id who the saved search is assigned to

Returns:

  • (Hash)


20
21
22
# File 'lib/infusionsoft/client/search.rb', line 20

def search_get_all_report_columns(saved_search_id, user_id)
  response = xmlrpc('SearchService.getAllReportColumns', saved_search_id, user_id)
end

#search_get_available_quick_searches(user_id) ⇒ Array

This is used to find what possible quick searches the given user has access to.

Parameters:

  • user_id (Integer)

Returns:

  • (Array)


39
40
41
# File 'lib/infusionsoft/client/search.rb', line 39

def search_get_available_quick_searches(user_id)
  response = xmlrpc('SearchService.getAvailableQuickSearches', user_id)
end

#search_get_default_search_type(user_id) ⇒ String

Retrieves the quick search type that the given users has set as their default.

Parameters:

  • user_id (Integer)

Returns:

  • (String)

    the quick search type that the given user selected as their default



61
62
63
# File 'lib/infusionsoft/client/search.rb', line 61

def search_get_default_search_type(user_id)
  response = xmlrpc('SearchService.getDefaultQuickSearch', user_id)
end

#search_get_saved_search_results(saved_search_id, user_id, page_number) ⇒ Hash

Runs a saved search/report and returns all possible fields.

Parameters:

  • saved_search_id (Integer)
  • user_id (Integer)

    the user id who the saved search is assigned to

  • page_number (Integer)

Returns:

  • (Hash)


30
31
32
33
# File 'lib/infusionsoft/client/search.rb', line 30

def search_get_saved_search_results(saved_search_id, user_id, page_number)
  response = xmlrpc('SearchService.getSavedSearchResultsAllFields', saved_search_id,
                 user_id, page_number)
end

#search_quick_search(search_type, user_id, search_data, page, limit) ⇒ Array<Hash>

This allows you to run a quick search via the API. The quick search is the search bar in the upper right hand corner of the Infusionsoft application

Parameters:

  • search_type (String)

    the type of search (Person, Order, Opportunity, Company, Task, Subscription, or Affiliate)

  • user_id (Integer)
  • search_data (String)
  • page (Integer)
  • limit (Integer)

    max is 1000

Returns:

  • (Array<Hash>)


53
54
55
# File 'lib/infusionsoft/client/search.rb', line 53

def search_quick_search(search_type, user_id, search_data, page, limit)
  response = xmlrpc('SearchService.quickSearch', search_type, user_id, search_data, page, limit)
end