Class: DdrClient::UsersApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ UsersApi

Returns a new instance of UsersApi.



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

def api_client
  @api_client
end

Instance Method Details

#get_users(opts = {}) ⇒ Array<DdrAPIUserEntity>

List users

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :username (String)

    User Name

  • :netid (String)

    Duke NetID

  • :duid (String)

    Duke Unique ID

  • :email (String)

    Email Address

  • :first_name (String)

    First Name

  • :last_name (String)

    Last Name

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

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

#get_users_id(id, opts = {}) ⇒ DdrAPIUserEntity

Retrieve a user record

Parameters:

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

    the optional parameters

Returns:



94
95
96
97
# File 'lib/ddr_client/api/users_api.rb', line 94

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

#get_users_id_with_http_info(id, opts = {}) ⇒ Array<(DdrAPIUserEntity, Fixnum, Hash)>

Retrieve a user record

Parameters:

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

    the optional parameters

Returns:

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

    DdrAPIUserEntity data, response status code and response headers



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

def get_users_id_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UsersApi.get_users_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 UsersApi.get_users_id"
  end
  # resource path
  local_var_path = '/users/{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 => 'DdrAPIUserEntity')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: UsersApi#get_users_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_users_with_http_info(opts = {}) ⇒ Array<(Array<DdrAPIUserEntity>, Fixnum, Hash)>

List users

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :username (String)

    User Name

  • :netid (String)

    Duke NetID

  • :duid (String)

    Duke Unique ID

  • :email (String)

    Email Address

  • :first_name (String)

    First Name

  • :last_name (String)

    Last Name

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

    Array<DdrAPIUserEntity> 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
# File 'lib/ddr_client/api/users_api.rb', line 49

def get_users_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UsersApi.get_users ...'
  end
  # resource path
  local_var_path = '/users'

  # query parameters
  query_params = {}
  query_params[:'username'] = opts[:'username'] if !opts[:'username'].nil?
  query_params[:'netid'] = opts[:'netid'] if !opts[:'netid'].nil?
  query_params[:'duid'] = opts[:'duid'] if !opts[:'duid'].nil?
  query_params[:'email'] = opts[:'email'] if !opts[:'email'].nil?
  query_params[:'first_name'] = opts[:'first_name'] if !opts[:'first_name'].nil?
  query_params[:'last_name'] = opts[:'last_name'] if !opts[:'last_name'].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<DdrAPIUserEntity>')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: UsersApi#get_users\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end