Class: MailchimpMarketing::SearchCampaignsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/MailchimpMarketing/api/search_campaigns_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client) ⇒ SearchCampaignsApi

Returns a new instance of SearchCampaignsApi.


19
20
21
# File 'lib/MailchimpMarketing/api/search_campaigns_api.rb', line 19

def initialize(api_client)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client


17
18
19
# File 'lib/MailchimpMarketing/api/search_campaigns_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#search(query = {}, opts = {}) ⇒ Campaigns

Search Campaigns Search all campaigns for the specified query terms.

Parameters:

  • query (defaults to: {})

    The search query used to filter results.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :fields (Array<String>)

    A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.

  • :exclude_fields (Array<String>)

    A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.

Returns:

  • (Campaigns)

29
30
31
32
# File 'lib/MailchimpMarketing/api/search_campaigns_api.rb', line 29

def search(query = {}, opts = {})
  data, _status_code, _headers = search_with_http_info(query, opts)
  data
end

#search_with_http_info(query, opts = {}) ⇒ Array<(Campaigns, Fixnum, Hash)>

Search Campaigns Search all campaigns for the specified query terms.

Parameters:

  • query

    The search query used to filter results.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :fields (Array<String>)

    A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.

  • :exclude_fields (Array<String>)

    A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.

Returns:

  • (Array<(Campaigns, Fixnum, Hash)>)

    Campaigns data, response status code and response headers


41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/MailchimpMarketing/api/search_campaigns_api.rb', line 41

def search_with_http_info(query, opts = {})
  # resource path
  local_var_path = '/search-campaigns'

  # query parameters
  query_params = {}
  query_params[:'query'] = query
  query_params[:'fields'] = @api_client.build_collection_param(opts[:'fields'], :csv) if !opts[:'fields'].nil?
  query_params[:'exclude_fields'] = @api_client.build_collection_param(opts[:'exclude_fields'], :csv) if !opts[:'exclude_fields'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/problem+json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['basicAuth']
  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 => 'Campaigns')
  return data, status_code, headers
end