Class: MailchimpMarketing::BatchesApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client) ⇒ BatchesApi

Returns a new instance of BatchesApi.



19
20
21
# File 'lib/MailchimpMarketing/api/batches_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/batches_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#delete_request(batch_id = {}, opts = {}) ⇒ nil

Delete a batch request and stop if from processing further. Stops a batch request from running. Since only one batch request is run at a time, this can be used to cancel a long running request. The results of any completed operations will not be available after this call.

Parameters:

  • batch_id (defaults to: {})

    The unique id for the batch operation.

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

    the optional parameters

Returns:

  • (nil)


27
28
29
30
# File 'lib/MailchimpMarketing/api/batches_api.rb', line 27

def delete_request(batch_id = {}, opts = {})
  delete_request_with_http_info(batch_id, opts)
  nil
end

#delete_request_with_http_info(batch_id, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Delete a batch request and stop if from processing further. Stops a batch request from running. Since only one batch request is run at a time, this can be used to cancel a long running request. The results of any completed operations will not be available after this call.

Parameters:

  • batch_id

    The unique id for the batch operation.

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/MailchimpMarketing/api/batches_api.rb', line 37

def delete_request_with_http_info(batch_id, opts = {})
  # resource path
  local_var_path = '/batches/{batch_id}'.sub('{' + 'batch_id' + '}', batch_id.to_s)

  # query parameters
  query_params = {}

  # 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(:DELETE, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  return data, status_code, headers
end

#list(opts = {}) ⇒ BatchOperations

Get a list of batch requests Get a summary of batch requests that have been made.

Parameters:

  • 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.

  • :count (Integer)

    The number of records to return. [Default value](/developer/guides/get-started-with-mailchimp-api-3/#Parameters) is 10. [Maximum value](/developer/guides/get-started-with-mailchimp-api-3/#Parameters) is 1000 (default to 10)

  • :offset (Integer)

    The number of records from a collection to skip. Iterating over large collections with this parameter can be slow. [Default value](/developer/guides/get-started-with-mailchimp-api-3/#Parameters) is 0. (default to 0)

Returns:

  • (BatchOperations)


73
74
75
76
# File 'lib/MailchimpMarketing/api/batches_api.rb', line 73

def list(opts = {})
  data, _status_code, _headers = list_with_http_info(opts)
  data
end

#list_with_http_info(opts = {}) ⇒ Array<(BatchOperations, Fixnum, Hash)>

Get a list of batch requests Get a summary of batch requests that have been made.

Parameters:

  • 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.

  • :count (Integer)

    The number of records to return. [Default value](/developer/guides/get-started-with-mailchimp-api-3/#Parameters) is 10. [Maximum value](/developer/guides/get-started-with-mailchimp-api-3/#Parameters) is 1000

  • :offset (Integer)

    The number of records from a collection to skip. Iterating over large collections with this parameter can be slow. [Default value](/developer/guides/get-started-with-mailchimp-api-3/#Parameters) is 0.

Returns:

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

    BatchOperations data, response status code and response headers



86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/MailchimpMarketing/api/batches_api.rb', line 86

def list_with_http_info(opts = {})
  # resource path
  local_var_path = '/batches'

  # query parameters
  query_params = {}
  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?
  query_params[:'count'] = opts[:'count'] if !opts[:'count'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].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 => 'BatchOperations')
  return data, status_code, headers
end

#start(body = {}, opts = {}) ⇒ Batch

Start a batch operation Begin processing a batch operations request.

Parameters:

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

    the optional parameters

Returns:

  • (Batch)


174
175
176
177
# File 'lib/MailchimpMarketing/api/batches_api.rb', line 174

def start(body = {}, opts = {})
  data, _status_code, _headers = start_with_http_info(body, opts)
  data
end

#start_with_http_info(body, opts = {}) ⇒ Array<(Batch, Fixnum, Hash)>

Start a batch operation Begin processing a batch operations request.

Parameters:

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

    the optional parameters

Returns:

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

    Batch data, response status code and response headers



184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
# File 'lib/MailchimpMarketing/api/batches_api.rb', line 184

def start_with_http_info(body, opts = {})
  # resource path
  local_var_path = '/batches'

  # query parameters
  query_params = {}

  # 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 = @api_client.object_to_http_body(body)
  auth_names = ['basicAuth']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Batch')
  return data, status_code, headers
end

#status(batch_id = {}, opts = {}) ⇒ Batch

Get the status of a batch operation request Get the status of a batch request.

Parameters:

  • batch_id (defaults to: {})

    The unique id for the batch operation.

  • 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:

  • (Batch)


126
127
128
129
# File 'lib/MailchimpMarketing/api/batches_api.rb', line 126

def status(batch_id = {}, opts = {})
  data, _status_code, _headers = status_with_http_info(batch_id, opts)
  data
end

#status_with_http_info(batch_id, opts = {}) ⇒ Array<(Batch, Fixnum, Hash)>

Get the status of a batch operation request Get the status of a batch request.

Parameters:

  • batch_id

    The unique id for the batch operation.

  • 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<(Batch, Fixnum, Hash)>)

    Batch data, response status code and response headers



138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# File 'lib/MailchimpMarketing/api/batches_api.rb', line 138

def status_with_http_info(batch_id, opts = {})
  # resource path
  local_var_path = '/batches/{batch_id}'.sub('{' + 'batch_id' + '}', batch_id.to_s)

  # query parameters
  query_params = {}
  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 => 'Batch')
  return data, status_code, headers
end