Class: DdrClient::ResourcesApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ ResourcesApi

Returns a new instance of ResourcesApi.



19
20
21
# File 'lib/ddr_client/api/resources_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/resources_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#get_resources(opts = {}) ⇒ Array<DdrAPIResourceEntity>

Filter resources

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :admin_set (String)

    Limit to selected admin set

  • :original_filename (String)

    Match by original file name

  • :sha1 (Array<String>)

    Match by original file SHA1 digest

  • :model (Array<String>)

    Limit to selected model type(s)

  • :workflow_state (String)

    Filter by workflow state

  • :modified_before (DateTime)

    Limit results to resources created or modified before a date/time

  • :modified_since (DateTime)

    Limit results to resources created or modified since a date/time

  • :fields (Array<String>)

    Metadata fields to include (resource ID and model are always included)

  • :exclude_fields (Array<String>)

    Metadata fields to exclude (cannot combine with &quot;fields&quot;)

  • :csv_fields (Array<String>)

    CSV only: Include additional columns

  • :file_fields (Array<String>)

    CSV only: Include file columns (row values: &#39;present&#39;, &#39;absent&#39;, or &#39;n/a&#39;)

  • :remove_empty_columns (BOOLEAN)

    CSV only: Remove empty columns from CSV output table (default to false)

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



39
40
41
42
# File 'lib/ddr_client/api/resources_api.rb', line 39

def get_resources(opts = {})
  data, _status_code, _headers = get_resources_with_http_info(opts)
  data
end

#get_resources_by_role(opts = {}) ⇒ Array<DdrAPIResourceEntity>

Find resources by role

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :agent (String)

    Person or group to whom access is granted

  • :role_type (String)

    Type of access granted

  • :scope (String)

    Scope of the access granted

  • :fields (Array<String>)

    Metadata fields to include (resource ID and model are always included)

  • :exclude_fields (Array<String>)

    Metadata fields to exclude (cannot combine with &quot;fields&quot;)

  • :csv_fields (Array<String>)

    CSV only: Include additional columns

  • :file_fields (Array<String>)

    CSV only: Include file columns (row values: &#39;present&#39;, &#39;absent&#39;, or &#39;n/a&#39;)

  • :remove_empty_columns (BOOLEAN)

    CSV only: Remove empty columns from CSV output table (default to false)

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



142
143
144
145
# File 'lib/ddr_client/api/resources_api.rb', line 142

def get_resources_by_role(opts = {})
  data, _status_code, _headers = get_resources_by_role_with_http_info(opts)
  data
end

#get_resources_by_role_with_http_info(opts = {}) ⇒ Array<(Array<DdrAPIResourceEntity>, Fixnum, Hash)>

Find resources by role

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :agent (String)

    Person or group to whom access is granted

  • :role_type (String)

    Type of access granted

  • :scope (String)

    Scope of the access granted

  • :fields (Array<String>)

    Metadata fields to include (resource ID and model are always included)

  • :exclude_fields (Array<String>)

    Metadata fields to exclude (cannot combine with &quot;fields&quot;)

  • :csv_fields (Array<String>)

    CSV only: Include additional columns

  • :file_fields (Array<String>)

    CSV only: Include file columns (row values: &#39;present&#39;, &#39;absent&#39;, or &#39;n/a&#39;)

  • :remove_empty_columns (BOOLEAN)

    CSV only: Remove empty columns from CSV output table

  • :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<DdrAPIResourceEntity>, Fixnum, Hash)>)

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



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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
# File 'lib/ddr_client/api/resources_api.rb', line 160

def get_resources_by_role_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ResourcesApi.get_resources_by_role ...'
  end
  if @api_client.config.client_side_validation && opts[:'role_type'] && !['Curator', 'Editor', 'MetadataEditor', 'Downloader', 'Viewer', 'MetadataViewer'].include?(opts[:'role_type'])
    fail ArgumentError, 'invalid value for "role_type", must be one of Curator, Editor, MetadataEditor, Downloader, Viewer, MetadataViewer'
  end
  if @api_client.config.client_side_validation && opts[:'scope'] && !['resource', 'policy'].include?(opts[:'scope'])
    fail ArgumentError, 'invalid value for "scope", must be one of resource, policy'
  end
  if @api_client.config.client_side_validation && opts[:'fields'] && !opts[:'fields'].all? { |item| ['abstract', 'accessRights', 'admin_set', 'aleph_id', 'alternative', 'aspace_id', 'available', 'biblical_book', 'category', 'chapter_and_verse', 'company', 'contentdm_id', 'contributor', 'creator', 'date', 'description', 'display_format', 'doi', 'ead_id', 'extent', 'fcrepo3_pid', 'format', 'hasPart', 'headline', 'identifier', 'ingested_by', 'ingestion_date', 'isFormatOf', 'isPartOf', 'issue_number', 'language', 'local_id', 'medium', 'nested_path', 'permanent_id', 'permanent_url', 'placement_company', 'product', 'provenance', 'publication', 'publisher', 'relation', 'research_help_contact', 'rights', 'rights_note', 'series', 'setting', 'spatial', 'sponsor', 'subject', 'title', 'tone', 'type', 'volume', 'workflow_state'].include?(item) }
    fail ArgumentError, 'invalid value for "fields", must include one of abstract, accessRights, admin_set, aleph_id, alternative, aspace_id, available, biblical_book, category, chapter_and_verse, company, contentdm_id, contributor, creator, date, description, display_format, doi, ead_id, extent, fcrepo3_pid, format, hasPart, headline, identifier, ingested_by, ingestion_date, isFormatOf, isPartOf, issue_number, language, local_id, medium, nested_path, permanent_id, permanent_url, placement_company, product, provenance, publication, publisher, relation, research_help_contact, rights, rights_note, series, setting, spatial, sponsor, subject, title, tone, type, volume, workflow_state'
  end
  if @api_client.config.client_side_validation && opts[:'exclude_fields'] && !opts[:'exclude_fields'].all? { |item| ['abstract', 'accessRights', 'admin_set', 'aleph_id', 'alternative', 'aspace_id', 'available', 'biblical_book', 'category', 'chapter_and_verse', 'company', 'contentdm_id', 'contributor', 'creator', 'date', 'description', 'display_format', 'doi', 'ead_id', 'extent', 'fcrepo3_pid', 'format', 'hasPart', 'headline', 'identifier', 'ingested_by', 'ingestion_date', 'isFormatOf', 'isPartOf', 'issue_number', 'language', 'local_id', 'medium', 'nested_path', 'permanent_id', 'permanent_url', 'placement_company', 'product', 'provenance', 'publication', 'publisher', 'relation', 'research_help_contact', 'rights', 'rights_note', 'series', 'setting', 'spatial', 'sponsor', 'subject', 'title', 'tone', 'type', 'volume', 'workflow_state'].include?(item) }
    fail ArgumentError, 'invalid value for "exclude_fields", must include one of abstract, accessRights, admin_set, aleph_id, alternative, aspace_id, available, biblical_book, category, chapter_and_verse, company, contentdm_id, contributor, creator, date, description, display_format, doi, ead_id, extent, fcrepo3_pid, format, hasPart, headline, identifier, ingested_by, ingestion_date, isFormatOf, isPartOf, issue_number, language, local_id, medium, nested_path, permanent_id, permanent_url, placement_company, product, provenance, publication, publisher, relation, research_help_contact, rights, rights_note, series, setting, spatial, sponsor, subject, title, tone, type, volume, workflow_state'
  end
  if @api_client.config.client_side_validation && opts[:'csv_fields'] && !opts[:'csv_fields'].all? { |item| ['original_filename', 'sha1', 'collection_title', 'collection_id', 'parent_title', 'parent_id'].include?(item) }
    fail ArgumentError, 'invalid value for "csv_fields", must include one of original_filename, sha1, collection_title, collection_id, parent_title, parent_id'
  end
  if @api_client.config.client_side_validation && opts[:'file_fields'] && !opts[:'file_fields'].all? { |item| ['caption', 'content', 'derived_image', 'extracted_text', 'fits_file', 'intermediate_file', 'multires_image', 'streamable_media', 'struct_metadata', 'thumbnail'].include?(item) }
    fail ArgumentError, 'invalid value for "file_fields", must include one of caption, content, derived_image, extracted_text, fits_file, intermediate_file, multires_image, streamable_media, struct_metadata, thumbnail'
  end
  # resource path
  local_var_path = '/resources/by_role'

  # query parameters
  query_params = {}
  query_params[:'agent'] = opts[:'agent'] if !opts[:'agent'].nil?
  query_params[:'role_type'] = opts[:'role_type'] if !opts[:'role_type'].nil?
  query_params[:'scope'] = opts[:'scope'] if !opts[:'scope'].nil?
  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[:'csv_fields'] = @api_client.build_collection_param(opts[:'csv_fields'], :csv) if !opts[:'csv_fields'].nil?
  query_params[:'file_fields'] = @api_client.build_collection_param(opts[:'file_fields'], :csv) if !opts[:'file_fields'].nil?
  query_params[:'remove_empty_columns'] = opts[:'remove_empty_columns'] if !opts[:'remove_empty_columns'].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<DdrAPIResourceEntity>')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ResourcesApi#get_resources_by_role\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_resources_id(id, opts = {}) ⇒ DdrAPIResourceEntity

Retrieve a resource

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :fields (Array<String>)

    Metadata fields to include (resource ID and model are always included)

  • :exclude_fields (Array<String>)

    Metadata fields to exclude (cannot combine with &quot;fields&quot;)

Returns:



227
228
229
230
# File 'lib/ddr_client/api/resources_api.rb', line 227

def get_resources_id(id, opts = {})
  data, _status_code, _headers = get_resources_id_with_http_info(id, opts)
  data
end

#get_resources_id_attachments(id, opts = {}) ⇒ Array<DdrAPIResourceEntity>

Get attachments to a Collection

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :fields (Array<String>)

    Metadata fields to include (resource ID and model are always included)

  • :exclude_fields (Array<String>)

    Metadata fields to exclude (cannot combine with &quot;fields&quot;)

  • :csv_fields (Array<String>)

    CSV only: Include additional columns

  • :file_fields (Array<String>)

    CSV only: Include file columns (row values: &#39;present&#39;, &#39;absent&#39;, or &#39;n/a&#39;)

  • :remove_empty_columns (BOOLEAN)

    CSV only: Remove empty columns from CSV output table (default to false)

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



294
295
296
297
# File 'lib/ddr_client/api/resources_api.rb', line 294

def get_resources_id_attachments(id, opts = {})
  data, _status_code, _headers = get_resources_id_attachments_with_http_info(id, opts)
  data
end

#get_resources_id_attachments_with_http_info(id, opts = {}) ⇒ Array<(Array<DdrAPIResourceEntity>, Fixnum, Hash)>

Get attachments to a Collection

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :fields (Array<String>)

    Metadata fields to include (resource ID and model are always included)

  • :exclude_fields (Array<String>)

    Metadata fields to exclude (cannot combine with &quot;fields&quot;)

  • :csv_fields (Array<String>)

    CSV only: Include additional columns

  • :file_fields (Array<String>)

    CSV only: Include file columns (row values: &#39;present&#39;, &#39;absent&#39;, or &#39;n/a&#39;)

  • :remove_empty_columns (BOOLEAN)

    CSV only: Remove empty columns from CSV output table

  • :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<DdrAPIResourceEntity>, Fixnum, Hash)>)

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



310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
# File 'lib/ddr_client/api/resources_api.rb', line 310

def get_resources_id_attachments_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ResourcesApi.get_resources_id_attachments ...'
  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 ResourcesApi.get_resources_id_attachments"
  end
  if @api_client.config.client_side_validation && opts[:'fields'] && !opts[:'fields'].all? { |item| ['abstract', 'accessRights', 'admin_set', 'aleph_id', 'alternative', 'aspace_id', 'available', 'biblical_book', 'category', 'chapter_and_verse', 'company', 'contentdm_id', 'contributor', 'creator', 'date', 'description', 'display_format', 'doi', 'ead_id', 'extent', 'fcrepo3_pid', 'format', 'hasPart', 'headline', 'identifier', 'ingested_by', 'ingestion_date', 'isFormatOf', 'isPartOf', 'issue_number', 'language', 'local_id', 'medium', 'nested_path', 'permanent_id', 'permanent_url', 'placement_company', 'product', 'provenance', 'publication', 'publisher', 'relation', 'research_help_contact', 'rights', 'rights_note', 'series', 'setting', 'spatial', 'sponsor', 'subject', 'title', 'tone', 'type', 'volume', 'workflow_state'].include?(item) }
    fail ArgumentError, 'invalid value for "fields", must include one of abstract, accessRights, admin_set, aleph_id, alternative, aspace_id, available, biblical_book, category, chapter_and_verse, company, contentdm_id, contributor, creator, date, description, display_format, doi, ead_id, extent, fcrepo3_pid, format, hasPart, headline, identifier, ingested_by, ingestion_date, isFormatOf, isPartOf, issue_number, language, local_id, medium, nested_path, permanent_id, permanent_url, placement_company, product, provenance, publication, publisher, relation, research_help_contact, rights, rights_note, series, setting, spatial, sponsor, subject, title, tone, type, volume, workflow_state'
  end
  if @api_client.config.client_side_validation && opts[:'exclude_fields'] && !opts[:'exclude_fields'].all? { |item| ['abstract', 'accessRights', 'admin_set', 'aleph_id', 'alternative', 'aspace_id', 'available', 'biblical_book', 'category', 'chapter_and_verse', 'company', 'contentdm_id', 'contributor', 'creator', 'date', 'description', 'display_format', 'doi', 'ead_id', 'extent', 'fcrepo3_pid', 'format', 'hasPart', 'headline', 'identifier', 'ingested_by', 'ingestion_date', 'isFormatOf', 'isPartOf', 'issue_number', 'language', 'local_id', 'medium', 'nested_path', 'permanent_id', 'permanent_url', 'placement_company', 'product', 'provenance', 'publication', 'publisher', 'relation', 'research_help_contact', 'rights', 'rights_note', 'series', 'setting', 'spatial', 'sponsor', 'subject', 'title', 'tone', 'type', 'volume', 'workflow_state'].include?(item) }
    fail ArgumentError, 'invalid value for "exclude_fields", must include one of abstract, accessRights, admin_set, aleph_id, alternative, aspace_id, available, biblical_book, category, chapter_and_verse, company, contentdm_id, contributor, creator, date, description, display_format, doi, ead_id, extent, fcrepo3_pid, format, hasPart, headline, identifier, ingested_by, ingestion_date, isFormatOf, isPartOf, issue_number, language, local_id, medium, nested_path, permanent_id, permanent_url, placement_company, product, provenance, publication, publisher, relation, research_help_contact, rights, rights_note, series, setting, spatial, sponsor, subject, title, tone, type, volume, workflow_state'
  end
  if @api_client.config.client_side_validation && opts[:'csv_fields'] && !opts[:'csv_fields'].all? { |item| ['original_filename', 'sha1', 'collection_title', 'collection_id', 'parent_title', 'parent_id'].include?(item) }
    fail ArgumentError, 'invalid value for "csv_fields", must include one of original_filename, sha1, collection_title, collection_id, parent_title, parent_id'
  end
  if @api_client.config.client_side_validation && opts[:'file_fields'] && !opts[:'file_fields'].all? { |item| ['caption', 'content', 'derived_image', 'extracted_text', 'fits_file', 'intermediate_file', 'multires_image', 'streamable_media', 'struct_metadata', 'thumbnail'].include?(item) }
    fail ArgumentError, 'invalid value for "file_fields", must include one of caption, content, derived_image, extracted_text, fits_file, intermediate_file, multires_image, streamable_media, struct_metadata, thumbnail'
  end
  # resource path
  local_var_path = '/resources/{id}/attachments'.sub('{' + 'id' + '}', 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?
  query_params[:'csv_fields'] = @api_client.build_collection_param(opts[:'csv_fields'], :csv) if !opts[:'csv_fields'].nil?
  query_params[:'file_fields'] = @api_client.build_collection_param(opts[:'file_fields'], :csv) if !opts[:'file_fields'].nil?
  query_params[:'remove_empty_columns'] = opts[:'remove_empty_columns'] if !opts[:'remove_empty_columns'].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<DdrAPIResourceEntity>')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ResourcesApi#get_resources_id_attachments\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_resources_id_batches(id, opts = {}) ⇒ Array<DdrAPIBatchEntity>

Get batches associated with the resource (by batch collection_id or batch object resource_id)

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :batch_objects (BOOLEAN)

    Include batch objects for each batch (default to false)

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



373
374
375
376
# File 'lib/ddr_client/api/resources_api.rb', line 373

def get_resources_id_batches(id, opts = {})
  data, _status_code, _headers = get_resources_id_batches_with_http_info(id, opts)
  data
end

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

Get batches associated with the resource (by batch collection_id or batch object resource_id)

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :batch_objects (BOOLEAN)

    Include batch objects for each batch

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



385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
# File 'lib/ddr_client/api/resources_api.rb', line 385

def get_resources_id_batches_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ResourcesApi.get_resources_id_batches ...'
  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 ResourcesApi.get_resources_id_batches"
  end
  # resource path
  local_var_path = '/resources/{id}/batches'.sub('{' + 'id' + '}', id.to_s)

  # query parameters
  query_params = {}
  query_params[:'batch_objects'] = opts[:'batch_objects'] if !opts[:'batch_objects'].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'])

  # 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: ResourcesApi#get_resources_id_batches\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_resources_id_children(id, opts = {}) ⇒ Array<DdrAPIResourceEntity>

Get children of a resource

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :fields (Array<String>)

    Metadata fields to include (resource ID and model are always included)

  • :exclude_fields (Array<String>)

    Metadata fields to exclude (cannot combine with &quot;fields&quot;)

  • :csv_fields (Array<String>)

    CSV only: Include additional columns

  • :file_fields (Array<String>)

    CSV only: Include file columns (row values: &#39;present&#39;, &#39;absent&#39;, or &#39;n/a&#39;)

  • :remove_empty_columns (BOOLEAN)

    CSV only: Remove empty columns from CSV output table (default to false)

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



436
437
438
439
# File 'lib/ddr_client/api/resources_api.rb', line 436

def get_resources_id_children(id, opts = {})
  data, _status_code, _headers = get_resources_id_children_with_http_info(id, opts)
  data
end

#get_resources_id_children_with_http_info(id, opts = {}) ⇒ Array<(Array<DdrAPIResourceEntity>, Fixnum, Hash)>

Get children of a resource

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :fields (Array<String>)

    Metadata fields to include (resource ID and model are always included)

  • :exclude_fields (Array<String>)

    Metadata fields to exclude (cannot combine with &quot;fields&quot;)

  • :csv_fields (Array<String>)

    CSV only: Include additional columns

  • :file_fields (Array<String>)

    CSV only: Include file columns (row values: &#39;present&#39;, &#39;absent&#39;, or &#39;n/a&#39;)

  • :remove_empty_columns (BOOLEAN)

    CSV only: Remove empty columns from CSV output table

  • :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<DdrAPIResourceEntity>, Fixnum, Hash)>)

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



452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
# File 'lib/ddr_client/api/resources_api.rb', line 452

def get_resources_id_children_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ResourcesApi.get_resources_id_children ...'
  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 ResourcesApi.get_resources_id_children"
  end
  if @api_client.config.client_side_validation && opts[:'fields'] && !opts[:'fields'].all? { |item| ['abstract', 'accessRights', 'admin_set', 'aleph_id', 'alternative', 'aspace_id', 'available', 'biblical_book', 'category', 'chapter_and_verse', 'company', 'contentdm_id', 'contributor', 'creator', 'date', 'description', 'display_format', 'doi', 'ead_id', 'extent', 'fcrepo3_pid', 'format', 'hasPart', 'headline', 'identifier', 'ingested_by', 'ingestion_date', 'isFormatOf', 'isPartOf', 'issue_number', 'language', 'local_id', 'medium', 'nested_path', 'permanent_id', 'permanent_url', 'placement_company', 'product', 'provenance', 'publication', 'publisher', 'relation', 'research_help_contact', 'rights', 'rights_note', 'series', 'setting', 'spatial', 'sponsor', 'subject', 'title', 'tone', 'type', 'volume', 'workflow_state'].include?(item) }
    fail ArgumentError, 'invalid value for "fields", must include one of abstract, accessRights, admin_set, aleph_id, alternative, aspace_id, available, biblical_book, category, chapter_and_verse, company, contentdm_id, contributor, creator, date, description, display_format, doi, ead_id, extent, fcrepo3_pid, format, hasPart, headline, identifier, ingested_by, ingestion_date, isFormatOf, isPartOf, issue_number, language, local_id, medium, nested_path, permanent_id, permanent_url, placement_company, product, provenance, publication, publisher, relation, research_help_contact, rights, rights_note, series, setting, spatial, sponsor, subject, title, tone, type, volume, workflow_state'
  end
  if @api_client.config.client_side_validation && opts[:'exclude_fields'] && !opts[:'exclude_fields'].all? { |item| ['abstract', 'accessRights', 'admin_set', 'aleph_id', 'alternative', 'aspace_id', 'available', 'biblical_book', 'category', 'chapter_and_verse', 'company', 'contentdm_id', 'contributor', 'creator', 'date', 'description', 'display_format', 'doi', 'ead_id', 'extent', 'fcrepo3_pid', 'format', 'hasPart', 'headline', 'identifier', 'ingested_by', 'ingestion_date', 'isFormatOf', 'isPartOf', 'issue_number', 'language', 'local_id', 'medium', 'nested_path', 'permanent_id', 'permanent_url', 'placement_company', 'product', 'provenance', 'publication', 'publisher', 'relation', 'research_help_contact', 'rights', 'rights_note', 'series', 'setting', 'spatial', 'sponsor', 'subject', 'title', 'tone', 'type', 'volume', 'workflow_state'].include?(item) }
    fail ArgumentError, 'invalid value for "exclude_fields", must include one of abstract, accessRights, admin_set, aleph_id, alternative, aspace_id, available, biblical_book, category, chapter_and_verse, company, contentdm_id, contributor, creator, date, description, display_format, doi, ead_id, extent, fcrepo3_pid, format, hasPart, headline, identifier, ingested_by, ingestion_date, isFormatOf, isPartOf, issue_number, language, local_id, medium, nested_path, permanent_id, permanent_url, placement_company, product, provenance, publication, publisher, relation, research_help_contact, rights, rights_note, series, setting, spatial, sponsor, subject, title, tone, type, volume, workflow_state'
  end
  if @api_client.config.client_side_validation && opts[:'csv_fields'] && !opts[:'csv_fields'].all? { |item| ['original_filename', 'sha1', 'collection_title', 'collection_id', 'parent_title', 'parent_id'].include?(item) }
    fail ArgumentError, 'invalid value for "csv_fields", must include one of original_filename, sha1, collection_title, collection_id, parent_title, parent_id'
  end
  if @api_client.config.client_side_validation && opts[:'file_fields'] && !opts[:'file_fields'].all? { |item| ['caption', 'content', 'derived_image', 'extracted_text', 'fits_file', 'intermediate_file', 'multires_image', 'streamable_media', 'struct_metadata', 'thumbnail'].include?(item) }
    fail ArgumentError, 'invalid value for "file_fields", must include one of caption, content, derived_image, extracted_text, fits_file, intermediate_file, multires_image, streamable_media, struct_metadata, thumbnail'
  end
  # resource path
  local_var_path = '/resources/{id}/children'.sub('{' + 'id' + '}', 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?
  query_params[:'csv_fields'] = @api_client.build_collection_param(opts[:'csv_fields'], :csv) if !opts[:'csv_fields'].nil?
  query_params[:'file_fields'] = @api_client.build_collection_param(opts[:'file_fields'], :csv) if !opts[:'file_fields'].nil?
  query_params[:'remove_empty_columns'] = opts[:'remove_empty_columns'] if !opts[:'remove_empty_columns'].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<DdrAPIResourceEntity>')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ResourcesApi#get_resources_id_children\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

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

Download original file

Parameters:

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

    the optional parameters

Returns:

  • (File)


512
513
514
515
# File 'lib/ddr_client/api/resources_api.rb', line 512

def get_resources_id_download(id, opts = {})
  data, _status_code, _headers = get_resources_id_download_with_http_info(id, opts)
  data
end

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

Download original file

Parameters:

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

    the optional parameters

Returns:

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

    File data, response status code and response headers



521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
# File 'lib/ddr_client/api/resources_api.rb', line 521

def get_resources_id_download_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ResourcesApi.get_resources_id_download ...'
  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 ResourcesApi.get_resources_id_download"
  end
  # resource path
  local_var_path = '/resources/{id}/download'.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(['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 => 'File')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ResourcesApi#get_resources_id_download\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_resources_id_files_slug(id, slug, opts = {}) ⇒ File

Download a file attached to a resource

Parameters:

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

    the optional parameters

Returns:

  • (File)


563
564
565
566
# File 'lib/ddr_client/api/resources_api.rb', line 563

def get_resources_id_files_slug(id, slug, opts = {})
  data, _status_code, _headers = get_resources_id_files_slug_with_http_info(id, slug, opts)
  data
end

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

Download a file attached to a resource

Parameters:

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

    the optional parameters

Returns:

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

    File data, response status code and response headers



573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
# File 'lib/ddr_client/api/resources_api.rb', line 573

def get_resources_id_files_slug_with_http_info(id, slug, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ResourcesApi.get_resources_id_files_slug ...'
  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 ResourcesApi.get_resources_id_files_slug"
  end
  # verify the required parameter 'slug' is set
  if @api_client.config.client_side_validation && slug.nil?
    fail ArgumentError, "Missing the required parameter 'slug' when calling ResourcesApi.get_resources_id_files_slug"
  end
  # resource path
  local_var_path = '/resources/{id}/files/{slug}'.sub('{' + 'id' + '}', id.to_s).sub('{' + 'slug' + '}', slug.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'])

  # 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: ResourcesApi#get_resources_id_files_slug\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_resources_id_fixity(id, opts = {}) ⇒ nil

Perform a fixity check on the resource Content <= 1GB is checked and results returned; content > 1GB is accepted and background job information is returned

Parameters:

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

    the optional parameters

Returns:

  • (nil)


619
620
621
622
# File 'lib/ddr_client/api/resources_api.rb', line 619

def get_resources_id_fixity(id, opts = {})
  get_resources_id_fixity_with_http_info(id, opts)
  nil
end

#get_resources_id_fixity_with_http_info(id, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Perform a fixity check on the resource Content &lt;&#x3D; 1GB is checked and results returned; content &gt; 1GB is accepted and background job information is returned

Parameters:

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
# File 'lib/ddr_client/api/resources_api.rb', line 629

def get_resources_id_fixity_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ResourcesApi.get_resources_id_fixity ...'
  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 ResourcesApi.get_resources_id_fixity"
  end
  # resource path
  local_var_path = '/resources/{id}/fixity'.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(['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)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ResourcesApi#get_resources_id_fixity\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_resources_id_members(id, opts = {}) ⇒ Array<DdrAPIResourceEntity>

Get members of a Collection Members include all resources related to the collection by admin_policy_id, which includes itself.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :model (Array<String>)

    Limit to selected model type(s)

  • :fields (Array<String>)

    Metadata fields to include (resource ID and model are always included)

  • :exclude_fields (Array<String>)

    Metadata fields to exclude (cannot combine with &quot;fields&quot;)

  • :csv_fields (Array<String>)

    CSV only: Include additional columns

  • :file_fields (Array<String>)

    CSV only: Include file columns (row values: &#39;present&#39;, &#39;absent&#39;, or &#39;n/a&#39;)

  • :remove_empty_columns (BOOLEAN)

    CSV only: Remove empty columns from CSV output table (default to false)

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



678
679
680
681
# File 'lib/ddr_client/api/resources_api.rb', line 678

def get_resources_id_members(id, opts = {})
  data, _status_code, _headers = get_resources_id_members_with_http_info(id, opts)
  data
end

#get_resources_id_members_with_http_info(id, opts = {}) ⇒ Array<(Array<DdrAPIResourceEntity>, Fixnum, Hash)>

Get members of a Collection Members include all resources related to the collection by admin_policy_id, which includes itself.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :model (Array<String>)

    Limit to selected model type(s)

  • :fields (Array<String>)

    Metadata fields to include (resource ID and model are always included)

  • :exclude_fields (Array<String>)

    Metadata fields to exclude (cannot combine with &quot;fields&quot;)

  • :csv_fields (Array<String>)

    CSV only: Include additional columns

  • :file_fields (Array<String>)

    CSV only: Include file columns (row values: &#39;present&#39;, &#39;absent&#39;, or &#39;n/a&#39;)

  • :remove_empty_columns (BOOLEAN)

    CSV only: Remove empty columns from CSV output table

  • :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<DdrAPIResourceEntity>, Fixnum, Hash)>)

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



696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
# File 'lib/ddr_client/api/resources_api.rb', line 696

def get_resources_id_members_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ResourcesApi.get_resources_id_members ...'
  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 ResourcesApi.get_resources_id_members"
  end
  if @api_client.config.client_side_validation && opts[:'model'] && !opts[:'model'].all? { |item| ['Collection', 'Item', 'Component', 'Target', 'Attachment'].include?(item) }
    fail ArgumentError, 'invalid value for "model", must include one of Collection, Item, Component, Target, Attachment'
  end
  if @api_client.config.client_side_validation && opts[:'fields'] && !opts[:'fields'].all? { |item| ['abstract', 'accessRights', 'admin_set', 'aleph_id', 'alternative', 'aspace_id', 'available', 'biblical_book', 'category', 'chapter_and_verse', 'company', 'contentdm_id', 'contributor', 'creator', 'date', 'description', 'display_format', 'doi', 'ead_id', 'extent', 'fcrepo3_pid', 'format', 'hasPart', 'headline', 'identifier', 'ingested_by', 'ingestion_date', 'isFormatOf', 'isPartOf', 'issue_number', 'language', 'local_id', 'medium', 'nested_path', 'permanent_id', 'permanent_url', 'placement_company', 'product', 'provenance', 'publication', 'publisher', 'relation', 'research_help_contact', 'rights', 'rights_note', 'series', 'setting', 'spatial', 'sponsor', 'subject', 'title', 'tone', 'type', 'volume', 'workflow_state'].include?(item) }
    fail ArgumentError, 'invalid value for "fields", must include one of abstract, accessRights, admin_set, aleph_id, alternative, aspace_id, available, biblical_book, category, chapter_and_verse, company, contentdm_id, contributor, creator, date, description, display_format, doi, ead_id, extent, fcrepo3_pid, format, hasPart, headline, identifier, ingested_by, ingestion_date, isFormatOf, isPartOf, issue_number, language, local_id, medium, nested_path, permanent_id, permanent_url, placement_company, product, provenance, publication, publisher, relation, research_help_contact, rights, rights_note, series, setting, spatial, sponsor, subject, title, tone, type, volume, workflow_state'
  end
  if @api_client.config.client_side_validation && opts[:'exclude_fields'] && !opts[:'exclude_fields'].all? { |item| ['abstract', 'accessRights', 'admin_set', 'aleph_id', 'alternative', 'aspace_id', 'available', 'biblical_book', 'category', 'chapter_and_verse', 'company', 'contentdm_id', 'contributor', 'creator', 'date', 'description', 'display_format', 'doi', 'ead_id', 'extent', 'fcrepo3_pid', 'format', 'hasPart', 'headline', 'identifier', 'ingested_by', 'ingestion_date', 'isFormatOf', 'isPartOf', 'issue_number', 'language', 'local_id', 'medium', 'nested_path', 'permanent_id', 'permanent_url', 'placement_company', 'product', 'provenance', 'publication', 'publisher', 'relation', 'research_help_contact', 'rights', 'rights_note', 'series', 'setting', 'spatial', 'sponsor', 'subject', 'title', 'tone', 'type', 'volume', 'workflow_state'].include?(item) }
    fail ArgumentError, 'invalid value for "exclude_fields", must include one of abstract, accessRights, admin_set, aleph_id, alternative, aspace_id, available, biblical_book, category, chapter_and_verse, company, contentdm_id, contributor, creator, date, description, display_format, doi, ead_id, extent, fcrepo3_pid, format, hasPart, headline, identifier, ingested_by, ingestion_date, isFormatOf, isPartOf, issue_number, language, local_id, medium, nested_path, permanent_id, permanent_url, placement_company, product, provenance, publication, publisher, relation, research_help_contact, rights, rights_note, series, setting, spatial, sponsor, subject, title, tone, type, volume, workflow_state'
  end
  if @api_client.config.client_side_validation && opts[:'csv_fields'] && !opts[:'csv_fields'].all? { |item| ['original_filename', 'sha1', 'collection_title', 'collection_id', 'parent_title', 'parent_id'].include?(item) }
    fail ArgumentError, 'invalid value for "csv_fields", must include one of original_filename, sha1, collection_title, collection_id, parent_title, parent_id'
  end
  if @api_client.config.client_side_validation && opts[:'file_fields'] && !opts[:'file_fields'].all? { |item| ['caption', 'content', 'derived_image', 'extracted_text', 'fits_file', 'intermediate_file', 'multires_image', 'streamable_media', 'struct_metadata', 'thumbnail'].include?(item) }
    fail ArgumentError, 'invalid value for "file_fields", must include one of caption, content, derived_image, extracted_text, fits_file, intermediate_file, multires_image, streamable_media, struct_metadata, thumbnail'
  end
  # resource path
  local_var_path = '/resources/{id}/members'.sub('{' + 'id' + '}', id.to_s)

  # query parameters
  query_params = {}
  query_params[:'model'] = @api_client.build_collection_param(opts[:'model'], :csv) if !opts[:'model'].nil?
  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[:'csv_fields'] = @api_client.build_collection_param(opts[:'csv_fields'], :csv) if !opts[:'csv_fields'].nil?
  query_params[:'file_fields'] = @api_client.build_collection_param(opts[:'file_fields'], :csv) if !opts[:'file_fields'].nil?
  query_params[:'remove_empty_columns'] = opts[:'remove_empty_columns'] if !opts[:'remove_empty_columns'].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<DdrAPIResourceEntity>')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ResourcesApi#get_resources_id_members\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_resources_id_permanent_id(id, opts = {}) ⇒ nil

Retrieve metadata for the permanent ID assigned to the resource

Parameters:

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

    the optional parameters

Returns:

  • (nil)


760
761
762
763
# File 'lib/ddr_client/api/resources_api.rb', line 760

def get_resources_id_permanent_id(id, opts = {})
  get_resources_id_permanent_id_with_http_info(id, opts)
  nil
end

#get_resources_id_permanent_id_with_http_info(id, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Retrieve metadata for the permanent ID assigned to the resource

Parameters:

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
# File 'lib/ddr_client/api/resources_api.rb', line 769

def get_resources_id_permanent_id_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ResourcesApi.get_resources_id_permanent_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 ResourcesApi.get_resources_id_permanent_id"
  end
  # resource path
  local_var_path = '/resources/{id}/permanent_id'.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(['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)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ResourcesApi#get_resources_id_permanent_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_resources_id_permissions(id, opts = {}) ⇒ nil

Return the effective permissions on the resource

Parameters:

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

    the optional parameters

Returns:

  • (nil)


809
810
811
812
# File 'lib/ddr_client/api/resources_api.rb', line 809

def get_resources_id_permissions(id, opts = {})
  get_resources_id_permissions_with_http_info(id, opts)
  nil
end

#get_resources_id_permissions_with_http_info(id, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Return the effective permissions on the resource

Parameters:

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
# File 'lib/ddr_client/api/resources_api.rb', line 818

def get_resources_id_permissions_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ResourcesApi.get_resources_id_permissions ...'
  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 ResourcesApi.get_resources_id_permissions"
  end
  # resource path
  local_var_path = '/resources/{id}/permissions'.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(['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)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ResourcesApi#get_resources_id_permissions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_resources_id_targets(id, opts = {}) ⇒ Array<DdrAPIResourceEntity>

Get targets associated with the Collection

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :fields (Array<String>)

    Metadata fields to include (resource ID and model are always included)

  • :exclude_fields (Array<String>)

    Metadata fields to exclude (cannot combine with &quot;fields&quot;)

  • :csv_fields (Array<String>)

    CSV only: Include additional columns

  • :file_fields (Array<String>)

    CSV only: Include file columns (row values: &#39;present&#39;, &#39;absent&#39;, or &#39;n/a&#39;)

  • :remove_empty_columns (BOOLEAN)

    CSV only: Remove empty columns from CSV output table (default to false)

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



865
866
867
868
# File 'lib/ddr_client/api/resources_api.rb', line 865

def get_resources_id_targets(id, opts = {})
  data, _status_code, _headers = get_resources_id_targets_with_http_info(id, opts)
  data
end

#get_resources_id_targets_with_http_info(id, opts = {}) ⇒ Array<(Array<DdrAPIResourceEntity>, Fixnum, Hash)>

Get targets associated with the Collection

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :fields (Array<String>)

    Metadata fields to include (resource ID and model are always included)

  • :exclude_fields (Array<String>)

    Metadata fields to exclude (cannot combine with &quot;fields&quot;)

  • :csv_fields (Array<String>)

    CSV only: Include additional columns

  • :file_fields (Array<String>)

    CSV only: Include file columns (row values: &#39;present&#39;, &#39;absent&#39;, or &#39;n/a&#39;)

  • :remove_empty_columns (BOOLEAN)

    CSV only: Remove empty columns from CSV output table

  • :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<DdrAPIResourceEntity>, Fixnum, Hash)>)

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



881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
# File 'lib/ddr_client/api/resources_api.rb', line 881

def get_resources_id_targets_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ResourcesApi.get_resources_id_targets ...'
  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 ResourcesApi.get_resources_id_targets"
  end
  if @api_client.config.client_side_validation && opts[:'fields'] && !opts[:'fields'].all? { |item| ['abstract', 'accessRights', 'admin_set', 'aleph_id', 'alternative', 'aspace_id', 'available', 'biblical_book', 'category', 'chapter_and_verse', 'company', 'contentdm_id', 'contributor', 'creator', 'date', 'description', 'display_format', 'doi', 'ead_id', 'extent', 'fcrepo3_pid', 'format', 'hasPart', 'headline', 'identifier', 'ingested_by', 'ingestion_date', 'isFormatOf', 'isPartOf', 'issue_number', 'language', 'local_id', 'medium', 'nested_path', 'permanent_id', 'permanent_url', 'placement_company', 'product', 'provenance', 'publication', 'publisher', 'relation', 'research_help_contact', 'rights', 'rights_note', 'series', 'setting', 'spatial', 'sponsor', 'subject', 'title', 'tone', 'type', 'volume', 'workflow_state'].include?(item) }
    fail ArgumentError, 'invalid value for "fields", must include one of abstract, accessRights, admin_set, aleph_id, alternative, aspace_id, available, biblical_book, category, chapter_and_verse, company, contentdm_id, contributor, creator, date, description, display_format, doi, ead_id, extent, fcrepo3_pid, format, hasPart, headline, identifier, ingested_by, ingestion_date, isFormatOf, isPartOf, issue_number, language, local_id, medium, nested_path, permanent_id, permanent_url, placement_company, product, provenance, publication, publisher, relation, research_help_contact, rights, rights_note, series, setting, spatial, sponsor, subject, title, tone, type, volume, workflow_state'
  end
  if @api_client.config.client_side_validation && opts[:'exclude_fields'] && !opts[:'exclude_fields'].all? { |item| ['abstract', 'accessRights', 'admin_set', 'aleph_id', 'alternative', 'aspace_id', 'available', 'biblical_book', 'category', 'chapter_and_verse', 'company', 'contentdm_id', 'contributor', 'creator', 'date', 'description', 'display_format', 'doi', 'ead_id', 'extent', 'fcrepo3_pid', 'format', 'hasPart', 'headline', 'identifier', 'ingested_by', 'ingestion_date', 'isFormatOf', 'isPartOf', 'issue_number', 'language', 'local_id', 'medium', 'nested_path', 'permanent_id', 'permanent_url', 'placement_company', 'product', 'provenance', 'publication', 'publisher', 'relation', 'research_help_contact', 'rights', 'rights_note', 'series', 'setting', 'spatial', 'sponsor', 'subject', 'title', 'tone', 'type', 'volume', 'workflow_state'].include?(item) }
    fail ArgumentError, 'invalid value for "exclude_fields", must include one of abstract, accessRights, admin_set, aleph_id, alternative, aspace_id, available, biblical_book, category, chapter_and_verse, company, contentdm_id, contributor, creator, date, description, display_format, doi, ead_id, extent, fcrepo3_pid, format, hasPart, headline, identifier, ingested_by, ingestion_date, isFormatOf, isPartOf, issue_number, language, local_id, medium, nested_path, permanent_id, permanent_url, placement_company, product, provenance, publication, publisher, relation, research_help_contact, rights, rights_note, series, setting, spatial, sponsor, subject, title, tone, type, volume, workflow_state'
  end
  if @api_client.config.client_side_validation && opts[:'csv_fields'] && !opts[:'csv_fields'].all? { |item| ['original_filename', 'sha1', 'collection_title', 'collection_id', 'parent_title', 'parent_id'].include?(item) }
    fail ArgumentError, 'invalid value for "csv_fields", must include one of original_filename, sha1, collection_title, collection_id, parent_title, parent_id'
  end
  if @api_client.config.client_side_validation && opts[:'file_fields'] && !opts[:'file_fields'].all? { |item| ['caption', 'content', 'derived_image', 'extracted_text', 'fits_file', 'intermediate_file', 'multires_image', 'streamable_media', 'struct_metadata', 'thumbnail'].include?(item) }
    fail ArgumentError, 'invalid value for "file_fields", must include one of caption, content, derived_image, extracted_text, fits_file, intermediate_file, multires_image, streamable_media, struct_metadata, thumbnail'
  end
  # resource path
  local_var_path = '/resources/{id}/targets'.sub('{' + 'id' + '}', 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?
  query_params[:'csv_fields'] = @api_client.build_collection_param(opts[:'csv_fields'], :csv) if !opts[:'csv_fields'].nil?
  query_params[:'file_fields'] = @api_client.build_collection_param(opts[:'file_fields'], :csv) if !opts[:'file_fields'].nil?
  query_params[:'remove_empty_columns'] = opts[:'remove_empty_columns'] if !opts[:'remove_empty_columns'].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<DdrAPIResourceEntity>')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ResourcesApi#get_resources_id_targets\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_resources_id_technical_metadata(id, opts = {}) ⇒ Array<DdrAPITechnicalMetadataEntity>

Get technical metadata for Component members of the Collection

Parameters:

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

    the optional parameters

Returns:



941
942
943
944
# File 'lib/ddr_client/api/resources_api.rb', line 941

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

#get_resources_id_technical_metadata_with_http_info(id, opts = {}) ⇒ Array<(Array<DdrAPITechnicalMetadataEntity>, Fixnum, Hash)>

Get technical metadata for Component members of the Collection

Parameters:

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

    the optional parameters

Returns:

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

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



950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
# File 'lib/ddr_client/api/resources_api.rb', line 950

def (id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ResourcesApi.get_resources_id_technical_metadata ...'
  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 ResourcesApi.get_resources_id_technical_metadata"
  end
  # resource path
  local_var_path = '/resources/{id}/technical_metadata'.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(['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<DdrAPITechnicalMetadataEntity>')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ResourcesApi#get_resources_id_technical_metadata\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_resources_id_with_http_info(id, opts = {}) ⇒ Array<(DdrAPIResourceEntity, Fixnum, Hash)>

Retrieve a resource

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :fields (Array<String>)

    Metadata fields to include (resource ID and model are always included)

  • :exclude_fields (Array<String>)

    Metadata fields to exclude (cannot combine with &quot;fields&quot;)

Returns:

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

    DdrAPIResourceEntity data, response status code and response headers



238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
# File 'lib/ddr_client/api/resources_api.rb', line 238

def get_resources_id_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ResourcesApi.get_resources_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 ResourcesApi.get_resources_id"
  end
  if @api_client.config.client_side_validation && opts[:'fields'] && !opts[:'fields'].all? { |item| ['abstract', 'accessRights', 'admin_set', 'aleph_id', 'alternative', 'aspace_id', 'available', 'biblical_book', 'category', 'chapter_and_verse', 'company', 'contentdm_id', 'contributor', 'creator', 'date', 'description', 'display_format', 'doi', 'ead_id', 'extent', 'fcrepo3_pid', 'format', 'hasPart', 'headline', 'identifier', 'ingested_by', 'ingestion_date', 'isFormatOf', 'isPartOf', 'issue_number', 'language', 'local_id', 'medium', 'nested_path', 'permanent_id', 'permanent_url', 'placement_company', 'product', 'provenance', 'publication', 'publisher', 'relation', 'research_help_contact', 'rights', 'rights_note', 'series', 'setting', 'spatial', 'sponsor', 'subject', 'title', 'tone', 'type', 'volume', 'workflow_state'].include?(item) }
    fail ArgumentError, 'invalid value for "fields", must include one of abstract, accessRights, admin_set, aleph_id, alternative, aspace_id, available, biblical_book, category, chapter_and_verse, company, contentdm_id, contributor, creator, date, description, display_format, doi, ead_id, extent, fcrepo3_pid, format, hasPart, headline, identifier, ingested_by, ingestion_date, isFormatOf, isPartOf, issue_number, language, local_id, medium, nested_path, permanent_id, permanent_url, placement_company, product, provenance, publication, publisher, relation, research_help_contact, rights, rights_note, series, setting, spatial, sponsor, subject, title, tone, type, volume, workflow_state'
  end
  if @api_client.config.client_side_validation && opts[:'exclude_fields'] && !opts[:'exclude_fields'].all? { |item| ['abstract', 'accessRights', 'admin_set', 'aleph_id', 'alternative', 'aspace_id', 'available', 'biblical_book', 'category', 'chapter_and_verse', 'company', 'contentdm_id', 'contributor', 'creator', 'date', 'description', 'display_format', 'doi', 'ead_id', 'extent', 'fcrepo3_pid', 'format', 'hasPart', 'headline', 'identifier', 'ingested_by', 'ingestion_date', 'isFormatOf', 'isPartOf', 'issue_number', 'language', 'local_id', 'medium', 'nested_path', 'permanent_id', 'permanent_url', 'placement_company', 'product', 'provenance', 'publication', 'publisher', 'relation', 'research_help_contact', 'rights', 'rights_note', 'series', 'setting', 'spatial', 'sponsor', 'subject', 'title', 'tone', 'type', 'volume', 'workflow_state'].include?(item) }
    fail ArgumentError, 'invalid value for "exclude_fields", must include one of abstract, accessRights, admin_set, aleph_id, alternative, aspace_id, available, biblical_book, category, chapter_and_verse, company, contentdm_id, contributor, creator, date, description, display_format, doi, ead_id, extent, fcrepo3_pid, format, hasPart, headline, identifier, ingested_by, ingestion_date, isFormatOf, isPartOf, issue_number, language, local_id, medium, nested_path, permanent_id, permanent_url, placement_company, product, provenance, publication, publisher, relation, research_help_contact, rights, rights_note, series, setting, spatial, sponsor, subject, title, tone, type, volume, workflow_state'
  end
  # resource path
  local_var_path = '/resources/{id}'.sub('{' + 'id' + '}', 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'])

  # 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 => 'DdrAPIResourceEntity')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ResourcesApi#get_resources_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_resources_with_http_info(opts = {}) ⇒ Array<(Array<DdrAPIResourceEntity>, Fixnum, Hash)>

Filter resources

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :admin_set (String)

    Limit to selected admin set

  • :original_filename (String)

    Match by original file name

  • :sha1 (Array<String>)

    Match by original file SHA1 digest

  • :model (Array<String>)

    Limit to selected model type(s)

  • :workflow_state (String)

    Filter by workflow state

  • :modified_before (DateTime)

    Limit results to resources created or modified before a date/time

  • :modified_since (DateTime)

    Limit results to resources created or modified since a date/time

  • :fields (Array<String>)

    Metadata fields to include (resource ID and model are always included)

  • :exclude_fields (Array<String>)

    Metadata fields to exclude (cannot combine with &quot;fields&quot;)

  • :csv_fields (Array<String>)

    CSV only: Include additional columns

  • :file_fields (Array<String>)

    CSV only: Include file columns (row values: &#39;present&#39;, &#39;absent&#39;, or &#39;n/a&#39;)

  • :remove_empty_columns (BOOLEAN)

    CSV only: Remove empty columns from CSV output table

  • :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<DdrAPIResourceEntity>, Fixnum, Hash)>)

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



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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# File 'lib/ddr_client/api/resources_api.rb', line 61

def get_resources_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ResourcesApi.get_resources ...'
  end
  if @api_client.config.client_side_validation && opts[:'admin_set'] && !['DUL Collections', 'Data and Visualization Services', 'Digital Collections', 'Duke Research Data', 'Duke Scholarship', 'Duke University School of Nursing Digital Archive', 'Electronic Books', 'NESCent: National Evolutionary Synthesis Center', 'Rubenstein Library'].include?(opts[:'admin_set'])
    fail ArgumentError, 'invalid value for "admin_set", must be one of DUL Collections, Data and Visualization Services, Digital Collections, Duke Research Data, Duke Scholarship, Duke University School of Nursing Digital Archive, Electronic Books, NESCent: National Evolutionary Synthesis Center, Rubenstein Library'
  end
  if @api_client.config.client_side_validation && opts[:'model'] && !opts[:'model'].all? { |item| ['Collection', 'Item', 'Component', 'Target', 'Attachment'].include?(item) }
    fail ArgumentError, 'invalid value for "model", must include one of Collection, Item, Component, Target, Attachment'
  end
  if @api_client.config.client_side_validation && opts[:'workflow_state'] && !['published', 'unpublished', 'nonpublishable'].include?(opts[:'workflow_state'])
    fail ArgumentError, 'invalid value for "workflow_state", must be one of published, unpublished, nonpublishable'
  end
  if @api_client.config.client_side_validation && opts[:'fields'] && !opts[:'fields'].all? { |item| ['abstract', 'accessRights', 'admin_set', 'aleph_id', 'alternative', 'aspace_id', 'available', 'biblical_book', 'category', 'chapter_and_verse', 'company', 'contentdm_id', 'contributor', 'creator', 'date', 'description', 'display_format', 'doi', 'ead_id', 'extent', 'fcrepo3_pid', 'format', 'hasPart', 'headline', 'identifier', 'ingested_by', 'ingestion_date', 'isFormatOf', 'isPartOf', 'issue_number', 'language', 'local_id', 'medium', 'nested_path', 'permanent_id', 'permanent_url', 'placement_company', 'product', 'provenance', 'publication', 'publisher', 'relation', 'research_help_contact', 'rights', 'rights_note', 'series', 'setting', 'spatial', 'sponsor', 'subject', 'title', 'tone', 'type', 'volume', 'workflow_state'].include?(item) }
    fail ArgumentError, 'invalid value for "fields", must include one of abstract, accessRights, admin_set, aleph_id, alternative, aspace_id, available, biblical_book, category, chapter_and_verse, company, contentdm_id, contributor, creator, date, description, display_format, doi, ead_id, extent, fcrepo3_pid, format, hasPart, headline, identifier, ingested_by, ingestion_date, isFormatOf, isPartOf, issue_number, language, local_id, medium, nested_path, permanent_id, permanent_url, placement_company, product, provenance, publication, publisher, relation, research_help_contact, rights, rights_note, series, setting, spatial, sponsor, subject, title, tone, type, volume, workflow_state'
  end
  if @api_client.config.client_side_validation && opts[:'exclude_fields'] && !opts[:'exclude_fields'].all? { |item| ['abstract', 'accessRights', 'admin_set', 'aleph_id', 'alternative', 'aspace_id', 'available', 'biblical_book', 'category', 'chapter_and_verse', 'company', 'contentdm_id', 'contributor', 'creator', 'date', 'description', 'display_format', 'doi', 'ead_id', 'extent', 'fcrepo3_pid', 'format', 'hasPart', 'headline', 'identifier', 'ingested_by', 'ingestion_date', 'isFormatOf', 'isPartOf', 'issue_number', 'language', 'local_id', 'medium', 'nested_path', 'permanent_id', 'permanent_url', 'placement_company', 'product', 'provenance', 'publication', 'publisher', 'relation', 'research_help_contact', 'rights', 'rights_note', 'series', 'setting', 'spatial', 'sponsor', 'subject', 'title', 'tone', 'type', 'volume', 'workflow_state'].include?(item) }
    fail ArgumentError, 'invalid value for "exclude_fields", must include one of abstract, accessRights, admin_set, aleph_id, alternative, aspace_id, available, biblical_book, category, chapter_and_verse, company, contentdm_id, contributor, creator, date, description, display_format, doi, ead_id, extent, fcrepo3_pid, format, hasPart, headline, identifier, ingested_by, ingestion_date, isFormatOf, isPartOf, issue_number, language, local_id, medium, nested_path, permanent_id, permanent_url, placement_company, product, provenance, publication, publisher, relation, research_help_contact, rights, rights_note, series, setting, spatial, sponsor, subject, title, tone, type, volume, workflow_state'
  end
  if @api_client.config.client_side_validation && opts[:'csv_fields'] && !opts[:'csv_fields'].all? { |item| ['original_filename', 'sha1', 'collection_title', 'collection_id', 'parent_title', 'parent_id'].include?(item) }
    fail ArgumentError, 'invalid value for "csv_fields", must include one of original_filename, sha1, collection_title, collection_id, parent_title, parent_id'
  end
  if @api_client.config.client_side_validation && opts[:'file_fields'] && !opts[:'file_fields'].all? { |item| ['caption', 'content', 'derived_image', 'extracted_text', 'fits_file', 'intermediate_file', 'multires_image', 'streamable_media', 'struct_metadata', 'thumbnail'].include?(item) }
    fail ArgumentError, 'invalid value for "file_fields", must include one of caption, content, derived_image, extracted_text, fits_file, intermediate_file, multires_image, streamable_media, struct_metadata, thumbnail'
  end
  # resource path
  local_var_path = '/resources'

  # query parameters
  query_params = {}
  query_params[:'admin_set'] = opts[:'admin_set'] if !opts[:'admin_set'].nil?
  query_params[:'original_filename'] = opts[:'original_filename'] if !opts[:'original_filename'].nil?
  query_params[:'sha1'] = @api_client.build_collection_param(opts[:'sha1'], :csv) if !opts[:'sha1'].nil?
  query_params[:'model'] = @api_client.build_collection_param(opts[:'model'], :csv) if !opts[:'model'].nil?
  query_params[:'workflow_state'] = opts[:'workflow_state'] if !opts[:'workflow_state'].nil?
  query_params[:'modified_before'] = opts[:'modified_before'] if !opts[:'modified_before'].nil?
  query_params[:'modified_since'] = opts[:'modified_since'] if !opts[:'modified_since'].nil?
  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[:'csv_fields'] = @api_client.build_collection_param(opts[:'csv_fields'], :csv) if !opts[:'csv_fields'].nil?
  query_params[:'file_fields'] = @api_client.build_collection_param(opts[:'file_fields'], :csv) if !opts[:'file_fields'].nil?
  query_params[:'remove_empty_columns'] = opts[:'remove_empty_columns'] if !opts[:'remove_empty_columns'].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<DdrAPIResourceEntity>')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ResourcesApi#get_resources\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#patch_resources_id(id, resources, opts = {}) ⇒ DdrAPIResourceEntity

Update a resource

Parameters:

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

    the optional parameters

Returns:



992
993
994
995
# File 'lib/ddr_client/api/resources_api.rb', line 992

def patch_resources_id(id, resources, opts = {})
  data, _status_code, _headers = patch_resources_id_with_http_info(id, resources, opts)
  data
end

#patch_resources_id_with_http_info(id, resources, opts = {}) ⇒ Array<(DdrAPIResourceEntity, Fixnum, Hash)>

Update a resource

Parameters:

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

    the optional parameters

Returns:

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

    DdrAPIResourceEntity data, response status code and response headers



1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
# File 'lib/ddr_client/api/resources_api.rb', line 1002

def patch_resources_id_with_http_info(id, resources, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ResourcesApi.patch_resources_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 ResourcesApi.patch_resources_id"
  end
  # verify the required parameter 'resources' is set
  if @api_client.config.client_side_validation && resources.nil?
    fail ArgumentError, "Missing the required parameter 'resources' when calling ResourcesApi.patch_resources_id"
  end
  # resource path
  local_var_path = '/resources/{id}'.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(['application/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(resources)
  auth_names = ['oauth']
  data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'DdrAPIResourceEntity')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ResourcesApi#patch_resources_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#post_resources(resources, opts = {}) ⇒ DdrAPIResourceEntity

Create a resource

Parameters:

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

    the optional parameters

Returns:



1049
1050
1051
1052
# File 'lib/ddr_client/api/resources_api.rb', line 1049

def post_resources(resources, opts = {})
  data, _status_code, _headers = post_resources_with_http_info(resources, opts)
  data
end

#post_resources_with_http_info(resources, opts = {}) ⇒ Array<(DdrAPIResourceEntity, Fixnum, Hash)>

Create a resource

Parameters:

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

    the optional parameters

Returns:

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

    DdrAPIResourceEntity data, response status code and response headers



1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
# File 'lib/ddr_client/api/resources_api.rb', line 1058

def post_resources_with_http_info(resources, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ResourcesApi.post_resources ...'
  end
  # verify the required parameter 'resources' is set
  if @api_client.config.client_side_validation && resources.nil?
    fail ArgumentError, "Missing the required parameter 'resources' when calling ResourcesApi.post_resources"
  end
  # resource path
  local_var_path = '/resources'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/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(resources)
  auth_names = ['oauth']
  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 => 'DdrAPIResourceEntity')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ResourcesApi#post_resources\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end