Class: DdrClient::BatchesApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ BatchesApi

Returns a new instance of BatchesApi.



19
20
21
# File 'lib/ddr_client/api/batches_api.rb', line 19

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

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/ddr_client/api/batches_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#get_batches(opts = {}) ⇒ Array<DdrAPIBatchEntity>

List batches

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :outcome (String)

    Filter by batch processing outcome

  • :user_id (Integer)

    Filter by user ID associated with the batch

  • :status (String)

    Filter by batch status

  • :per_page (Object)

    JSON only: Number of records to return per page (default: 20)

  • :page (Object)

    JSON only: Page number of results to return (default: 1)

Returns:



30
31
32
33
# File 'lib/ddr_client/api/batches_api.rb', line 30

def get_batches(opts = {})
  data, _status_code, _headers = get_batches_with_http_info(opts)
  data
end

#get_batches_id(id, opts = {}) ⇒ DdrAPIBatchEntity

Retrieve a batch record

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :batch_objects (BOOLEAN)

    Include related batch objects (not paginated) (default to false)

Returns:



92
93
94
95
# File 'lib/ddr_client/api/batches_api.rb', line 92

def get_batches_id(id, opts = {})
  data, _status_code, _headers = get_batches_id_with_http_info(id, opts)
  data
end

#get_batches_id_batch_objects(id, opts = {}) ⇒ Array<DdrAPIBatchObjectEntity>

Retrieve the batch objects for a batch

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :batch_object_details (BOOLEAN)

    JSON only: Include related attributes, files, messages, relationships, and roles for each batch object (default to true)

  • :per_page (Object)

    JSON only: Number of records to return per page (default: 20)

  • :page (Object)

    JSON only: Page number of results to return (default: 1)

Returns:



147
148
149
150
# File 'lib/ddr_client/api/batches_api.rb', line 147

def get_batches_id_batch_objects(id, opts = {})
  data, _status_code, _headers = get_batches_id_batch_objects_with_http_info(id, opts)
  data
end

#get_batches_id_batch_objects_with_http_info(id, opts = {}) ⇒ Array<(Array<DdrAPIBatchObjectEntity>, Fixnum, Hash)>

Retrieve the batch objects for a batch

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :batch_object_details (BOOLEAN)

    JSON only: Include related attributes, files, messages, relationships, and roles for each batch object

  • :per_page (Object)

    JSON only: Number of records to return per page (default: 20)

  • :page (Object)

    JSON only: Page number of results to return (default: 1)

Returns:

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

    Array<DdrAPIBatchObjectEntity> data, response status code and response headers



159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
# File 'lib/ddr_client/api/batches_api.rb', line 159

def get_batches_id_batch_objects_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BatchesApi.get_batches_id_batch_objects ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling BatchesApi.get_batches_id_batch_objects"
  end
  # resource path
  local_var_path = '/batches/{id}/batch_objects'.sub('{' + 'id' + '}', id.to_s)

  # query parameters
  query_params = {}
  query_params[:'batch_object_details'] = opts[:'batch_object_details'] if !opts[:'batch_object_details'].nil?
  query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/csv'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['oauth']
  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 => 'Array<DdrAPIBatchObjectEntity>')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: BatchesApi#get_batches_id_batch_objects\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_batches_id_log(id, opts = {}) ⇒ File

Download the batch log file

Parameters:

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

    the optional parameters

Returns:

  • (File)


203
204
205
206
# File 'lib/ddr_client/api/batches_api.rb', line 203

def get_batches_id_log(id, opts = {})
  data, _status_code, _headers = get_batches_id_log_with_http_info(id, opts)
  data
end

#get_batches_id_log_with_http_info(id, opts = {}) ⇒ Array<(File, Fixnum, Hash)>

Download the batch log file

Parameters:

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

    the optional parameters

Returns:

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

    File data, response status code and response headers



212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
# File 'lib/ddr_client/api/batches_api.rb', line 212

def get_batches_id_log_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BatchesApi.get_batches_id_log ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling BatchesApi.get_batches_id_log"
  end
  # resource path
  local_var_path = '/batches/{id}/log'.sub('{' + 'id' + '}', id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['text/plain'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['oauth']
  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 => 'File')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: BatchesApi#get_batches_id_log\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_batches_id_messages(id, opts = {}) ⇒ Array<DdrAPIBatchObjectMessageEntity>

Retrieve the batch object messages for a batch

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :per_page (Object)

    JSON only: Number of records to return per page (default: 20)

  • :page (Object)

    JSON only: Page number of results to return (default: 1)

Returns:



255
256
257
258
# File 'lib/ddr_client/api/batches_api.rb', line 255

def get_batches_id_messages(id, opts = {})
  data, _status_code, _headers = get_batches_id_messages_with_http_info(id, opts)
  data
end

#get_batches_id_messages_with_http_info(id, opts = {}) ⇒ Array<(Array<DdrAPIBatchObjectMessageEntity>, Fixnum, Hash)>

Retrieve the batch object messages for a batch

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :per_page (Object)

    JSON only: Number of records to return per page (default: 20)

  • :page (Object)

    JSON only: Page number of results to return (default: 1)

Returns:

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

    Array<DdrAPIBatchObjectMessageEntity> data, response status code and response headers



266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
# File 'lib/ddr_client/api/batches_api.rb', line 266

def get_batches_id_messages_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BatchesApi.get_batches_id_messages ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling BatchesApi.get_batches_id_messages"
  end
  # resource path
  local_var_path = '/batches/{id}/messages'.sub('{' + 'id' + '}', id.to_s)

  # query parameters
  query_params = {}
  query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/csv'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['oauth']
  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 => 'Array<DdrAPIBatchObjectMessageEntity>')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: BatchesApi#get_batches_id_messages\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_batches_id_with_http_info(id, opts = {}) ⇒ Array<(DdrAPIBatchEntity, Fixnum, Hash)>

Retrieve a batch record

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :batch_objects (BOOLEAN)

    Include related batch objects (not paginated)

Returns:

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

    DdrAPIBatchEntity data, response status code and response headers



102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/ddr_client/api/batches_api.rb', line 102

def get_batches_id_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BatchesApi.get_batches_id ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling BatchesApi.get_batches_id"
  end
  # resource path
  local_var_path = '/batches/{id}'.sub('{' + 'id' + '}', id.to_s)

  # query parameters
  query_params = {}
  query_params[:'batch_objects'] = opts[:'batch_objects'] if !opts[:'batch_objects'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['oauth']
  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 => 'DdrAPIBatchEntity')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: BatchesApi#get_batches_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_batches_with_http_info(opts = {}) ⇒ Array<(Array<DdrAPIBatchEntity>, Fixnum, Hash)>

List batches

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :outcome (String)

    Filter by batch processing outcome

  • :user_id (Integer)

    Filter by user ID associated with the batch

  • :status (String)

    Filter by batch status

  • :per_page (Object)

    JSON only: Number of records to return per page (default: 20)

  • :page (Object)

    JSON only: Page number of results to return (default: 1)

Returns:

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

    Array<DdrAPIBatchEntity> data, response status code and response headers



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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/ddr_client/api/batches_api.rb', line 43

def get_batches_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BatchesApi.get_batches ...'
  end
  if @api_client.config.client_side_validation && opts[:'outcome'] && !['SUCCESS', 'FAILURE'].include?(opts[:'outcome'])
    fail ArgumentError, 'invalid value for "outcome", must be one of SUCCESS, FAILURE'
  end
  if @api_client.config.client_side_validation && opts[:'status'] && !['READY', 'VALIDATING', 'INVALID', 'VALIDATED', 'QUEUED', 'PROCESSING', 'RUNNING', 'FINISHED', 'INTERRUPTED', 'INTERRUPTED - RESTARTABLE', 'QUEUED FOR DELETION', 'DELETING'].include?(opts[:'status'])
    fail ArgumentError, 'invalid value for "status", must be one of READY, VALIDATING, INVALID, VALIDATED, QUEUED, PROCESSING, RUNNING, FINISHED, INTERRUPTED, INTERRUPTED - RESTARTABLE, QUEUED FOR DELETION, DELETING'
  end
  # resource path
  local_var_path = '/batches'

  # query parameters
  query_params = {}
  query_params[:'outcome'] = opts[:'outcome'] if !opts[:'outcome'].nil?
  query_params[:'user_id'] = opts[:'user_id'] if !opts[:'user_id'].nil?
  query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
  query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/csv'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['oauth']
  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 => 'Array<DdrAPIBatchEntity>')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: BatchesApi#get_batches\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end