Class: BillForward::SearchApi

Inherits:
Object
  • Object
show all
Defined in:
lib/bf_ruby2/api/search_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ SearchApi



30
31
32
# File 'lib/bf_ruby2/api/search_api.rb', line 30

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



28
29
30
# File 'lib/bf_ruby2/api/search_api.rb', line 28

def api_client
  @api_client
end

Instance Method Details

#perform_search(query_string, opts = {}) ⇒ SearchResultPagedMetadata

Returns the results of the global search specified by the query-string. an organizations data","response":"getSearchByID.html"

Options Hash (opts):

  • :organizations (Array<String>)

    A list of organization-IDs used to restrict the scope of API calls.

  • :types (Array<String>)

    A list of entities which will be checked when searching

  • :offset (Integer)

    The starting index of the search results. (default to 0)

  • :records (Integer)

    The number of search results to return. (default to 10)

  • :wildcard (BOOLEAN)

    Toggle if we search for full words or whether a wildcard is used. (default to false)

  • :entity (BOOLEAN)

    Is an entity returned with the search results. (default to false)



45
46
47
48
# File 'lib/bf_ruby2/api/search_api.rb', line 45

def perform_search(query_string, opts = {})
  data, _status_code, _headers = perform_search_with_http_info(query_string, opts)
  return data
end

#perform_search_with_http_info(query_string, opts = {}) ⇒ Array<(SearchResultPagedMetadata, Fixnum, Hash)>

Returns the results of the global search specified by the query-string. an organizations data&quot;,&quot;response&quot;:&quot;getSearchByID.html&quot;

Options Hash (opts):

  • :organizations (Array<String>)

    A list of organization-IDs used to restrict the scope of API calls.

  • :types (Array<String>)

    A list of entities which will be checked when searching

  • :offset (Integer)

    The starting index of the search results.

  • :records (Integer)

    The number of search results to return.

  • :wildcard (BOOLEAN)

    Toggle if we search for full words or whether a wildcard is used.

  • :entity (BOOLEAN)

    Is an entity returned with the search results.



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/bf_ruby2/api/search_api.rb', line 61

def perform_search_with_http_info(query_string, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: SearchApi.perform_search ..."
  end
  # verify the required parameter 'query_string' is set
  fail ArgumentError, "Missing the required parameter 'query_string' when calling SearchApi.perform_search" if query_string.nil?
  # resource path
  local_var_path = "/search/{query-string}".sub('{format}','json').sub('{' + 'query-string' + '}', query_string.to_s)

  # query parameters
  query_params = {}
  query_params[:'organizations'] = @api_client.build_collection_param(opts[:'organizations'], :multi) if !opts[:'organizations'].nil?
  query_params[:'types'] = @api_client.build_collection_param(opts[:'types'], :multi) if !opts[:'types'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
  query_params[:'records'] = opts[:'records'] if !opts[:'records'].nil?
  query_params[:'wildcard'] = opts[:'wildcard'] if !opts[:'wildcard'].nil?
  query_params[:'entity'] = opts[:'entity'] if !opts[:'entity'].nil?

  # header parameters
  header_params = {}

  # HTTP header 'Accept' (if needed)
  local_header_accept = ['application/json; charset=utf-8']
  local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result

  # HTTP header 'Content-Type'
  local_header_content_type = ['text/plain']
  header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = []
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'SearchResultPagedMetadata')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: SearchApi#perform_search\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end