Class: DdrClient::BatchObjectsApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ BatchObjectsApi

Returns a new instance of BatchObjectsApi.



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

def api_client
  @api_client
end

Instance Method Details

#get_batch_objects(opts = {}) ⇒ Array<DdrAPIBatchObjectEntity>

Retrieve batch object records

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :resource_id (String)

    Filter by resource ID

  • :type (String)

    Filter by batch object type

  • :model (Array<String>)

    Filter by models(s)

  • :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/batch_objects_api.rb', line 30

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

#get_batch_objects_id(id, opts = {}) ⇒ DdrAPIBatchObjectEntity

Retrieve a batch object record with details (attributes, files, messages, relationships, roles)

Parameters:

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

    the optional parameters

Returns:



91
92
93
94
# File 'lib/ddr_client/api/batch_objects_api.rb', line 91

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

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

Retrieve a batch object record with details (attributes, files, messages, relationships, roles)

Parameters:

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

    the optional parameters

Returns:

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

    DdrAPIBatchObjectEntity data, response status code and response headers



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
129
130
131
132
133
134
135
136
# File 'lib/ddr_client/api/batch_objects_api.rb', line 100

def get_batch_objects_id_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BatchObjectsApi.get_batch_objects_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 BatchObjectsApi.get_batch_objects_id"
  end
  # resource path
  local_var_path = '/batch_objects/{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,
    :return_type => 'DdrAPIBatchObjectEntity')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: BatchObjectsApi#get_batch_objects_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

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

Retrieve batch object records

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :resource_id (String)

    Filter by resource ID

  • :type (String)

    Filter by batch object type

  • :model (Array<String>)

    Filter by models(s)

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



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/batch_objects_api.rb', line 43

def get_batch_objects_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BatchObjectsApi.get_batch_objects ...'
  end
  if @api_client.config.client_side_validation && opts[:'type'] && !['Ingest', 'Update'].include?(opts[:'type'])
    fail ArgumentError, 'invalid value for "type", must be one of Ingest, Update'
  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
  # resource path
  local_var_path = '/batch_objects'

  # query parameters
  query_params = {}
  query_params[:'resource_id'] = opts[:'resource_id'] if !opts[:'resource_id'].nil?
  query_params[:'type'] = opts[:'type'] if !opts[:'type'].nil?
  query_params[:'model'] = @api_client.build_collection_param(opts[:'model'], :csv) if !opts[:'model'].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: BatchObjectsApi#get_batch_objects\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end