lib/purecloud/api/presence_api.rb in purecloud-0.35.1 vs lib/purecloud/api/presence_api.rb in purecloud-0.36.1

- old
+ new

@@ -1,44 +1,59 @@ +=begin +PureCloud API + +PureCloud API + +OpenAPI spec version: v1 +Contact: chuck.pulfer@inin.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +License: ININ +http://www.inin.com + +Terms of Service: http://www.inin.com + +=end + require "uri" module PureCloud class PresenceApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end - # Get an Organization&#39;s list of Presences + # Delete an OrganizationPresence # + # @param presence_id Organization Presence ID # @param [Hash] opts the optional parameters - # @option opts [Integer] :page_number Page number - # @option opts [Integer] :page_size Page size - # @return [OrganizationPresenceEntityListing] - def get_presencedefinitions(opts = {}) - data, status_code, headers = get_presencedefinitions_with_http_info(opts) + # @return [OrganizationPresence] + def delete_presence_id(presence_id, opts = {}) + data, status_code, headers = delete_presence_id_with_http_info(presence_id, opts) return data end - # Get an Organization&#39;s list of Presences + # Delete an OrganizationPresence # + # @param presence_id Organization Presence ID # @param [Hash] opts the optional parameters - # @option opts [Integer] :page_number Page number - # @option opts [Integer] :page_size Page size - # @return [Array<(OrganizationPresenceEntityListing, Fixnum, Hash)>] OrganizationPresenceEntityListing data, response status code and response headers - def get_presencedefinitions_with_http_info(opts = {}) + # @return [Array<(OrganizationPresence, Fixnum, Hash)>] OrganizationPresence data, response status code and response headers + def delete_presence_id_with_http_info(presence_id, opts = {}) if @api_client.config.debugging - @api_client.config.logger.debug "Calling API: PresenceApi#get_presencedefinitions ..." + @api_client.config.logger.debug "Calling API: PresenceApi#delete_presence_id ..." end + # verify the required parameter 'presence_id' is set + fail "Missing the required parameter 'presence_id' when calling delete_presence_id" if presence_id.nil? + # resource path - path = "/api/v2/presencedefinitions".sub('{format}','json') + local_var_path = "/api/v2/presencedefinitions/{presenceId}".sub('{format}','json').sub('{' + 'presenceId' + '}', presence_id.to_s) # query parameters query_params = {} - query_params[:'pageNumber'] = opts[:'page_number'] if opts[:'page_number'] - query_params[:'pageSize'] = opts[:'page_size'] if opts[:'page_size'] # header parameters header_params = {} # HTTP header 'Accept' (if needed) @@ -53,50 +68,49 @@ form_params = {} # http body (model) post_body = nil - auth_names = ['PureCloud Auth'] - data, status_code, headers = @api_client.call_api(:GET, path, + 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, - :return_type => 'OrganizationPresenceEntityListing') + :return_type => 'OrganizationPresence') if @api_client.config.debugging - @api_client.config.logger.debug "API called: PresenceApi#get_presencedefinitions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + @api_client.config.logger.debug "API called: PresenceApi#delete_presence_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end - # Create an OrganizationPresence + # Get an OrganizationPresence # - # @param body The OrganizationPresence to create + # @param presence_id Organization Presence ID # @param [Hash] opts the optional parameters # @return [OrganizationPresence] - def post_presencedefinitions(body, opts = {}) - data, status_code, headers = post_presencedefinitions_with_http_info(body, opts) + def get_presence_id(presence_id, opts = {}) + data, status_code, headers = get_presence_id_with_http_info(presence_id, opts) return data end - # Create an OrganizationPresence + # Get an OrganizationPresence # - # @param body The OrganizationPresence to create + # @param presence_id Organization Presence ID # @param [Hash] opts the optional parameters # @return [Array<(OrganizationPresence, Fixnum, Hash)>] OrganizationPresence data, response status code and response headers - def post_presencedefinitions_with_http_info(body, opts = {}) + def get_presence_id_with_http_info(presence_id, opts = {}) if @api_client.config.debugging - @api_client.config.logger.debug "Calling API: PresenceApi#post_presencedefinitions ..." + @api_client.config.logger.debug "Calling API: PresenceApi#get_presence_id ..." end - # verify the required parameter 'body' is set - fail "Missing the required parameter 'body' when calling post_presencedefinitions" if body.nil? + # verify the required parameter 'presence_id' is set + fail "Missing the required parameter 'presence_id' when calling get_presence_id" if presence_id.nil? # resource path - path = "/api/v2/presencedefinitions".sub('{format}','json') + local_var_path = "/api/v2/presencedefinitions/{presenceId}".sub('{format}','json').sub('{' + 'presenceId' + '}', presence_id.to_s) # query parameters query_params = {} # header parameters @@ -112,55 +126,55 @@ # form parameters form_params = {} # http body (model) - post_body = @api_client.object_to_http_body(body) + post_body = nil - auth_names = ['PureCloud Auth'] - data, status_code, headers = @api_client.call_api(:POST, path, + 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 => 'OrganizationPresence') if @api_client.config.debugging - @api_client.config.logger.debug "API called: PresenceApi#post_presencedefinitions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + @api_client.config.logger.debug "API called: PresenceApi#get_presence_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end - # Get an OrganizationPresence + # Get an Organization's list of Presences # - # @param presence_id Organization Presence ID # @param [Hash] opts the optional parameters - # @return [OrganizationPresence] - def get_presence_id(presence_id, opts = {}) - data, status_code, headers = get_presence_id_with_http_info(presence_id, opts) + # @option opts [Integer] :page_number Page number (default to 1) + # @option opts [Integer] :page_size Page size (default to 25) + # @return [OrganizationPresenceEntityListing] + def get_presencedefinitions(opts = {}) + data, status_code, headers = get_presencedefinitions_with_http_info(opts) return data end - # Get an OrganizationPresence + # Get an Organization&#39;s list of Presences # - # @param presence_id Organization Presence ID # @param [Hash] opts the optional parameters - # @return [Array<(OrganizationPresence, Fixnum, Hash)>] OrganizationPresence data, response status code and response headers - def get_presence_id_with_http_info(presence_id, opts = {}) + # @option opts [Integer] :page_number Page number + # @option opts [Integer] :page_size Page size + # @return [Array<(OrganizationPresenceEntityListing, Fixnum, Hash)>] OrganizationPresenceEntityListing data, response status code and response headers + def get_presencedefinitions_with_http_info(opts = {}) if @api_client.config.debugging - @api_client.config.logger.debug "Calling API: PresenceApi#get_presence_id ..." + @api_client.config.logger.debug "Calling API: PresenceApi#get_presencedefinitions ..." end - # verify the required parameter 'presence_id' is set - fail "Missing the required parameter 'presence_id' when calling get_presence_id" if presence_id.nil? - # resource path - path = "/api/v2/presencedefinitions/{presenceId}".sub('{format}','json').sub('{' + 'presenceId' + '}', presence_id.to_s) + local_var_path = "/api/v2/presencedefinitions".sub('{format}','json') # query parameters query_params = {} + query_params[:'pageNumber'] = opts[:'page_number'] if opts[:'page_number'] + query_params[:'pageSize'] = opts[:'page_size'] if opts[:'page_size'] # header parameters header_params = {} # HTTP header 'Accept' (if needed) @@ -175,55 +189,54 @@ form_params = {} # http body (model) post_body = nil - auth_names = ['PureCloud Auth'] - data, status_code, headers = @api_client.call_api(:GET, path, + 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 => 'OrganizationPresence') + :return_type => 'OrganizationPresenceEntityListing') if @api_client.config.debugging - @api_client.config.logger.debug "API called: PresenceApi#get_presence_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + @api_client.config.logger.debug "API called: PresenceApi#get_presencedefinitions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end - # Update an OrganizationPresence + # Get a user's Presence # - # @param presence_id Organization Presence ID - # @param body The OrganizationPresence to update + # @param user_id user Id + # @param source source # @param [Hash] opts the optional parameters - # @return [OrganizationPresence] - def put_presence_id(presence_id, body, opts = {}) - data, status_code, headers = put_presence_id_with_http_info(presence_id, body, opts) + # @return [UserPresence] + def get_user_id_presences_source(user_id, source, opts = {}) + data, status_code, headers = get_user_id_presences_source_with_http_info(user_id, source, opts) return data end - # Update an OrganizationPresence + # Get a user&#39;s Presence # - # @param presence_id Organization Presence ID - # @param body The OrganizationPresence to update + # @param user_id user Id + # @param source source # @param [Hash] opts the optional parameters - # @return [Array<(OrganizationPresence, Fixnum, Hash)>] OrganizationPresence data, response status code and response headers - def put_presence_id_with_http_info(presence_id, body, opts = {}) + # @return [Array<(UserPresence, Fixnum, Hash)>] UserPresence data, response status code and response headers + def get_user_id_presences_source_with_http_info(user_id, source, opts = {}) if @api_client.config.debugging - @api_client.config.logger.debug "Calling API: PresenceApi#put_presence_id ..." + @api_client.config.logger.debug "Calling API: PresenceApi#get_user_id_presences_source ..." end - # verify the required parameter 'presence_id' is set - fail "Missing the required parameter 'presence_id' when calling put_presence_id" if presence_id.nil? + # verify the required parameter 'user_id' is set + fail "Missing the required parameter 'user_id' when calling get_user_id_presences_source" if user_id.nil? - # verify the required parameter 'body' is set - fail "Missing the required parameter 'body' when calling put_presence_id" if body.nil? + # verify the required parameter 'source' is set + fail "Missing the required parameter 'source' when calling get_user_id_presences_source" if source.nil? # resource path - path = "/api/v2/presencedefinitions/{presenceId}".sub('{format}','json').sub('{' + 'presenceId' + '}', presence_id.to_s) + local_var_path = "/api/v2/users/{userId}/presences/{source}".sub('{format}','json').sub('{' + 'userId' + '}', user_id.to_s).sub('{' + 'source' + '}', source.to_s) # query parameters query_params = {} # header parameters @@ -239,52 +252,58 @@ # form parameters form_params = {} # http body (model) - post_body = @api_client.object_to_http_body(body) + post_body = nil - auth_names = ['PureCloud Auth'] - data, status_code, headers = @api_client.call_api(:PUT, path, + 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 => 'OrganizationPresence') + :return_type => 'UserPresence') if @api_client.config.debugging - @api_client.config.logger.debug "API called: PresenceApi#put_presence_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + @api_client.config.logger.debug "API called: PresenceApi#get_user_id_presences_source\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end - # Delete an OrganizationPresence - # - # @param presence_id Organization Presence ID + # Patch a user's Presence + # The presence object can be patched one of three ways. Option 1: Set the 'primary' property to true. This will set the 'source' defined in the path as the user's primary presence source. Option 2: Provide the presenceDefinition value. Option 3: Provide the message value. Option 1 can be combined with Option2 and/or Option 3. + # @param user_id user Id + # @param source source # @param [Hash] opts the optional parameters - # @return [OrganizationPresence] - def delete_presence_id(presence_id, opts = {}) - data, status_code, headers = delete_presence_id_with_http_info(presence_id, opts) + # @option opts [UserPresence] :body + # @return [UserPresence] + def patch_user_id_presences_source(user_id, source, opts = {}) + data, status_code, headers = patch_user_id_presences_source_with_http_info(user_id, source, opts) return data end - # Delete an OrganizationPresence - # - # @param presence_id Organization Presence ID + # Patch a user&#39;s Presence + # The presence object can be patched one of three ways. Option 1: Set the &#39;primary&#39; property to true. This will set the &#39;source&#39; defined in the path as the user&#39;s primary presence source. Option 2: Provide the presenceDefinition value. Option 3: Provide the message value. Option 1 can be combined with Option2 and/or Option 3. + # @param user_id user Id + # @param source source # @param [Hash] opts the optional parameters - # @return [Array<(OrganizationPresence, Fixnum, Hash)>] OrganizationPresence data, response status code and response headers - def delete_presence_id_with_http_info(presence_id, opts = {}) + # @option opts [UserPresence] :body + # @return [Array<(UserPresence, Fixnum, Hash)>] UserPresence data, response status code and response headers + def patch_user_id_presences_source_with_http_info(user_id, source, opts = {}) if @api_client.config.debugging - @api_client.config.logger.debug "Calling API: PresenceApi#delete_presence_id ..." + @api_client.config.logger.debug "Calling API: PresenceApi#patch_user_id_presences_source ..." end - # verify the required parameter 'presence_id' is set - fail "Missing the required parameter 'presence_id' when calling delete_presence_id" if presence_id.nil? + # verify the required parameter 'user_id' is set + fail "Missing the required parameter 'user_id' when calling patch_user_id_presences_source" if user_id.nil? + # verify the required parameter 'source' is set + fail "Missing the required parameter 'source' when calling patch_user_id_presences_source" if source.nil? + # resource path - path = "/api/v2/presencedefinitions/{presenceId}".sub('{format}','json').sub('{' + 'presenceId' + '}', presence_id.to_s) + local_var_path = "/api/v2/users/{userId}/presences/{source}".sub('{format}','json').sub('{' + 'userId' + '}', user_id.to_s).sub('{' + 'source' + '}', source.to_s) # query parameters query_params = {} # header parameters @@ -300,57 +319,51 @@ # form parameters form_params = {} # http body (model) - post_body = nil + post_body = @api_client.object_to_http_body(opts[:'body']) - auth_names = ['PureCloud Auth'] - data, status_code, headers = @api_client.call_api(:DELETE, path, + 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 => 'OrganizationPresence') + :return_type => 'UserPresence') if @api_client.config.debugging - @api_client.config.logger.debug "API called: PresenceApi#delete_presence_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + @api_client.config.logger.debug "API called: PresenceApi#patch_user_id_presences_source\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end - # Get a user&#39;s Presence + # Create an OrganizationPresence # - # @param user_id user Id - # @param source source + # @param body The OrganizationPresence to create # @param [Hash] opts the optional parameters - # @return [UserPresence] - def get_user_id_presences_source(user_id, source, opts = {}) - data, status_code, headers = get_user_id_presences_source_with_http_info(user_id, source, opts) + # @return [OrganizationPresence] + def post_presencedefinitions(body, opts = {}) + data, status_code, headers = post_presencedefinitions_with_http_info(body, opts) return data end - # Get a user&#39;s Presence + # Create an OrganizationPresence # - # @param user_id user Id - # @param source source + # @param body The OrganizationPresence to create # @param [Hash] opts the optional parameters - # @return [Array<(UserPresence, Fixnum, Hash)>] UserPresence data, response status code and response headers - def get_user_id_presences_source_with_http_info(user_id, source, opts = {}) + # @return [Array<(OrganizationPresence, Fixnum, Hash)>] OrganizationPresence data, response status code and response headers + def post_presencedefinitions_with_http_info(body, opts = {}) if @api_client.config.debugging - @api_client.config.logger.debug "Calling API: PresenceApi#get_user_id_presences_source ..." + @api_client.config.logger.debug "Calling API: PresenceApi#post_presencedefinitions ..." end - # verify the required parameter 'user_id' is set - fail "Missing the required parameter 'user_id' when calling get_user_id_presences_source" if user_id.nil? + # verify the required parameter 'body' is set + fail "Missing the required parameter 'body' when calling post_presencedefinitions" if body.nil? - # verify the required parameter 'source' is set - fail "Missing the required parameter 'source' when calling get_user_id_presences_source" if source.nil? - # resource path - path = "/api/v2/users/{userId}/presences/{source}".sub('{format}','json').sub('{' + 'userId' + '}', user_id.to_s).sub('{' + 'source' + '}', source.to_s) + local_var_path = "/api/v2/presencedefinitions".sub('{format}','json') # query parameters query_params = {} # header parameters @@ -366,59 +379,56 @@ # form parameters form_params = {} # http body (model) - post_body = nil + post_body = @api_client.object_to_http_body(body) - auth_names = ['PureCloud Auth'] - data, status_code, headers = @api_client.call_api(:GET, path, + 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 => 'UserPresence') + :return_type => 'OrganizationPresence') if @api_client.config.debugging - @api_client.config.logger.debug "API called: PresenceApi#get_user_id_presences_source\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + @api_client.config.logger.debug "API called: PresenceApi#post_presencedefinitions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end - # Patch a user&#39;s Presence - # The presence object can be patched one of three ways. Option 1: Set the &#39;primary&#39; property to true. This will set the &#39;source&#39; defined in the path as the user&#39;s primary presence source. Option 2: Provide the presenceDefinition value. Option 3: Provide the message value. Option 1 can be combined with Option2 and/or Option 3. - # @param user_id user Id - # @param source source + # Update an OrganizationPresence + # + # @param presence_id Organization Presence ID + # @param body The OrganizationPresence to update # @param [Hash] opts the optional parameters - # @option opts [UserPresence] :body - # @return [UserPresence] - def patch_user_id_presences_source(user_id, source, opts = {}) - data, status_code, headers = patch_user_id_presences_source_with_http_info(user_id, source, opts) + # @return [OrganizationPresence] + def put_presence_id(presence_id, body, opts = {}) + data, status_code, headers = put_presence_id_with_http_info(presence_id, body, opts) return data end - # Patch a user&#39;s Presence - # The presence object can be patched one of three ways. Option 1: Set the &#39;primary&#39; property to true. This will set the &#39;source&#39; defined in the path as the user&#39;s primary presence source. Option 2: Provide the presenceDefinition value. Option 3: Provide the message value. Option 1 can be combined with Option2 and/or Option 3. - # @param user_id user Id - # @param source source + # Update an OrganizationPresence + # + # @param presence_id Organization Presence ID + # @param body The OrganizationPresence to update # @param [Hash] opts the optional parameters - # @option opts [UserPresence] :body - # @return [Array<(UserPresence, Fixnum, Hash)>] UserPresence data, response status code and response headers - def patch_user_id_presences_source_with_http_info(user_id, source, opts = {}) + # @return [Array<(OrganizationPresence, Fixnum, Hash)>] OrganizationPresence data, response status code and response headers + def put_presence_id_with_http_info(presence_id, body, opts = {}) if @api_client.config.debugging - @api_client.config.logger.debug "Calling API: PresenceApi#patch_user_id_presences_source ..." + @api_client.config.logger.debug "Calling API: PresenceApi#put_presence_id ..." end - # verify the required parameter 'user_id' is set - fail "Missing the required parameter 'user_id' when calling patch_user_id_presences_source" if user_id.nil? + # verify the required parameter 'presence_id' is set + fail "Missing the required parameter 'presence_id' when calling put_presence_id" if presence_id.nil? - # verify the required parameter 'source' is set - fail "Missing the required parameter 'source' when calling patch_user_id_presences_source" if source.nil? + # verify the required parameter 'body' is set + fail "Missing the required parameter 'body' when calling put_presence_id" if body.nil? # resource path - path = "/api/v2/users/{userId}/presences/{source}".sub('{format}','json').sub('{' + 'userId' + '}', user_id.to_s).sub('{' + 'source' + '}', source.to_s) + local_var_path = "/api/v2/presencedefinitions/{presenceId}".sub('{format}','json').sub('{' + 'presenceId' + '}', presence_id.to_s) # query parameters query_params = {} # header parameters @@ -434,27 +444,22 @@ # form parameters form_params = {} # http body (model) - post_body = @api_client.object_to_http_body(opts[:'body']) + post_body = @api_client.object_to_http_body(body) - auth_names = ['PureCloud Auth'] - data, status_code, headers = @api_client.call_api(:PATCH, path, + data, status_code, headers = @api_client.call_api(:PUT, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, - :return_type => 'UserPresence') + :return_type => 'OrganizationPresence') if @api_client.config.debugging - @api_client.config.logger.debug "API called: PresenceApi#patch_user_id_presences_source\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + @api_client.config.logger.debug "API called: PresenceApi#put_presence_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end - - - -