class AlfrescoAPI::RatingsApi

Attributes

api_client[RW]

Public Class Methods

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

Public Instance Methods

create_rating(node_id, rating_body_create, opts = {}) click to toggle source

Create a rating Create a rating for the node with identifier nodeId @param node_id The identifier of a node. @param rating_body_create For "myRating&quot; the type is specific to the rating scheme, boolean for the likes and an integer for the fiveStar. For example, to "like&quot; a file the following body would be used: &#x60;&#x60;&#x60;JSON { "id&quot;: "likes&quot;, "myRating&quot;: true } &#x60;&#x60;&#x60; @param [Hash] opts the optional parameters @option opts [Array<String>] :fields A list of field names. You can use this parameter to restrict the fields returned within a response if, for example, you want to save on overall bandwidth. The list applies to a returned individual entity or entries within a collection. If the API method also supports the include parameter, then the fields specified in the include parameter are returned in addition to those specified in the fields parameter. @return [RatingEntry]

# File lib/alfresco_api/api/ratings_api.rb, line 30
def create_rating(node_id, rating_body_create, opts = {})
  data, _status_code, _headers = create_rating_with_http_info(node_id, rating_body_create, opts)
  return data
end
create_rating_with_http_info(node_id, rating_body_create, opts = {}) click to toggle source

Create a rating Create a rating for the node with identifier nodeId @param node_id The identifier of a node. @param rating_body_create For "myRating&quot; the type is specific to the rating scheme, boolean for the likes and an integer for the fiveStar. For example, to "like&quot; a file the following body would be used: &#x60;&#x60;&#x60;JSON { "id&quot;: "likes&quot;, "myRating&quot;: true } &#x60;&#x60;&#x60; @param [Hash] opts the optional parameters @option opts [Array<String>] :fields A list of field names. You can use this parameter to restrict the fields returned within a response if, for example, you want to save on overall bandwidth. The list applies to a returned individual entity or entries within a collection. If the API method also supports the include parameter, then the fields specified in the include parameter are returned in addition to those specified in the fields parameter. @return [Array<(RatingEntry, Fixnum, Hash)>] RatingEntry data, response status code and response headers

# File lib/alfresco_api/api/ratings_api.rb, line 42
def create_rating_with_http_info(node_id, rating_body_create, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: RatingsApi.create_rating ..."
  end
  # verify the required parameter 'node_id' is set
  if @api_client.config.client_side_validation && node_id.nil?
    fail ArgumentError, "Missing the required parameter 'node_id' when calling RatingsApi.create_rating"
  end
  # verify the required parameter 'rating_body_create' is set
  if @api_client.config.client_side_validation && rating_body_create.nil?
    fail ArgumentError, "Missing the required parameter 'rating_body_create' when calling RatingsApi.create_rating"
  end
  # resource path
  local_var_path = "/nodes/{nodeId}/ratings".sub('{' + 'nodeId' + '}', node_id.to_s)

  # query parameters
  query_params = {}
  query_params[:'fields'] = @api_client.build_collection_param(opts[:'fields'], :csv) if !opts[:'fields'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(rating_body_create)
  auth_names = ['basicAuth']
  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 => 'RatingEntry')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: RatingsApi#create_rating\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
delete_rating(node_id, rating_id, opts = {}) click to toggle source

Delete a rating Deletes rating ratingId from node nodeId. @param node_id The identifier of a node. @param rating_id The identifier of a rating. @param [Hash] opts the optional parameters @return [nil]

# File lib/alfresco_api/api/ratings_api.rb, line 93
def delete_rating(node_id, rating_id, opts = {})
  delete_rating_with_http_info(node_id, rating_id, opts)
  return nil
end
delete_rating_with_http_info(node_id, rating_id, opts = {}) click to toggle source

Delete a rating Deletes rating ratingId from node nodeId. @param node_id The identifier of a node. @param rating_id The identifier of a rating. @param [Hash] opts the optional parameters @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers

# File lib/alfresco_api/api/ratings_api.rb, line 104
def delete_rating_with_http_info(node_id, rating_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: RatingsApi.delete_rating ..."
  end
  # verify the required parameter 'node_id' is set
  if @api_client.config.client_side_validation && node_id.nil?
    fail ArgumentError, "Missing the required parameter 'node_id' when calling RatingsApi.delete_rating"
  end
  # verify the required parameter 'rating_id' is set
  if @api_client.config.client_side_validation && rating_id.nil?
    fail ArgumentError, "Missing the required parameter 'rating_id' when calling RatingsApi.delete_rating"
  end
  # resource path
  local_var_path = "/nodes/{nodeId}/ratings/{ratingId}".sub('{' + 'nodeId' + '}', node_id.to_s).sub('{' + 'ratingId' + '}', rating_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'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['basicAuth']
  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: RatingsApi#delete_rating\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_rating(node_id, rating_id, opts = {}) click to toggle source

Get a rating Get the specific rating ratingId on node nodeId. @param node_id The identifier of a node. @param rating_id The identifier of a rating. @param [Hash] opts the optional parameters @option opts [Array<String>] :fields A list of field names. You can use this parameter to restrict the fields returned within a response if, for example, you want to save on overall bandwidth. The list applies to a returned individual entity or entries within a collection. If the API method also supports the include parameter, then the fields specified in the include parameter are returned in addition to those specified in the fields parameter. @return [RatingEntry]

# File lib/alfresco_api/api/ratings_api.rb, line 154
def get_rating(node_id, rating_id, opts = {})
  data, _status_code, _headers = get_rating_with_http_info(node_id, rating_id, opts)
  return data
end
get_rating_with_http_info(node_id, rating_id, opts = {}) click to toggle source

Get a rating Get the specific rating ratingId on node nodeId. @param node_id The identifier of a node. @param rating_id The identifier of a rating. @param [Hash] opts the optional parameters @option opts [Array<String>] :fields A list of field names. You can use this parameter to restrict the fields returned within a response if, for example, you want to save on overall bandwidth. The list applies to a returned individual entity or entries within a collection. If the API method also supports the include parameter, then the fields specified in the include parameter are returned in addition to those specified in the fields parameter. @return [Array<(RatingEntry, Fixnum, Hash)>] RatingEntry data, response status code and response headers

# File lib/alfresco_api/api/ratings_api.rb, line 166
def get_rating_with_http_info(node_id, rating_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: RatingsApi.get_rating ..."
  end
  # verify the required parameter 'node_id' is set
  if @api_client.config.client_side_validation && node_id.nil?
    fail ArgumentError, "Missing the required parameter 'node_id' when calling RatingsApi.get_rating"
  end
  # verify the required parameter 'rating_id' is set
  if @api_client.config.client_side_validation && rating_id.nil?
    fail ArgumentError, "Missing the required parameter 'rating_id' when calling RatingsApi.get_rating"
  end
  # resource path
  local_var_path = "/nodes/{nodeId}/ratings/{ratingId}".sub('{' + 'nodeId' + '}', node_id.to_s).sub('{' + 'ratingId' + '}', rating_id.to_s)

  # query parameters
  query_params = {}
  query_params[:'fields'] = @api_client.build_collection_param(opts[:'fields'], :csv) if !opts[:'fields'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

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

List ratings Gets a list of ratings for node nodeId. @param node_id The identifier of a node. @param [Hash] opts the optional parameters @option opts [Integer] :skip_count The number of entities that exist in the collection before those included in this list. If not supplied then the default value is 0. (default to 0) @option opts [Integer] :max_items The maximum number of items to return in the list. If not supplied then the default value is 100. (default to 100) @option opts [Array<String>] :fields A list of field names. You can use this parameter to restrict the fields returned within a response if, for example, you want to save on overall bandwidth. The list applies to a returned individual entity or entries within a collection. If the API method also supports the include parameter, then the fields specified in the include parameter are returned in addition to those specified in the fields parameter. @return [RatingPaging]

# File lib/alfresco_api/api/ratings_api.rb, line 219
def list_ratings(node_id, opts = {})
  data, _status_code, _headers = list_ratings_with_http_info(node_id, opts)
  return data
end
list_ratings_with_http_info(node_id, opts = {}) click to toggle source

List ratings Gets a list of ratings for node nodeId. @param node_id The identifier of a node. @param [Hash] opts the optional parameters @option opts [Integer] :skip_count The number of entities that exist in the collection before those included in this list. If not supplied then the default value is 0. @option opts [Integer] :max_items The maximum number of items to return in the list. If not supplied then the default value is 100. @option opts [Array<String>] :fields A list of field names. You can use this parameter to restrict the fields returned within a response if, for example, you want to save on overall bandwidth. The list applies to a returned individual entity or entries within a collection. If the API method also supports the include parameter, then the fields specified in the include parameter are returned in addition to those specified in the fields parameter. @return [Array<(RatingPaging, Fixnum, Hash)>] RatingPaging data, response status code and response headers

# File lib/alfresco_api/api/ratings_api.rb, line 232
def list_ratings_with_http_info(node_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: RatingsApi.list_ratings ..."
  end
  # verify the required parameter 'node_id' is set
  if @api_client.config.client_side_validation && node_id.nil?
    fail ArgumentError, "Missing the required parameter 'node_id' when calling RatingsApi.list_ratings"
  end
  if @api_client.config.client_side_validation && !opts[:'skip_count'].nil? && opts[:'skip_count'] < 0
    fail ArgumentError, 'invalid value for "opts[:"skip_count"]" when calling RatingsApi.list_ratings, must be greater than or equal to 0.'
  end

  if @api_client.config.client_side_validation && !opts[:'max_items'].nil? && opts[:'max_items'] < 1
    fail ArgumentError, 'invalid value for "opts[:"max_items"]" when calling RatingsApi.list_ratings, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = "/nodes/{nodeId}/ratings".sub('{' + 'nodeId' + '}', node_id.to_s)

  # query parameters
  query_params = {}
  query_params[:'skipCount'] = opts[:'skip_count'] if !opts[:'skip_count'].nil?
  query_params[:'maxItems'] = opts[:'max_items'] if !opts[:'max_items'].nil?
  query_params[:'fields'] = @api_client.build_collection_param(opts[:'fields'], :csv) if !opts[:'fields'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

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