class Pipedrive::ProductsApi

Attributes

api_client[RW]

Public Class Methods

new(api_client = ApiClient.default) click to toggle source
# File lib/pipedrive-openapi-client/api/products_api.rb, line 19
def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Public Instance Methods

products_find_get_with_http_info(term, opts = {}) click to toggle source

Find products by name &lt;strong&gt;This endpoint is deprecated. Please use &lt;a href&#x3D;&quot;developers.pipedrive.com/docs/api/v1/#!/Products/get_products_search">/v1/products/search</a>; or &lt;a href&#x3D;&quot;developers.pipedrive.com/docs/api/v1/#!/ItemSearch/get_itemSearch">/v1/itemSearch</a>; instead&lt;/strong&gt;. &lt;br&gt; Returns data about the products that were found. If currency was set in request, prices in that currency are served back. @param term [String] Search term to look for, minimum 3 characters. @param [Hash] opts the optional parameters @option opts [String] :currency Currency code in which prices should be returned in. If omitted, prices in user&#39;s default currency will be returned. @option opts [Integer] :start Pagination start @option opts [Integer] :limit Items shown per page @return [Array<(FindProductsByNameResponse, Integer, Hash)>] FindProductsByNameResponse data, response status code and response headers

# File lib/pipedrive-openapi-client/api/products_api.rb, line 43
def products_find_get_with_http_info(term, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProductsApi.products_find_get ...'
  end
  # verify the required parameter 'term' is set
  if @api_client.config.client_side_validation && term.nil?
    fail ArgumentError, "Missing the required parameter 'term' when calling ProductsApi.products_find_get"
  end
  # resource path
  local_var_path = '/products/find'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'term'] = term
  query_params[:'currency'] = opts[:'currency'] if !opts[:'currency'].nil?
  query_params[:'start'] = opts[:'start'] if !opts[:'start'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] || 'FindProductsByNameResponse' 

  # auth_names
  auth_names = opts[:auth_names] || ['api_key', 'oauth2']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProductsApi#products_find_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
products_get(opts = {}) click to toggle source

Get all products Returns data about all products. @param [Hash] opts the optional parameters @option opts [Integer] :user_id If supplied, only products owned by the given user will be returned. @option opts [Integer] :filter_id ID of the filter to use @option opts [String] :first_char If supplied, only products whose name starts with the specified letter will be returned (case insensitive). @option opts [Integer] :start Pagination start (default to 0) @option opts [Integer] :limit Items shown per page @return [Product]

# File lib/pipedrive-openapi-client/api/products_api.rb, line 103
def products_get(opts = {})
  data, _status_code, _headers = products_get_with_http_info(opts)
  data
end
products_get_with_http_info(opts = {}) click to toggle source

Get all products Returns data about all products. @param [Hash] opts the optional parameters @option opts [Integer] :user_id If supplied, only products owned by the given user will be returned. @option opts [Integer] :filter_id ID of the filter to use @option opts [String] :first_char If supplied, only products whose name starts with the specified letter will be returned (case insensitive). @option opts [Integer] :start Pagination start @option opts [Integer] :limit Items shown per page @return [Array<(Product, Integer, Hash)>] Product data, response status code and response headers

# File lib/pipedrive-openapi-client/api/products_api.rb, line 117
def products_get_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProductsApi.products_get ...'
  end
  # resource path
  local_var_path = '/products'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'user_id'] = opts[:'user_id'] if !opts[:'user_id'].nil?
  query_params[:'filter_id'] = opts[:'filter_id'] if !opts[:'filter_id'].nil?
  query_params[:'first_char'] = opts[:'first_char'] if !opts[:'first_char'].nil?
  query_params[:'start'] = opts[:'start'] if !opts[:'start'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] || 'Product' 

  # auth_names
  auth_names = opts[:auth_names] || ['api_key', 'oauth2']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProductsApi#products_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
products_id_deals_get(id, opts = {}) click to toggle source

Get deals where a product is attached to Returns data about deals that have a product attached to. @param id [Integer] ID of the product @param [Hash] opts the optional parameters @option opts [Integer] :start Pagination start (default to 0) @option opts [Integer] :limit Items shown per page @option opts [String] :status Only fetch deals with specific status. If omitted, all not deleted deals are fetched. (default to 'all_not_deleted') @return [BasicDeal]

# File lib/pipedrive-openapi-client/api/products_api.rb, line 173
def products_id_deals_get(id, opts = {})
  data, _status_code, _headers = products_id_deals_get_with_http_info(id, opts)
  data
end
products_id_deals_get_with_http_info(id, opts = {}) click to toggle source

Get deals where a product is attached to Returns data about deals that have a product attached to. @param id [Integer] ID of the product @param [Hash] opts the optional parameters @option opts [Integer] :start Pagination start @option opts [Integer] :limit Items shown per page @option opts [String] :status Only fetch deals with specific status. If omitted, all not deleted deals are fetched. @return [Array<(BasicDeal, Integer, Hash)>] BasicDeal data, response status code and response headers

# File lib/pipedrive-openapi-client/api/products_api.rb, line 186
def products_id_deals_get_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProductsApi.products_id_deals_get ...'
  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 ProductsApi.products_id_deals_get"
  end
  allowable_values = ["open", "won", "lost", "deleted", "all_not_deleted"]
  if @api_client.config.client_side_validation && opts[:'status'] && !allowable_values.include?(opts[:'status'])
    fail ArgumentError, "invalid value for \"status\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/products/{id}/deals'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'start'] = opts[:'start'] if !opts[:'start'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] || 'BasicDeal' 

  # auth_names
  auth_names = opts[:auth_names] || ['api_key', 'oauth2']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProductsApi#products_id_deals_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
products_id_delete(id, opts = {}) click to toggle source

Delete a product Marks a product as deleted. @param id [Integer] ID of the product @param [Hash] opts the optional parameters @return [nil]

# File lib/pipedrive-openapi-client/api/products_api.rb, line 245
def products_id_delete(id, opts = {})
  products_id_delete_with_http_info(id, opts)
  nil
end
products_id_delete_with_http_info(id, opts = {}) click to toggle source

Delete a product Marks a product as deleted. @param id [Integer] ID of the product @param [Hash] opts the optional parameters @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers

# File lib/pipedrive-openapi-client/api/products_api.rb, line 255
def products_id_delete_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProductsApi.products_id_delete ...'
  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 ProductsApi.products_id_delete"
  end
  # resource path
  local_var_path = '/products/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] 

  # auth_names
  auth_names = opts[:auth_names] || ['api_key', 'oauth2']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProductsApi#products_id_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
products_id_files_get(id, opts = {}) click to toggle source

List files attached to a product Lists files associated with a product. @param id [Integer] ID of the product @param [Hash] opts the optional parameters @option opts [Integer] :start Pagination start (default to 0) @option opts [Integer] :limit Items shown per page @option opts [NumberBoolean] :include_deleted_files When enabled, the list of files will also include deleted files. Please note that trying to download these files will not work. @option opts [String] :sort Field names and sorting mode separated by a comma (field_name_1 ASC, field_name_2 DESC). Only first-level field keys are supported (no nested keys). Supported fields: id, user_id, deal_id, person_id, org_id, product_id, add_time, update_time, file_name, file_type, file_size, comment. @return [nil]

# File lib/pipedrive-openapi-client/api/products_api.rb, line 309
def products_id_files_get(id, opts = {})
  products_id_files_get_with_http_info(id, opts)
  nil
end
products_id_files_get_with_http_info(id, opts = {}) click to toggle source

List files attached to a product Lists files associated with a product. @param id [Integer] ID of the product @param [Hash] opts the optional parameters @option opts [Integer] :start Pagination start @option opts [Integer] :limit Items shown per page @option opts [NumberBoolean] :include_deleted_files When enabled, the list of files will also include deleted files. Please note that trying to download these files will not work. @option opts [String] :sort Field names and sorting mode separated by a comma (field_name_1 ASC, field_name_2 DESC). Only first-level field keys are supported (no nested keys). Supported fields: id, user_id, deal_id, person_id, org_id, product_id, add_time, update_time, file_name, file_type, file_size, comment. @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers

# File lib/pipedrive-openapi-client/api/products_api.rb, line 323
def products_id_files_get_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProductsApi.products_id_files_get ...'
  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 ProductsApi.products_id_files_get"
  end
  # resource path
  local_var_path = '/products/{id}/files'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'start'] = opts[:'start'] if !opts[:'start'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'include_deleted_files'] = opts[:'include_deleted_files'] if !opts[:'include_deleted_files'].nil?
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?

  # header parameters
  header_params = opts[:header_params] || {}

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] 

  # auth_names
  auth_names = opts[:auth_names] || ['api_key', 'oauth2']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProductsApi#products_id_files_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
products_id_followers_follower_id_delete(id, follower_id, opts = {}) click to toggle source

Delete a follower from a product Deletes a follower from a product. @param id [Integer] ID of the product @param follower_id [Integer] ID of the follower @param [Hash] opts the optional parameters @return [DeleteProductFollowerResponse]

# File lib/pipedrive-openapi-client/api/products_api.rb, line 378
def products_id_followers_follower_id_delete(id, follower_id, opts = {})
  data, _status_code, _headers = products_id_followers_follower_id_delete_with_http_info(id, follower_id, opts)
  data
end
products_id_followers_follower_id_delete_with_http_info(id, follower_id, opts = {}) click to toggle source

Delete a follower from a product Deletes a follower from a product. @param id [Integer] ID of the product @param follower_id [Integer] ID of the follower @param [Hash] opts the optional parameters @return [Array<(DeleteProductFollowerResponse, Integer, Hash)>] DeleteProductFollowerResponse data, response status code and response headers

# File lib/pipedrive-openapi-client/api/products_api.rb, line 389
def products_id_followers_follower_id_delete_with_http_info(id, follower_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProductsApi.products_id_followers_follower_id_delete ...'
  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 ProductsApi.products_id_followers_follower_id_delete"
  end
  # verify the required parameter 'follower_id' is set
  if @api_client.config.client_side_validation && follower_id.nil?
    fail ArgumentError, "Missing the required parameter 'follower_id' when calling ProductsApi.products_id_followers_follower_id_delete"
  end
  # resource path
  local_var_path = '/products/{id}/followers/{follower_id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)).sub('{' + 'follower_id' + '}', CGI.escape(follower_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] || 'DeleteProductFollowerResponse' 

  # auth_names
  auth_names = opts[:auth_names] || ['api_key']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProductsApi#products_id_followers_follower_id_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
products_id_followers_get(id, opts = {}) click to toggle source

List followers of a product Lists the followers of a Product @param id [Integer] ID of the product @param [Hash] opts the optional parameters @return [UserIDs]

# File lib/pipedrive-openapi-client/api/products_api.rb, line 445
def products_id_followers_get(id, opts = {})
  data, _status_code, _headers = products_id_followers_get_with_http_info(id, opts)
  data
end
products_id_followers_get_with_http_info(id, opts = {}) click to toggle source

List followers of a product Lists the followers of a Product @param id [Integer] ID of the product @param [Hash] opts the optional parameters @return [Array<(UserIDs, Integer, Hash)>] UserIDs data, response status code and response headers

# File lib/pipedrive-openapi-client/api/products_api.rb, line 455
def products_id_followers_get_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProductsApi.products_id_followers_get ...'
  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 ProductsApi.products_id_followers_get"
  end
  # resource path
  local_var_path = '/products/{id}/followers'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] || 'UserIDs' 

  # auth_names
  auth_names = opts[:auth_names] || ['api_key', 'oauth2']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProductsApi#products_id_followers_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
products_id_followers_post(id, opts = {}) click to toggle source

Add a follower to a product Adds a follower to a product. @param id [Integer] ID of the product @param [Hash] opts the optional parameters @option opts [InlineObject24] :inline_object24 @return [NewFollowerResponse]

# File lib/pipedrive-openapi-client/api/products_api.rb, line 508
def products_id_followers_post(id, opts = {})
  data, _status_code, _headers = products_id_followers_post_with_http_info(id, opts)
  data
end
products_id_followers_post_with_http_info(id, opts = {}) click to toggle source

Add a follower to a product Adds a follower to a product. @param id [Integer] ID of the product @param [Hash] opts the optional parameters @option opts [InlineObject24] :inline_object24 @return [Array<(NewFollowerResponse, Integer, Hash)>] NewFollowerResponse data, response status code and response headers

# File lib/pipedrive-openapi-client/api/products_api.rb, line 519
def products_id_followers_post_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProductsApi.products_id_followers_post ...'
  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 ProductsApi.products_id_followers_post"
  end
  # resource path
  local_var_path = '/products/{id}/followers'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[: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 = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] || @api_client.object_to_http_body(opts[:'inline_object24']) 

  # return_type
  return_type = opts[:return_type] || 'NewFollowerResponse' 

  # auth_names
  auth_names = opts[:auth_names] || ['api_key']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProductsApi#products_id_followers_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
products_id_get(id, opts = {}) click to toggle source

Get one product Returns data about a specific product. @param id [Integer] ID of the product @param [Hash] opts the optional parameters @return [nil]

# File lib/pipedrive-openapi-client/api/products_api.rb, line 573
def products_id_get(id, opts = {})
  products_id_get_with_http_info(id, opts)
  nil
end
products_id_get_with_http_info(id, opts = {}) click to toggle source

Get one product Returns data about a specific product. @param id [Integer] ID of the product @param [Hash] opts the optional parameters @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers

# File lib/pipedrive-openapi-client/api/products_api.rb, line 583
def products_id_get_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProductsApi.products_id_get ...'
  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 ProductsApi.products_id_get"
  end
  # resource path
  local_var_path = '/products/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] 

  # auth_names
  auth_names = opts[:auth_names] || ['api_key', 'oauth2']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProductsApi#products_id_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
products_id_permitted_users_get(id, opts = {}) click to toggle source

List permitted users Lists users permitted to access a product. @param id [Integer] ID of the product @param [Hash] opts the optional parameters @return [UserIDs]

# File lib/pipedrive-openapi-client/api/products_api.rb, line 633
def products_id_permitted_users_get(id, opts = {})
  data, _status_code, _headers = products_id_permitted_users_get_with_http_info(id, opts)
  data
end
products_id_permitted_users_get_with_http_info(id, opts = {}) click to toggle source

List permitted users Lists users permitted to access a product. @param id [Integer] ID of the product @param [Hash] opts the optional parameters @return [Array<(UserIDs, Integer, Hash)>] UserIDs data, response status code and response headers

# File lib/pipedrive-openapi-client/api/products_api.rb, line 643
def products_id_permitted_users_get_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProductsApi.products_id_permitted_users_get ...'
  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 ProductsApi.products_id_permitted_users_get"
  end
  # resource path
  local_var_path = '/products/{id}/permittedUsers'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] || 'UserIDs' 

  # auth_names
  auth_names = opts[:auth_names] || ['api_key']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProductsApi#products_id_permitted_users_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
products_id_put(id, opts = {}) click to toggle source

Update a product Updates product data. @param id [Integer] ID of the product @param [Hash] opts the optional parameters @option opts [Product] :product @return [Product]

# File lib/pipedrive-openapi-client/api/products_api.rb, line 696
def products_id_put(id, opts = {})
  data, _status_code, _headers = products_id_put_with_http_info(id, opts)
  data
end
products_id_put_with_http_info(id, opts = {}) click to toggle source

Update a product Updates product data. @param id [Integer] ID of the product @param [Hash] opts the optional parameters @option opts [Product] :product @return [Array<(Product, Integer, Hash)>] Product data, response status code and response headers

# File lib/pipedrive-openapi-client/api/products_api.rb, line 707
def products_id_put_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProductsApi.products_id_put ...'
  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 ProductsApi.products_id_put"
  end
  # resource path
  local_var_path = '/products/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[: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 = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] || @api_client.object_to_http_body(opts[:'product']) 

  # return_type
  return_type = opts[:return_type] || 'Product' 

  # auth_names
  auth_names = opts[:auth_names] || ['api_key', 'oauth2']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProductsApi#products_id_put\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
products_post(opts = {}) click to toggle source

Add a product Adds a new product to the products inventory. For more information on how to add a product, see <a href="pipedrive.readme.io/docs/adding-a-product" target="_blank" rel="noopener noreferrer">this tutorial</a>. @param [Hash] opts the optional parameters @option opts [UNKNOWN_BASE_TYPE] :unknown_base_type @return [nil]

# File lib/pipedrive-openapi-client/api/products_api.rb, line 761
def products_post(opts = {})
  products_post_with_http_info(opts)
  nil
end
products_post_with_http_info(opts = {}) click to toggle source

Add a product Adds a new product to the products inventory. For more information on how to add a product, see &lt;a href&#x3D;&quot;pipedrive.readme.io/docs/adding-a-product"; target&#x3D;&quot;_blank&quot; rel&#x3D;&quot;noopener noreferrer&quot;&gt;this tutorial&lt;/a&gt;. @param [Hash] opts the optional parameters @option opts [UNKNOWN_BASE_TYPE] :unknown_base_type @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers

# File lib/pipedrive-openapi-client/api/products_api.rb, line 771
def products_post_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProductsApi.products_post ...'
  end
  # resource path
  local_var_path = '/products'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] || @api_client.object_to_http_body(opts[:'unknown_base_type']) 

  # return_type
  return_type = opts[:return_type] 

  # auth_names
  auth_names = opts[:auth_names] || ['api_key', 'oauth2']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProductsApi#products_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
products_search_get(term, opts = {}) click to toggle source

Search products Searches all Products by name, code and/or custom fields. This endpoint is a wrapper of <a href="/v1/itemSearchdevelopers.pipedrive.com/docs/api/v1/#!/ItemSearch/get_itemSearch">/v1/itemSearch> with a narrower OAuth scope. @param term [String] The search term to look for. Minimum 2 characters (or 1 if using exact_match). @param [Hash] opts the optional parameters @option opts [String] :fields A comma-separated string array. The fields to perform the search from. Defaults to all of them. @option opts [Boolean] :exact_match When enabled, only full exact matches against the given term are returned. It is &lt;b&gt;not&lt;/b&gt; case sensitive. @option opts [String] :include_fields Supports including optional fields in the results which are not provided by default. @option opts [Integer] :start Pagination start. Note that the pagination is based on main results and does not include related items when using search_for_related_items parameter. (default to 0) @option opts [Integer] :limit Items shown per page @return [BaseResponse]

# File lib/pipedrive-openapi-client/api/products_api.rb, line 824
def products_search_get(term, opts = {})
  data, _status_code, _headers = products_search_get_with_http_info(term, opts)
  data
end
products_search_get_with_http_info(term, opts = {}) click to toggle source

Search products Searches all Products by name, code and/or custom fields. This endpoint is a wrapper of &lt;a href&#x3D;&quot;developers.pipedrive.com/docs/api/v1/#!/ItemSearch/get_itemSearch">/v1/itemSearch</a>; with a narrower OAuth scope. @param term [String] The search term to look for. Minimum 2 characters (or 1 if using exact_match). @param [Hash] opts the optional parameters @option opts [String] :fields A comma-separated string array. The fields to perform the search from. Defaults to all of them. @option opts [Boolean] :exact_match When enabled, only full exact matches against the given term are returned. It is &lt;b&gt;not&lt;/b&gt; case sensitive. @option opts [String] :include_fields Supports including optional fields in the results which are not provided by default. @option opts [Integer] :start Pagination start. Note that the pagination is based on main results and does not include related items when using search_for_related_items parameter. @option opts [Integer] :limit Items shown per page @return [Array<(BaseResponse, Integer, Hash)>] BaseResponse data, response status code and response headers

# File lib/pipedrive-openapi-client/api/products_api.rb, line 839
def products_search_get_with_http_info(term, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProductsApi.products_search_get ...'
  end
  # verify the required parameter 'term' is set
  if @api_client.config.client_side_validation && term.nil?
    fail ArgumentError, "Missing the required parameter 'term' when calling ProductsApi.products_search_get"
  end
  allowable_values = ["code", "custom_fields", "name"]
  if @api_client.config.client_side_validation && opts[:'fields'] && !allowable_values.include?(opts[:'fields'])
    fail ArgumentError, "invalid value for \"fields\", must be one of #{allowable_values}"
  end
  allowable_values = ["true", "false"]
  if @api_client.config.client_side_validation && opts[:'exact_match'] && !allowable_values.include?(opts[:'exact_match'])
    fail ArgumentError, "invalid value for \"exact_match\", must be one of #{allowable_values}"
  end
  allowable_values = ["product.price"]
  if @api_client.config.client_side_validation && opts[:'include_fields'] && !allowable_values.include?(opts[:'include_fields'])
    fail ArgumentError, "invalid value for \"include_fields\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/products/search'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'term'] = term
  query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].nil?
  query_params[:'exact_match'] = opts[:'exact_match'] if !opts[:'exact_match'].nil?
  query_params[:'include_fields'] = opts[:'include_fields'] if !opts[:'include_fields'].nil?
  query_params[:'start'] = opts[:'start'] if !opts[:'start'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] || 'BaseResponse' 

  # auth_names
  auth_names = opts[:auth_names] || ['api_key', 'oauth2']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProductsApi#products_search_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end