require "uri" module PureCloud class LicensingApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Get Licenses required for a set of permissions. # # @param [Hash] opts the optional parameters # @option opts [Array] :permission Permission # @return [Array] def get_licenses(opts = {}) data, status_code, headers = get_licenses_with_http_info(opts) return data end # Get Licenses required for a set of permissions. # # @param [Hash] opts the optional parameters # @option opts [Array] :permission Permission # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers def get_licenses_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: LicensingApi#get_licenses ..." end # resource path path = "/api/v1/licensing/licenses".sub('{format}','json') # query parameters query_params = {} query_params[:'permission'] = @api_client.build_collection_param(opts[:'permission'], :multi) if opts[:'permission'] # header parameters header_params = {} # HTTP header 'Accept' (if needed) _header_accept = ['application/json'] _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result # HTTP header 'Content-Type' _header_content_type = ['application/json'] header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['PureCloud Auth'] data, status_code, headers = @api_client.call_api(:GET, path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'Array') if @api_client.config.debugging @api_client.config.logger.debug "API called: LicensingApi#get_licenses\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get org license assignments. # # @param [Hash] opts the optional parameters # @return [OrgLicenseAssignment] def get_orgassignments(opts = {}) data, status_code, headers = get_orgassignments_with_http_info(opts) return data end # Get org license assignments. # # @param [Hash] opts the optional parameters # @return [Array<(OrgLicenseAssignment, Fixnum, Hash)>] OrgLicenseAssignment data, response status code and response headers def get_orgassignments_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: LicensingApi#get_orgassignments ..." end # resource path path = "/api/v1/licensing/orgassignments".sub('{format}','json') # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) _header_accept = ['application/json'] _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result # HTTP header 'Content-Type' _header_content_type = ['application/json'] header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['PureCloud Auth'] data, status_code, headers = @api_client.call_api(:GET, path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'OrgLicenseAssignment') if @api_client.config.debugging @api_client.config.logger.debug "API called: LicensingApi#get_orgassignments\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get org license assignment. # # @param id ID # @param [Hash] opts the optional parameters # @return [OrgLicenseAssignment] def get_orgassignments_id(id, opts = {}) data, status_code, headers = get_orgassignments_id_with_http_info(id, opts) return data end # Get org license assignment. # # @param id ID # @param [Hash] opts the optional parameters # @return [Array<(OrgLicenseAssignment, Fixnum, Hash)>] OrgLicenseAssignment data, response status code and response headers def get_orgassignments_id_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: LicensingApi#get_orgassignments_id ..." end # verify the required parameter 'id' is set fail "Missing the required parameter 'id' when calling get_orgassignments_id" if id.nil? # resource path path = "/api/v1/licensing/orgassignments/{id}".sub('{format}','json').sub('{' + 'id' + '}', id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) _header_accept = ['application/json'] _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result # HTTP header 'Content-Type' _header_content_type = ['application/json'] header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['PureCloud Auth'] data, status_code, headers = @api_client.call_api(:GET, path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'OrgLicenseAssignment') if @api_client.config.debugging @api_client.config.logger.debug "API called: LicensingApi#get_orgassignments_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get Licenses required per permission. # # @param [Hash] opts the optional parameters # @option opts [Array] :id ID # @return [Array] def get_permissions(opts = {}) data, status_code, headers = get_permissions_with_http_info(opts) return data end # Get Licenses required per permission. # # @param [Hash] opts the optional parameters # @option opts [Array] :id ID # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers def get_permissions_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: LicensingApi#get_permissions ..." end # resource path path = "/api/v1/licensing/permissions".sub('{format}','json') # query parameters query_params = {} query_params[:'id'] = @api_client.build_collection_param(opts[:'id'], :multi) if opts[:'id'] # header parameters header_params = {} # HTTP header 'Accept' (if needed) _header_accept = ['application/json'] _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result # HTTP header 'Content-Type' _header_content_type = ['application/json'] header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['PureCloud Auth'] data, status_code, headers = @api_client.call_api(:GET, path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'Array') if @api_client.config.debugging @api_client.config.logger.debug "API called: LicensingApi#get_permissions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get Licenses required per permission. # # @param [Hash] opts the optional parameters # @option opts [Array] :id ID # @option opts [Permissions] :body The permissions details # @return [Array] def create_permissions(opts = {}) data, status_code, headers = create_permissions_with_http_info(opts) return data end # Get Licenses required per permission. # # @param [Hash] opts the optional parameters # @option opts [Array] :id ID # @option opts [Permissions] :body The permissions details # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers def create_permissions_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: LicensingApi#create_permissions ..." end # resource path path = "/api/v1/licensing/permissions".sub('{format}','json') # query parameters query_params = {} query_params[:'id'] = @api_client.build_collection_param(opts[:'id'], :multi) if opts[:'id'] # header parameters header_params = {} # HTTP header 'Accept' (if needed) _header_accept = ['application/json'] _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result # HTTP header 'Content-Type' _header_content_type = ['application/json'] header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(opts[:'body']) auth_names = ['PureCloud Auth'] data, status_code, headers = @api_client.call_api(:POST, path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'Array') if @api_client.config.debugging @api_client.config.logger.debug "API called: LicensingApi#create_permissions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get user license assignments. # # @param [Hash] opts the optional parameters # @return [UserLicenseAssignment] def get_userassignments(opts = {}) data, status_code, headers = get_userassignments_with_http_info(opts) return data end # Get user license assignments. # # @param [Hash] opts the optional parameters # @return [Array<(UserLicenseAssignment, Fixnum, Hash)>] UserLicenseAssignment data, response status code and response headers def get_userassignments_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: LicensingApi#get_userassignments ..." end # resource path path = "/api/v1/licensing/userassignments".sub('{format}','json') # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) _header_accept = ['application/json'] _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result # HTTP header 'Content-Type' _header_content_type = ['application/json'] header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['PureCloud Auth'] data, status_code, headers = @api_client.call_api(:GET, path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'UserLicenseAssignment') if @api_client.config.debugging @api_client.config.logger.debug "API called: LicensingApi#get_userassignments\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get user license assignment. # # @param id ID # @param [Hash] opts the optional parameters # @return [UserLicenseAssignment] def get_userassignments_id(id, opts = {}) data, status_code, headers = get_userassignments_id_with_http_info(id, opts) return data end # Get user license assignment. # # @param id ID # @param [Hash] opts the optional parameters # @return [Array<(UserLicenseAssignment, Fixnum, Hash)>] UserLicenseAssignment data, response status code and response headers def get_userassignments_id_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: LicensingApi#get_userassignments_id ..." end # verify the required parameter 'id' is set fail "Missing the required parameter 'id' when calling get_userassignments_id" if id.nil? # resource path path = "/api/v1/licensing/userassignments/{id}".sub('{format}','json').sub('{' + 'id' + '}', id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) _header_accept = ['application/json'] _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result # HTTP header 'Content-Type' _header_content_type = ['application/json'] header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['PureCloud Auth'] data, status_code, headers = @api_client.call_api(:GET, path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'UserLicenseAssignment') if @api_client.config.debugging @api_client.config.logger.debug "API called: LicensingApi#get_userassignments_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end