Class: DdrClient::EventsApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ EventsApi

Returns a new instance of EventsApi.



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

def api_client
  @api_client
end

Instance Method Details

#get_events(opts = {}) ⇒ Array<DdrAPIEventEntity>

Retrieve events

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :resource_id (String)

    Filter by resource (required for XML output)

  • :type (String)

    Filter by event type

  • :outcome (String)

    Filter by event outcome

  • :operator (String)

    Filter by event operator (user name or &quot;SYSTEM&quot;)

  • :since (DateTime)

    Filter events occurring since a point a time

  • :before (DateTime)

    Filter events occurring up to (before) a point in time

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



33
34
35
36
# File 'lib/ddr_client/api/events_api.rb', line 33

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

#get_events_id(id, opts = {}) ⇒ DdrAPIEventEntity

Retrieve event

Parameters:

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

    the optional parameters

Returns:



100
101
102
103
# File 'lib/ddr_client/api/events_api.rb', line 100

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

#get_events_id_with_http_info(id, opts = {}) ⇒ Array<(DdrAPIEventEntity, Fixnum, Hash)>

Retrieve event

Parameters:

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

    the optional parameters

Returns:

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

    DdrAPIEventEntity data, response status code and response headers



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
140
141
142
143
144
145
# File 'lib/ddr_client/api/events_api.rb', line 109

def get_events_id_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EventsApi.get_events_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 EventsApi.get_events_id"
  end
  # resource path
  local_var_path = '/events/{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', 'text/xml'])

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

#get_events_with_http_info(opts = {}) ⇒ Array<(Array<DdrAPIEventEntity>, Fixnum, Hash)>

Retrieve events

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :resource_id (String)

    Filter by resource (required for XML output)

  • :type (String)

    Filter by event type

  • :outcome (String)

    Filter by event outcome

  • :operator (String)

    Filter by event operator (user name or &quot;SYSTEM&quot;)

  • :since (DateTime)

    Filter events occurring since a point a time

  • :before (DateTime)

    Filter events occurring up to (before) a point in time

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

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



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
87
88
89
90
91
92
93
94
95
# File 'lib/ddr_client/api/events_api.rb', line 49

def get_events_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EventsApi.get_events ...'
  end
  if @api_client.config.client_side_validation && opts[:'type'] && !['Creation', 'Deaccession', 'Deletion', 'FixityCheck', 'Ingestion', 'Migration', 'Update', 'Validation', 'VirusCheck'].include?(opts[:'type'])
    fail ArgumentError, 'invalid value for "type", must be one of Creation, Deaccession, Deletion, FixityCheck, Ingestion, Migration, Update, Validation, VirusCheck'
  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
  # resource path
  local_var_path = '/events'

  # 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[:'outcome'] = opts[:'outcome'] if !opts[:'outcome'].nil?
  query_params[:'operator'] = opts[:'operator'] if !opts[:'operator'].nil?
  query_params[:'since'] = opts[:'since'] if !opts[:'since'].nil?
  query_params[:'before'] = opts[:'before'] if !opts[:'before'].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', 'text/xml'])

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