class TriglavClient::UsersApi

Attributes

api_client[RW]

Public Class Methods

new(api_client = ApiClient.default) click to toggle source
# File lib/triglav_client/api/users_api.rb, line 30
def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Public Instance Methods

create_user(user, opts = {}) click to toggle source

Creates a new user in the store @param user User to add to the store @param [Hash] opts the optional parameters @return [UserResponse]

# File lib/triglav_client/api/users_api.rb, line 39
def create_user(user, opts = {})
  data, _status_code, _headers = create_user_with_http_info(user, opts)
  return data
end
create_user_with_http_info(user, opts = {}) click to toggle source

Creates a new user in the store @param user User to add to the store @param [Hash] opts the optional parameters @return [Array<(UserResponse, Fixnum, Hash)>] UserResponse data, response status code and response headers

# File lib/triglav_client/api/users_api.rb, line 49
def create_user_with_http_info(user, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: UsersApi.create_user ..."
  end
  # verify the required parameter 'user' is set
  fail ArgumentError, "Missing the required parameter 'user' when calling UsersApi.create_user" if user.nil?
  # resource path
  local_var_path = "/users".sub('{format}','json')

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}

  # HTTP header 'Accept' (if needed)
  local_header_accept = ['application/json']
  local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result

  # HTTP header 'Content-Type'
  local_header_content_type = ['application/json']
  header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(user)
  auth_names = ['api_key']
  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 => 'UserResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: UsersApi#create_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
delete_user(id, opts = {}) click to toggle source

Deletes single user @param id ID of user to fetch @param [Hash] opts the optional parameters @return [nil]

# File lib/triglav_client/api/users_api.rb, line 96
def delete_user(id, opts = {})
  delete_user_with_http_info(id, opts)
  return nil
end
delete_user_with_http_info(id, opts = {}) click to toggle source

Deletes single user @param id ID of user to fetch @param [Hash] opts the optional parameters @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers

# File lib/triglav_client/api/users_api.rb, line 106
def delete_user_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: UsersApi.delete_user ..."
  end
  # verify the required parameter 'id' is set
  fail ArgumentError, "Missing the required parameter 'id' when calling UsersApi.delete_user" if id.nil?
  # resource path
  local_var_path = "/users/{id}".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}

  # HTTP header 'Accept' (if needed)
  local_header_accept = ['application/json']
  local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result

  # HTTP header 'Content-Type'
  local_header_content_type = ['application/json']
  header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['api_key']
  data, status_code, headers = @api_client.call_api(:DELETE, 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: UsersApi#delete_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_user(id, opts = {}) click to toggle source

Returns a single user @param id ID of user to fetch @param [Hash] opts the optional parameters @return [UserResponse]

# File lib/triglav_client/api/users_api.rb, line 152
def get_user(id, opts = {})
  data, _status_code, _headers = get_user_with_http_info(id, opts)
  return data
end
get_user_with_http_info(id, opts = {}) click to toggle source

Returns a single user @param id ID of user to fetch @param [Hash] opts the optional parameters @return [Array<(UserResponse, Fixnum, Hash)>] UserResponse data, response status code and response headers

# File lib/triglav_client/api/users_api.rb, line 162
def get_user_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: UsersApi.get_user ..."
  end
  # verify the required parameter 'id' is set
  fail ArgumentError, "Missing the required parameter 'id' when calling UsersApi.get_user" if id.nil?
  # resource path
  local_var_path = "/users/{id}".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}

  # HTTP header 'Accept' (if needed)
  local_header_accept = ['application/json']
  local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result

  # HTTP header 'Content-Type'
  local_header_content_type = ['application/json']
  header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['api_key']
  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 => 'UserResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: UsersApi#get_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
list_users(opts = {}) click to toggle source

Returns all users from the system that the user has access to @param [Hash] opts the optional parameters @return [Array<UserEachResponse>]

# File lib/triglav_client/api/users_api.rb, line 208
def list_users(opts = {})
  data, _status_code, _headers = list_users_with_http_info(opts)
  return data
end
list_users_with_http_info(opts = {}) click to toggle source

Returns all users from the system that the user has access to @param [Hash] opts the optional parameters @return [Array<(Array<UserEachResponse>, Fixnum, Hash)>] Array<UserEachResponse> data, response status code and response headers

# File lib/triglav_client/api/users_api.rb, line 217
def list_users_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: UsersApi.list_users ..."
  end
  # resource path
  local_var_path = "/users".sub('{format}','json')

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}

  # HTTP header 'Accept' (if needed)
  local_header_accept = ['application/json']
  local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result

  # HTTP header 'Content-Type'
  local_header_content_type = ['application/json']
  header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['api_key']
  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<UserEachResponse>')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: UsersApi#list_users\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
update_user(id, user, opts = {}) click to toggle source

Updates a single user @param id ID of user to fetch @param user User parameters to update @param [Hash] opts the optional parameters @return [UserResponse]

# File lib/triglav_client/api/users_api.rb, line 263
def update_user(id, user, opts = {})
  data, _status_code, _headers = update_user_with_http_info(id, user, opts)
  return data
end
update_user_with_http_info(id, user, opts = {}) click to toggle source

Updates a single user @param id ID of user to fetch @param user User parameters to update @param [Hash] opts the optional parameters @return [Array<(UserResponse, Fixnum, Hash)>] UserResponse data, response status code and response headers

# File lib/triglav_client/api/users_api.rb, line 274
def update_user_with_http_info(id, user, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: UsersApi.update_user ..."
  end
  # verify the required parameter 'id' is set
  fail ArgumentError, "Missing the required parameter 'id' when calling UsersApi.update_user" if id.nil?
  # verify the required parameter 'user' is set
  fail ArgumentError, "Missing the required parameter 'user' when calling UsersApi.update_user" if user.nil?
  # resource path
  local_var_path = "/users/{id}".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}

  # HTTP header 'Accept' (if needed)
  local_header_accept = ['application/json']
  local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result

  # HTTP header 'Content-Type'
  local_header_content_type = ['application/json']
  header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)

  # form parameters
  form_params = {}

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