class Pipedrive::DealsApi

Attributes

api_client[RW]

Public Class Methods

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

Public Instance Methods

deals_delete(ids, opts = {}) click to toggle source

Delete multiple deals in bulk Marks multiple deals as deleted. @param ids [String] Comma-separated IDs that will be deleted @param [Hash] opts the optional parameters @return [DeleteMultipleDeals]

# File lib/pipedrive-openapi-client/api/deals_api.rb, line 27
def deals_delete(ids, opts = {})
  data, _status_code, _headers = deals_delete_with_http_info(ids, opts)
  data
end
deals_delete_with_http_info(ids, opts = {}) click to toggle source

Delete multiple deals in bulk Marks multiple deals as deleted. @param ids [String] Comma-separated IDs that will be deleted @param [Hash] opts the optional parameters @return [Array<(DeleteMultipleDeals, Integer, Hash)>] DeleteMultipleDeals data, response status code and response headers

# File lib/pipedrive-openapi-client/api/deals_api.rb, line 37
def deals_delete_with_http_info(ids, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DealsApi.deals_delete ...'
  end
  # verify the required parameter 'ids' is set
  if @api_client.config.client_side_validation && ids.nil?
    fail ArgumentError, "Missing the required parameter 'ids' when calling DealsApi.deals_delete"
  end
  # resource path
  local_var_path = '/deals'

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

  # 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] || 'DeleteMultipleDeals' 

  # 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: DealsApi#deals_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
deals_find_get_with_http_info(term, opts = {}) click to toggle source

Find deals by name &lt;strong&gt;This endpoint is deprecated. Please use &lt;a href&#x3D;&quot;developers.pipedrive.com/docs/api/v1/#!/Deals/get_deals_search">/v1/deals/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; Searches all deals by their title. @param term [String] Search term to look for @param [Hash] opts the optional parameters @option opts [Integer] :person_id ID of the person the Deal is associated with. @option opts [Integer] :org_id ID of the organization the Deal is associated with. @return [Array<(GetDealsByName, Integer, Hash)>] GetDealsByName data, response status code and response headers

# File lib/pipedrive-openapi-client/api/deals_api.rb, line 104
def deals_find_get_with_http_info(term, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DealsApi.deals_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 DealsApi.deals_find_get"
  end
  # resource path
  local_var_path = '/deals/find'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'term'] = term
  query_params[:'person_id'] = opts[:'person_id'] if !opts[:'person_id'].nil?
  query_params[:'org_id'] = opts[:'org_id'] if !opts[:'org_id'].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] || 'GetDealsByName' 

  # 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: DealsApi#deals_find_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
deals_get(opts = {}) click to toggle source

Get all deals Returns all deals. For more information on how to get all deals, see <a href="pipedrive.readme.io/docs/getting-all-deals" target="_blank" rel="noopener noreferrer">this tutorial</a>. @param [Hash] opts the optional parameters @option opts [Integer] :user_id If supplied, only deals matching the given user will be returned. @option opts [Integer] :filter_id ID of the filter to use @option opts [Integer] :stage_id If supplied, only deals within the given stage will be returned. @option opts [String] :status Only fetch deals with specific status. If omitted, all not deleted deals are fetched. (default to 'all_not_deleted') @option opts [Integer] :start Pagination start (default to 0) @option opts [Integer] :limit Items shown per page @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). @option opts [NumberBoolean] :owned_by_you When supplied, only deals owned by you are returned. However filter_id takes precedence over owned_by_you when both are supplied. @return [GetDeals]

# File lib/pipedrive-openapi-client/api/deals_api.rb, line 166
def deals_get(opts = {})
  data, _status_code, _headers = deals_get_with_http_info(opts)
  data
end
deals_get_with_http_info(opts = {}) click to toggle source

Get all deals Returns all deals. For more information on how to get all deals, see &lt;a href&#x3D;&quot;pipedrive.readme.io/docs/getting-all-deals"; 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 [Integer] :user_id If supplied, only deals matching the given user will be returned. @option opts [Integer] :filter_id ID of the filter to use @option opts [Integer] :stage_id If supplied, only deals within the given stage will be returned. @option opts [String] :status Only fetch deals with specific status. If omitted, all not deleted deals are fetched. @option opts [Integer] :start Pagination start @option opts [Integer] :limit Items shown per page @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). @option opts [NumberBoolean] :owned_by_you When supplied, only deals owned by you are returned. However filter_id takes precedence over owned_by_you when both are supplied. @return [Array<(GetDeals, Integer, Hash)>] GetDeals data, response status code and response headers

# File lib/pipedrive-openapi-client/api/deals_api.rb, line 183
def deals_get_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DealsApi.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 = '/deals'

  # 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[:'stage_id'] = opts[:'stage_id'] if !opts[:'stage_id'].nil?
  query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
  query_params[:'start'] = opts[:'start'] if !opts[:'start'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
  query_params[:'owned_by_you'] = opts[:'owned_by_you'] if !opts[:'owned_by_you'].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] || 'GetDeals' 

  # 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: DealsApi#deals_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
deals_id_activities_get(id, opts = {}) click to toggle source

List activities associated with a deal Lists activities associated with a deal. @param id [Integer] ID of the deal @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] :done Whether the activity is done or not. 0 &#x3D; Not done, 1 &#x3D; Done. If omitted returns both Done and Not done activities. @option opts [String] :exclude A comma-separated string of activity IDs to exclude from result @return [nil]

# File lib/pipedrive-openapi-client/api/deals_api.rb, line 247
def deals_id_activities_get(id, opts = {})
  deals_id_activities_get_with_http_info(id, opts)
  nil
end
deals_id_activities_get_with_http_info(id, opts = {}) click to toggle source

List activities associated with a deal Lists activities associated with a deal. @param id [Integer] ID of the deal @param [Hash] opts the optional parameters @option opts [Integer] :start Pagination start @option opts [Integer] :limit Items shown per page @option opts [NumberBoolean] :done Whether the activity is done or not. 0 &#x3D; Not done, 1 &#x3D; Done. If omitted returns both Done and Not done activities. @option opts [String] :exclude A comma-separated string of activity IDs to exclude from result @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers

# File lib/pipedrive-openapi-client/api/deals_api.rb, line 261
def deals_id_activities_get_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DealsApi.deals_id_activities_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 DealsApi.deals_id_activities_get"
  end
  # resource path
  local_var_path = '/deals/{id}/activities'.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[:'done'] = opts[:'done'] if !opts[:'done'].nil?
  query_params[:'exclude'] = opts[:'exclude'] if !opts[:'exclude'].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: DealsApi#deals_id_activities_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
deals_id_delete(id, opts = {}) click to toggle source

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

# File lib/pipedrive-openapi-client/api/deals_api.rb, line 315
def deals_id_delete(id, opts = {})
  data, _status_code, _headers = deals_id_delete_with_http_info(id, opts)
  data
end
deals_id_delete_with_http_info(id, opts = {}) click to toggle source

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

# File lib/pipedrive-openapi-client/api/deals_api.rb, line 325
def deals_id_delete_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DealsApi.deals_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 DealsApi.deals_id_delete"
  end
  # resource path
  local_var_path = '/deals/{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'])

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

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

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

  # 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: DealsApi#deals_id_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
deals_id_duplicate_post(id, opts = {}) click to toggle source

Duplicate deal Duplicate a deal @param id [Integer] ID of the deal @param [Hash] opts the optional parameters @return [GetDuplicatedDeal]

# File lib/pipedrive-openapi-client/api/deals_api.rb, line 377
def deals_id_duplicate_post(id, opts = {})
  data, _status_code, _headers = deals_id_duplicate_post_with_http_info(id, opts)
  data
end
deals_id_duplicate_post_with_http_info(id, opts = {}) click to toggle source

Duplicate deal Duplicate a deal @param id [Integer] ID of the deal @param [Hash] opts the optional parameters @return [Array<(GetDuplicatedDeal, Integer, Hash)>] GetDuplicatedDeal data, response status code and response headers

# File lib/pipedrive-openapi-client/api/deals_api.rb, line 387
def deals_id_duplicate_post_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DealsApi.deals_id_duplicate_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 DealsApi.deals_id_duplicate_post"
  end
  # resource path
  local_var_path = '/deals/{id}/duplicate'.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] || 'GetDuplicatedDeal' 

  # 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: DealsApi#deals_id_duplicate_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
deals_id_files_get(id, opts = {}) click to toggle source

List files attached to a deal Lists files associated with a deal. @param id [Integer] ID of the deal @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/deals_api.rb, line 443
def deals_id_files_get(id, opts = {})
  deals_id_files_get_with_http_info(id, opts)
  nil
end
deals_id_files_get_with_http_info(id, opts = {}) click to toggle source

List files attached to a deal Lists files associated with a deal. @param id [Integer] ID of the deal @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/deals_api.rb, line 457
def deals_id_files_get_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DealsApi.deals_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 DealsApi.deals_id_files_get"
  end
  # resource path
  local_var_path = '/deals/{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: DealsApi#deals_id_files_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
deals_id_flow_get(id, opts = {}) click to toggle source

List updates about a deal Lists updates about a deal. @param id [Integer] ID of the deal @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] :all_changes Whether to show custom field updates or not. 1 &#x3D; Include custom field changes. If omitted returns changes without custom field updates. @option opts [String] :items A comma-separated string for filtering out item specific updates. (Possible values - activity, plannedActivity, note, file, change, deal, follower, participant, mailMessage, mailMessageWithAttachment, invoice, activityFile, document) @return [nil]

# File lib/pipedrive-openapi-client/api/deals_api.rb, line 515
def deals_id_flow_get(id, opts = {})
  deals_id_flow_get_with_http_info(id, opts)
  nil
end
deals_id_flow_get_with_http_info(id, opts = {}) click to toggle source

List updates about a deal Lists updates about a deal. @param id [Integer] ID of the deal @param [Hash] opts the optional parameters @option opts [Integer] :start Pagination start @option opts [Integer] :limit Items shown per page @option opts [String] :all_changes Whether to show custom field updates or not. 1 &#x3D; Include custom field changes. If omitted returns changes without custom field updates. @option opts [String] :items A comma-separated string for filtering out item specific updates. (Possible values - activity, plannedActivity, note, file, change, deal, follower, participant, mailMessage, mailMessageWithAttachment, invoice, activityFile, document) @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers

# File lib/pipedrive-openapi-client/api/deals_api.rb, line 529
def deals_id_flow_get_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DealsApi.deals_id_flow_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 DealsApi.deals_id_flow_get"
  end
  # resource path
  local_var_path = '/deals/{id}/flow'.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[:'all_changes'] = opts[:'all_changes'] if !opts[:'all_changes'].nil?
  query_params[:'items'] = opts[:'items'] if !opts[:'items'].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: DealsApi#deals_id_flow_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
deals_id_followers_follower_id_delete(id, follower_id, opts = {}) click to toggle source

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

# File lib/pipedrive-openapi-client/api/deals_api.rb, line 584
def deals_id_followers_follower_id_delete(id, follower_id, opts = {})
  data, _status_code, _headers = deals_id_followers_follower_id_delete_with_http_info(id, follower_id, opts)
  data
end
deals_id_followers_follower_id_delete_with_http_info(id, follower_id, opts = {}) click to toggle source

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

# File lib/pipedrive-openapi-client/api/deals_api.rb, line 595
def deals_id_followers_follower_id_delete_with_http_info(id, follower_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DealsApi.deals_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 DealsApi.deals_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 DealsApi.deals_id_followers_follower_id_delete"
  end
  # resource path
  local_var_path = '/deals/{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] || 'DeleteDealFollower' 

  # 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: DealsApi#deals_id_followers_follower_id_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
deals_id_followers_get(id, opts = {}) click to toggle source

List followers of a deal Lists the followers of a deal. @param id [Integer] ID of the deal @param [Hash] opts the optional parameters @return [nil]

# File lib/pipedrive-openapi-client/api/deals_api.rb, line 651
def deals_id_followers_get(id, opts = {})
  deals_id_followers_get_with_http_info(id, opts)
  nil
end
deals_id_followers_get_with_http_info(id, opts = {}) click to toggle source

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

# File lib/pipedrive-openapi-client/api/deals_api.rb, line 661
def deals_id_followers_get_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DealsApi.deals_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 DealsApi.deals_id_followers_get"
  end
  # resource path
  local_var_path = '/deals/{id}/followers'.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: DealsApi#deals_id_followers_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
deals_id_followers_post(id, user_id, opts = {}) click to toggle source

Add a follower to a deal Adds a follower to a deal. @param id [Integer] ID of the deal @param user_id [Integer] ID of the user @param [Hash] opts the optional parameters @return [AddedDealFollower]

# File lib/pipedrive-openapi-client/api/deals_api.rb, line 712
def deals_id_followers_post(id, user_id, opts = {})
  data, _status_code, _headers = deals_id_followers_post_with_http_info(id, user_id, opts)
  data
end
deals_id_followers_post_with_http_info(id, user_id, opts = {}) click to toggle source

Add a follower to a deal Adds a follower to a deal. @param id [Integer] ID of the deal @param user_id [Integer] ID of the user @param [Hash] opts the optional parameters @return [Array<(AddedDealFollower, Integer, Hash)>] AddedDealFollower data, response status code and response headers

# File lib/pipedrive-openapi-client/api/deals_api.rb, line 723
def deals_id_followers_post_with_http_info(id, user_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DealsApi.deals_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 DealsApi.deals_id_followers_post"
  end
  # verify the required parameter 'user_id' is set
  if @api_client.config.client_side_validation && user_id.nil?
    fail ArgumentError, "Missing the required parameter 'user_id' when calling DealsApi.deals_id_followers_post"
  end
  # resource path
  local_var_path = '/deals/{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/x-www-form-urlencoded'])

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

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

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

  # 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: DealsApi#deals_id_followers_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
deals_id_get(id, opts = {}) click to toggle source

Get details of a deal Returns details of a specific deal. Note that this also returns some additional fields which are not present when asking for all deals – such as deal age and stay in pipeline stages. Also note that custom fields appear as long hashes in the resulting data. These hashes can be mapped against the 'key' value of dealFields. For more information on how to get all details of a deal, see <a href="pipedrive.readme.io/docs/getting-details-of-a-deal" target="_blank" rel="noopener noreferrer">this tutorial</a>. @param id [Integer] ID of the deal @param [Hash] opts the optional parameters @return [GetDeal]

# File lib/pipedrive-openapi-client/api/deals_api.rb, line 782
def deals_id_get(id, opts = {})
  data, _status_code, _headers = deals_id_get_with_http_info(id, opts)
  data
end
deals_id_get_with_http_info(id, opts = {}) click to toggle source

Get details of a deal Returns details of a specific deal. Note that this also returns some additional fields which are not present when asking for all deals – such as deal age and stay in pipeline stages. Also note that custom fields appear as long hashes in the resulting data. These hashes can be mapped against the &#39;key&#39; value of dealFields. For more information on how to get all details of a deal, see &lt;a href&#x3D;&quot;pipedrive.readme.io/docs/getting-details-of-a-deal"; target&#x3D;&quot;_blank&quot; rel&#x3D;&quot;noopener noreferrer&quot;&gt;this tutorial&lt;/a&gt;. @param id [Integer] ID of the deal @param [Hash] opts the optional parameters @return [Array<(GetDeal, Integer, Hash)>] GetDeal data, response status code and response headers

# File lib/pipedrive-openapi-client/api/deals_api.rb, line 792
def deals_id_get_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DealsApi.deals_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 DealsApi.deals_id_get"
  end
  # resource path
  local_var_path = '/deals/{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'])

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

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

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

  # 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: DealsApi#deals_id_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
deals_id_mail_messages_get(id, opts = {}) click to toggle source

List mail messages associated with a deal Lists mail messages associated with a deal. @param id [Integer] ID of the deal @param [Hash] opts the optional parameters @option opts [Integer] :start Pagination start (default to 0) @option opts [Integer] :limit Items shown per page @return [nil]

# File lib/pipedrive-openapi-client/api/deals_api.rb, line 846
def deals_id_mail_messages_get(id, opts = {})
  deals_id_mail_messages_get_with_http_info(id, opts)
  nil
end
deals_id_mail_messages_get_with_http_info(id, opts = {}) click to toggle source

List mail messages associated with a deal Lists mail messages associated with a deal. @param id [Integer] ID of the deal @param [Hash] opts the optional parameters @option opts [Integer] :start Pagination start @option opts [Integer] :limit Items shown per page @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers

# File lib/pipedrive-openapi-client/api/deals_api.rb, line 858
def deals_id_mail_messages_get_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DealsApi.deals_id_mail_messages_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 DealsApi.deals_id_mail_messages_get"
  end
  # resource path
  local_var_path = '/deals/{id}/mailMessages'.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?

  # 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: DealsApi#deals_id_mail_messages_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
deals_id_merge_put(id, merge_with_id, opts = {}) click to toggle source

Merge two deals Merges a deal with another deal. For more information on how to merge two deals, see <a href="pipedrive.readme.io/docs/merging-two-deals" target="_blank" rel="noopener noreferrer">this tutorial</a>. @param id [Integer] ID of the deal @param merge_with_id [Integer] ID of the deal that the deal will be merged with @param [Hash] opts the optional parameters @return [GetMergedDeal]

# File lib/pipedrive-openapi-client/api/deals_api.rb, line 911
def deals_id_merge_put(id, merge_with_id, opts = {})
  data, _status_code, _headers = deals_id_merge_put_with_http_info(id, merge_with_id, opts)
  data
end
deals_id_merge_put_with_http_info(id, merge_with_id, opts = {}) click to toggle source

Merge two deals Merges a deal with another deal. For more information on how to merge two deals, see &lt;a href&#x3D;&quot;pipedrive.readme.io/docs/merging-two-deals"; target&#x3D;&quot;_blank&quot; rel&#x3D;&quot;noopener noreferrer&quot;&gt;this tutorial&lt;/a&gt;. @param id [Integer] ID of the deal @param merge_with_id [Integer] ID of the deal that the deal will be merged with @param [Hash] opts the optional parameters @return [Array<(GetMergedDeal, Integer, Hash)>] GetMergedDeal data, response status code and response headers

# File lib/pipedrive-openapi-client/api/deals_api.rb, line 922
def deals_id_merge_put_with_http_info(id, merge_with_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DealsApi.deals_id_merge_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 DealsApi.deals_id_merge_put"
  end
  # verify the required parameter 'merge_with_id' is set
  if @api_client.config.client_side_validation && merge_with_id.nil?
    fail ArgumentError, "Missing the required parameter 'merge_with_id' when calling DealsApi.deals_id_merge_put"
  end
  # resource path
  local_var_path = '/deals/{id}/merge'.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/x-www-form-urlencoded'])

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

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

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

  # 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: DealsApi#deals_id_merge_put\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
deals_id_participants_deal_participant_id_delete(id, deal_participant_id, opts = {}) click to toggle source

Delete a participant from a deal Deletes a participant from a deal. @param id [Integer] ID of the deal @param deal_participant_id [Integer] ID of the deal participant @param [Hash] opts the optional parameters @return [DeleteDealParticipant]

# File lib/pipedrive-openapi-client/api/deals_api.rb, line 982
def deals_id_participants_deal_participant_id_delete(id, deal_participant_id, opts = {})
  data, _status_code, _headers = deals_id_participants_deal_participant_id_delete_with_http_info(id, deal_participant_id, opts)
  data
end
deals_id_participants_deal_participant_id_delete_with_http_info(id, deal_participant_id, opts = {}) click to toggle source

Delete a participant from a deal Deletes a participant from a deal. @param id [Integer] ID of the deal @param deal_participant_id [Integer] ID of the deal participant @param [Hash] opts the optional parameters @return [Array<(DeleteDealParticipant, Integer, Hash)>] DeleteDealParticipant data, response status code and response headers

# File lib/pipedrive-openapi-client/api/deals_api.rb, line 993
def deals_id_participants_deal_participant_id_delete_with_http_info(id, deal_participant_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DealsApi.deals_id_participants_deal_participant_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 DealsApi.deals_id_participants_deal_participant_id_delete"
  end
  # verify the required parameter 'deal_participant_id' is set
  if @api_client.config.client_side_validation && deal_participant_id.nil?
    fail ArgumentError, "Missing the required parameter 'deal_participant_id' when calling DealsApi.deals_id_participants_deal_participant_id_delete"
  end
  # resource path
  local_var_path = '/deals/{id}/participants/{deal_participant_id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)).sub('{' + 'deal_participant_id' + '}', CGI.escape(deal_participant_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] || 'DeleteDealParticipant' 

  # 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: DealsApi#deals_id_participants_deal_participant_id_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
deals_id_participants_get(id, opts = {}) click to toggle source

List participants of a deal Lists participants associated with a deal. @param id [Integer] ID of the deal @param [Hash] opts the optional parameters @option opts [Integer] :start Pagination start (default to 0) @option opts [Integer] :limit Items shown per page @return [nil]

# File lib/pipedrive-openapi-client/api/deals_api.rb, line 1051
def deals_id_participants_get(id, opts = {})
  deals_id_participants_get_with_http_info(id, opts)
  nil
end
deals_id_participants_get_with_http_info(id, opts = {}) click to toggle source

List participants of a deal Lists participants associated with a deal. @param id [Integer] ID of the deal @param [Hash] opts the optional parameters @option opts [Integer] :start Pagination start @option opts [Integer] :limit Items shown per page @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers

# File lib/pipedrive-openapi-client/api/deals_api.rb, line 1063
def deals_id_participants_get_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DealsApi.deals_id_participants_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 DealsApi.deals_id_participants_get"
  end
  # resource path
  local_var_path = '/deals/{id}/participants'.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?

  # 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: DealsApi#deals_id_participants_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
deals_id_participants_post(id, person_id, opts = {}) click to toggle source

Add a participant to a deal Adds a participant to a deal. @param id [Integer] ID of the deal @param person_id [Integer] ID of the person @param [Hash] opts the optional parameters @return [nil]

# File lib/pipedrive-openapi-client/api/deals_api.rb, line 1116
def deals_id_participants_post(id, person_id, opts = {})
  deals_id_participants_post_with_http_info(id, person_id, opts)
  nil
end
deals_id_participants_post_with_http_info(id, person_id, opts = {}) click to toggle source

Add a participant to a deal Adds a participant to a deal. @param id [Integer] ID of the deal @param person_id [Integer] ID of the person @param [Hash] opts the optional parameters @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers

# File lib/pipedrive-openapi-client/api/deals_api.rb, line 1127
def deals_id_participants_post_with_http_info(id, person_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DealsApi.deals_id_participants_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 DealsApi.deals_id_participants_post"
  end
  # verify the required parameter 'person_id' is set
  if @api_client.config.client_side_validation && person_id.nil?
    fail ArgumentError, "Missing the required parameter 'person_id' when calling DealsApi.deals_id_participants_post"
  end
  # resource path
  local_var_path = '/deals/{id}/participants'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # 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/x-www-form-urlencoded'])

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

  # 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(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DealsApi#deals_id_participants_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
deals_id_permitted_users_get(id, opts = {}) click to toggle source

List permitted users List users permitted to access a deal @param id [Integer] ID of the deal @param [Hash] opts the optional parameters @return [nil]

# File lib/pipedrive-openapi-client/api/deals_api.rb, line 1184
def deals_id_permitted_users_get(id, opts = {})
  deals_id_permitted_users_get_with_http_info(id, opts)
  nil
end
deals_id_permitted_users_get_with_http_info(id, opts = {}) click to toggle source

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

# File lib/pipedrive-openapi-client/api/deals_api.rb, line 1194
def deals_id_permitted_users_get_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DealsApi.deals_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 DealsApi.deals_id_permitted_users_get"
  end
  # resource path
  local_var_path = '/deals/{id}/permittedUsers'.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']

  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: DealsApi#deals_id_permitted_users_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
deals_id_persons_get(id, opts = {}) click to toggle source

List all persons associated with a deal Lists all persons associated with a deal, regardless of whether the person is the primary contact of the deal, or added as a participant. @param id [Integer] ID of the deal @param [Hash] opts the optional parameters @option opts [Integer] :start Pagination start (default to 0) @option opts [Integer] :limit Items shown per page @return [nil]

# File lib/pipedrive-openapi-client/api/deals_api.rb, line 1246
def deals_id_persons_get(id, opts = {})
  deals_id_persons_get_with_http_info(id, opts)
  nil
end
deals_id_persons_get_with_http_info(id, opts = {}) click to toggle source

List all persons associated with a deal Lists all persons associated with a deal, regardless of whether the person is the primary contact of the deal, or added as a participant. @param id [Integer] ID of the deal @param [Hash] opts the optional parameters @option opts [Integer] :start Pagination start @option opts [Integer] :limit Items shown per page @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers

# File lib/pipedrive-openapi-client/api/deals_api.rb, line 1258
def deals_id_persons_get_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DealsApi.deals_id_persons_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 DealsApi.deals_id_persons_get"
  end
  # resource path
  local_var_path = '/deals/{id}/persons'.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?

  # 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: DealsApi#deals_id_persons_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
deals_id_products_get(id, opts = {}) click to toggle source

List products attached to a deal Lists products attached to a deal. @param id [Integer] ID of the deal @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_product_data Whether to fetch product data along with each attached product (1) or not (0, default). @return [nil]

# File lib/pipedrive-openapi-client/api/deals_api.rb, line 1313
def deals_id_products_get(id, opts = {})
  deals_id_products_get_with_http_info(id, opts)
  nil
end
deals_id_products_get_with_http_info(id, opts = {}) click to toggle source

List products attached to a deal Lists products attached to a deal. @param id [Integer] ID of the deal @param [Hash] opts the optional parameters @option opts [Integer] :start Pagination start @option opts [Integer] :limit Items shown per page @option opts [NumberBoolean] :include_product_data Whether to fetch product data along with each attached product (1) or not (0, default). @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers

# File lib/pipedrive-openapi-client/api/deals_api.rb, line 1326
def deals_id_products_get_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DealsApi.deals_id_products_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 DealsApi.deals_id_products_get"
  end
  # resource path
  local_var_path = '/deals/{id}/products'.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_product_data'] = opts[:'include_product_data'] if !opts[:'include_product_data'].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: DealsApi#deals_id_products_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
deals_id_products_post(id, opts = {}) click to toggle source

Add a product to the deal, eventually creating a new item called a deal-product Adds a product to the deal. @param id [Integer] ID of the deal @param [Hash] opts the optional parameters @option opts [NewDealProduct] :new_deal_product @return [GetAddProductAttachementDetails]

# File lib/pipedrive-openapi-client/api/deals_api.rb, line 1380
def deals_id_products_post(id, opts = {})
  data, _status_code, _headers = deals_id_products_post_with_http_info(id, opts)
  data
end
deals_id_products_post_with_http_info(id, opts = {}) click to toggle source

Add a product to the deal, eventually creating a new item called a deal-product Adds a product to the deal. @param id [Integer] ID of the deal @param [Hash] opts the optional parameters @option opts [NewDealProduct] :new_deal_product @return [Array<(GetAddProductAttachementDetails, Integer, Hash)>] GetAddProductAttachementDetails data, response status code and response headers

# File lib/pipedrive-openapi-client/api/deals_api.rb, line 1391
def deals_id_products_post_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DealsApi.deals_id_products_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 DealsApi.deals_id_products_post"
  end
  # resource path
  local_var_path = '/deals/{id}/products'.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[:'new_deal_product']) 

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

  # 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: DealsApi#deals_id_products_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
deals_id_products_product_attachment_id_delete(id, product_attachment_id, opts = {}) click to toggle source

Delete an attached product from a deal Deletes a product attachment from a deal, using the product_attachment_id. @param id [Integer] ID of the deal @param product_attachment_id [Integer] Product attachment ID. This is returned as product_attachment_id after attaching a product to a deal or as id when listing the products attached to a deal. @param [Hash] opts the optional parameters @return [DeleteDealProduct]

# File lib/pipedrive-openapi-client/api/deals_api.rb, line 1446
def deals_id_products_product_attachment_id_delete(id, product_attachment_id, opts = {})
  data, _status_code, _headers = deals_id_products_product_attachment_id_delete_with_http_info(id, product_attachment_id, opts)
  data
end
deals_id_products_product_attachment_id_delete_with_http_info(id, product_attachment_id, opts = {}) click to toggle source

Delete an attached product from a deal Deletes a product attachment from a deal, using the product_attachment_id. @param id [Integer] ID of the deal @param product_attachment_id [Integer] Product attachment ID. This is returned as product_attachment_id after attaching a product to a deal or as id when listing the products attached to a deal. @param [Hash] opts the optional parameters @return [Array<(DeleteDealProduct, Integer, Hash)>] DeleteDealProduct data, response status code and response headers

# File lib/pipedrive-openapi-client/api/deals_api.rb, line 1457
def deals_id_products_product_attachment_id_delete_with_http_info(id, product_attachment_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DealsApi.deals_id_products_product_attachment_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 DealsApi.deals_id_products_product_attachment_id_delete"
  end
  # verify the required parameter 'product_attachment_id' is set
  if @api_client.config.client_side_validation && product_attachment_id.nil?
    fail ArgumentError, "Missing the required parameter 'product_attachment_id' when calling DealsApi.deals_id_products_product_attachment_id_delete"
  end
  # resource path
  local_var_path = '/deals/{id}/products/{product_attachment_id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)).sub('{' + 'product_attachment_id' + '}', CGI.escape(product_attachment_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] || 'DeleteDealProduct' 

  # 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: DealsApi#deals_id_products_product_attachment_id_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
deals_id_products_product_attachment_id_put(id, product_attachment_id, opts = {}) click to toggle source

Update product attachment details of the deal-product (a product already attached to a deal) Updates product attachment details. @param id [Integer] ID of the deal @param product_attachment_id [Integer] ID of the deal-product (the ID of the product attached to the deal) @param [Hash] opts the optional parameters @option opts [BasicDealProduct] :basic_deal_product @return [GetProductAttachementDetails]

# File lib/pipedrive-openapi-client/api/deals_api.rb, line 1515
def deals_id_products_product_attachment_id_put(id, product_attachment_id, opts = {})
  data, _status_code, _headers = deals_id_products_product_attachment_id_put_with_http_info(id, product_attachment_id, opts)
  data
end
deals_id_products_product_attachment_id_put_with_http_info(id, product_attachment_id, opts = {}) click to toggle source

Update product attachment details of the deal-product (a product already attached to a deal) Updates product attachment details. @param id [Integer] ID of the deal @param product_attachment_id [Integer] ID of the deal-product (the ID of the product attached to the deal) @param [Hash] opts the optional parameters @option opts [BasicDealProduct] :basic_deal_product @return [Array<(GetProductAttachementDetails, Integer, Hash)>] GetProductAttachementDetails data, response status code and response headers

# File lib/pipedrive-openapi-client/api/deals_api.rb, line 1527
def deals_id_products_product_attachment_id_put_with_http_info(id, product_attachment_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DealsApi.deals_id_products_product_attachment_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 DealsApi.deals_id_products_product_attachment_id_put"
  end
  # verify the required parameter 'product_attachment_id' is set
  if @api_client.config.client_side_validation && product_attachment_id.nil?
    fail ArgumentError, "Missing the required parameter 'product_attachment_id' when calling DealsApi.deals_id_products_product_attachment_id_put"
  end
  # resource path
  local_var_path = '/deals/{id}/products/{product_attachment_id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)).sub('{' + 'product_attachment_id' + '}', CGI.escape(product_attachment_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[:'basic_deal_product']) 

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

  # 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(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DealsApi#deals_id_products_product_attachment_id_put\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
deals_id_put(id, opts = {}) click to toggle source

Update a deal Updates the properties of a deal. For more information on how to update a deal, see <a href="pipedrive.readme.io/docs/updating-a-deal" target="_blank" rel="noopener noreferrer">this tutorial</a>. @param id [Integer] ID of the deal @param [Hash] opts the optional parameters @option opts [String] :title Deal title @option opts [String] :value Value of the deal. If omitted, value will be set to 0. @option opts [String] :currency Currency of the deal. Accepts a 3-character currency code. If omitted, currency will be set to the default currency of the authorized user. @option opts [Integer] :user_id ID of the user who will be marked as the owner of this deal. If omitted, the authorized user ID will be used. @option opts [Integer] :person_id ID of the person this deal will be associated with @option opts [Integer] :org_id ID of the organization this deal will be associated with @option opts [Integer] :stage_id ID of the stage this deal will be placed in a pipeline (note that you can&#39;t supply the ID of the pipeline as this will be assigned automatically based on stage_id). If omitted, the deal will be placed in the first stage of the default pipeline. @option opts [String] :status open &#x3D; Open, won &#x3D; Won, lost &#x3D; Lost, deleted &#x3D; Deleted. If omitted, status will be set to open. @option opts [Float] :probability Deal success probability percentage. Used/shown only when deal_probability for the pipeline of the deal is enabled. @option opts [String] :lost_reason Optional message about why the deal was lost (to be used when status&#x3D;lost) @option opts [VisibleTo] :visible_to Visibility of the deal. If omitted, visibility will be set to the default visibility setting of this item type for the authorized user.&lt;dl class&#x3D;\&quot;fields-list\&quot;&gt;&lt;dt&gt;1&lt;/dt&gt;&lt;dd&gt;Owner &amp;amp; followers (private)&lt;/dd&gt;&lt;dt&gt;3&lt;/dt&gt;&lt;dd&gt;Entire company (shared)&lt;/dd&gt;&lt;/dl&gt; @return [GetAddedDeal]

# File lib/pipedrive-openapi-client/api/deals_api.rb, line 1596
def deals_id_put(id, opts = {})
  data, _status_code, _headers = deals_id_put_with_http_info(id, opts)
  data
end
deals_id_put_with_http_info(id, opts = {}) click to toggle source

Update a deal Updates the properties of a deal. For more information on how to update a deal, see &lt;a href&#x3D;&quot;pipedrive.readme.io/docs/updating-a-deal"; target&#x3D;&quot;_blank&quot; rel&#x3D;&quot;noopener noreferrer&quot;&gt;this tutorial&lt;/a&gt;. @param id [Integer] ID of the deal @param [Hash] opts the optional parameters @option opts [String] :title Deal title @option opts [String] :value Value of the deal. If omitted, value will be set to 0. @option opts [String] :currency Currency of the deal. Accepts a 3-character currency code. If omitted, currency will be set to the default currency of the authorized user. @option opts [Integer] :user_id ID of the user who will be marked as the owner of this deal. If omitted, the authorized user ID will be used. @option opts [Integer] :person_id ID of the person this deal will be associated with @option opts [Integer] :org_id ID of the organization this deal will be associated with @option opts [Integer] :stage_id ID of the stage this deal will be placed in a pipeline (note that you can&#39;t supply the ID of the pipeline as this will be assigned automatically based on stage_id). If omitted, the deal will be placed in the first stage of the default pipeline. @option opts [String] :status open &#x3D; Open, won &#x3D; Won, lost &#x3D; Lost, deleted &#x3D; Deleted. If omitted, status will be set to open. @option opts [Float] :probability Deal success probability percentage. Used/shown only when deal_probability for the pipeline of the deal is enabled. @option opts [String] :lost_reason Optional message about why the deal was lost (to be used when status&#x3D;lost) @option opts [VisibleTo] :visible_to Visibility of the deal. If omitted, visibility will be set to the default visibility setting of this item type for the authorized user.&lt;dl class&#x3D;\&quot;fields-list\&quot;&gt;&lt;dt&gt;1&lt;/dt&gt;&lt;dd&gt;Owner &amp;amp; followers (private)&lt;/dd&gt;&lt;dt&gt;3&lt;/dt&gt;&lt;dd&gt;Entire company (shared)&lt;/dd&gt;&lt;/dl&gt; @return [Array<(GetAddedDeal, Integer, Hash)>] GetAddedDeal data, response status code and response headers

# File lib/pipedrive-openapi-client/api/deals_api.rb, line 1617
def deals_id_put_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DealsApi.deals_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 DealsApi.deals_id_put"
  end
  allowable_values = ["open", "won", "lost", "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 = '/deals/{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/x-www-form-urlencoded'])

  # form parameters
  form_params = opts[:form_params] || {}
  form_params['title'] = opts[:'title'] if !opts[:'title'].nil?
  form_params['value'] = opts[:'value'] if !opts[:'value'].nil?
  form_params['currency'] = opts[:'currency'] if !opts[:'currency'].nil?
  form_params['user_id'] = opts[:'user_id'] if !opts[:'user_id'].nil?
  form_params['person_id'] = opts[:'person_id'] if !opts[:'person_id'].nil?
  form_params['org_id'] = opts[:'org_id'] if !opts[:'org_id'].nil?
  form_params['stage_id'] = opts[:'stage_id'] if !opts[:'stage_id'].nil?
  form_params['status'] = opts[:'status'] if !opts[:'status'].nil?
  form_params['probability'] = opts[:'probability'] if !opts[:'probability'].nil?
  form_params['lost_reason'] = opts[:'lost_reason'] if !opts[:'lost_reason'].nil?
  form_params['visible_to'] = opts[:'visible_to'] if !opts[:'visible_to'].nil?

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

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

  # 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: DealsApi#deals_id_put\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
deals_post(opts = {}) click to toggle source

Add a deal Adds a new deal. Note that you can supply additional custom fields along with the request that are not described here. These custom fields are different for each Pipedrive account and can be recognized by long hashes as keys. To determine which custom fields exists, fetch the dealFields and look for 'key' values. For more information on how to add a deal, see <a href="pipedrive.readme.io/docs/creating-a-deal" target="_blank" rel="noopener noreferrer">this tutorial</a>. @param [Hash] opts the optional parameters @return [GetAddedDeal]

# File lib/pipedrive-openapi-client/api/deals_api.rb, line 1685
def deals_post(opts = {})
  data, _status_code, _headers = deals_post_with_http_info(opts)
  data
end
deals_post_with_http_info(opts = {}) click to toggle source

Add a deal Adds a new deal. Note that you can supply additional custom fields along with the request that are not described here. These custom fields are different for each Pipedrive account and can be recognized by long hashes as keys. To determine which custom fields exists, fetch the dealFields and look for &#39;key&#39; values. For more information on how to add a deal, see &lt;a href&#x3D;&quot;pipedrive.readme.io/docs/creating-a-deal"; target&#x3D;&quot;_blank&quot; rel&#x3D;&quot;noopener noreferrer&quot;&gt;this tutorial&lt;/a&gt;. @param [Hash] opts the optional parameters @return [Array<(GetAddedDeal, Integer, Hash)>] GetAddedDeal data, response status code and response headers

# File lib/pipedrive-openapi-client/api/deals_api.rb, line 1694
def deals_post_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DealsApi.deals_post ...'
  end
  # resource path
  local_var_path = '/deals'

  # 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/x-www-form-urlencoded'])

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

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

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

  # 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: DealsApi#deals_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
deals_search_get(term, opts = {}) click to toggle source

Search deals Searches all Deals by title, notes 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. Found Deals can be filtered by Person ID and Organization ID. @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 [Integer] :person_id Will filter Deals by the provided Person ID. The upper limit of found Deals associated with the Person is 2000. @option opts [Integer] :organization_id Will filter Deals by the provided Organization ID. The upper limit of found Deals associated with the Organization is 2000. @option opts [String] :status Will filter Deals by the provided specific status. open &#x3D; Open, won &#x3D; Won, lost &#x3D; Lost. The upper limit of found Deals associated with the status is 2000. @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/deals_api.rb, line 1752
def deals_search_get(term, opts = {})
  data, _status_code, _headers = deals_search_get_with_http_info(term, opts)
  data
end
deals_search_get_with_http_info(term, opts = {}) click to toggle source

Search deals Searches all Deals by title, notes 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. Found Deals can be filtered by Person ID and Organization ID. @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 [Integer] :person_id Will filter Deals by the provided Person ID. The upper limit of found Deals associated with the Person is 2000. @option opts [Integer] :organization_id Will filter Deals by the provided Organization ID. The upper limit of found Deals associated with the Organization is 2000. @option opts [String] :status Will filter Deals by the provided specific status. open &#x3D; Open, won &#x3D; Won, lost &#x3D; Lost. The upper limit of found Deals associated with the status is 2000. @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/deals_api.rb, line 1770
def deals_search_get_with_http_info(term, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DealsApi.deals_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 DealsApi.deals_search_get"
  end
  allowable_values = ["custom_fields", "notes", "title"]
  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 = ["open", "won", "lost"]
  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
  allowable_values = ["deal.cc_email"]
  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 = '/deals/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[:'person_id'] = opts[:'person_id'] if !opts[:'person_id'].nil?
  query_params[:'organization_id'] = opts[:'organization_id'] if !opts[:'organization_id'].nil?
  query_params[:'status'] = opts[:'status'] if !opts[:'status'].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: DealsApi#deals_search_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
deals_summary_get(opts = {}) click to toggle source

Get deals summary Returns summary of all the deals. @param [Hash] opts the optional parameters @option opts [String] :status Only fetch deals with specific status. open &#x3D; Open, won &#x3D; Won, lost &#x3D; Lost @option opts [Integer] :filter_id user_id will not be considered. Only deals matching the given filter will be returned. @option opts [Integer] :user_id Only deals matching the given user will be returned. user_id will not be considered if you use filter_id. @option opts [Integer] :stage_id Only deals within the given stage will be returned. @return [GetDealsSummary]

# File lib/pipedrive-openapi-client/api/deals_api.rb, line 1850
def deals_summary_get(opts = {})
  data, _status_code, _headers = deals_summary_get_with_http_info(opts)
  data
end
deals_summary_get_with_http_info(opts = {}) click to toggle source

Get deals summary Returns summary of all the deals. @param [Hash] opts the optional parameters @option opts [String] :status Only fetch deals with specific status. open &#x3D; Open, won &#x3D; Won, lost &#x3D; Lost @option opts [Integer] :filter_id user_id will not be considered. Only deals matching the given filter will be returned. @option opts [Integer] :user_id Only deals matching the given user will be returned. user_id will not be considered if you use filter_id. @option opts [Integer] :stage_id Only deals within the given stage will be returned. @return [Array<(GetDealsSummary, Integer, Hash)>] GetDealsSummary data, response status code and response headers

# File lib/pipedrive-openapi-client/api/deals_api.rb, line 1863
def deals_summary_get_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DealsApi.deals_summary_get ...'
  end
  allowable_values = ["open", "won", "lost"]
  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 = '/deals/summary'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
  query_params[:'filter_id'] = opts[:'filter_id'] if !opts[:'filter_id'].nil?
  query_params[:'user_id'] = opts[:'user_id'] if !opts[:'user_id'].nil?
  query_params[:'stage_id'] = opts[:'stage_id'] if !opts[:'stage_id'].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] || 'GetDealsSummary' 

  # 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: DealsApi#deals_summary_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
deals_timeline_get(start_date, interval, amount, field_key, opts = {}) click to toggle source

Get deals timeline Returns open and won deals, grouped by defined interval of time set in a date-type dealField (field_key) — e.g. when month is the chosen interval, and 3 months are asked starting from January 1st, 2012, deals are returned grouped into 3 groups — January, February and March — based on the value of the given field_key. @param start_date [Date] Date where the first interval starts. Format: YYYY-MM-DD @param interval [String] The type of interval&lt;dl class&#x3D;&quot;fields-list&quot;&gt;&lt;dt&gt;day&lt;/dt&gt;&lt;dd&gt;Day&lt;/dd&gt;&lt;dt&gt;week&lt;/dt&gt;&lt;dd&gt;A full week (7 days) starting from start_date&lt;/dd&gt;&lt;dt&gt;month&lt;/dt&gt;&lt;dd&gt;A full month (depending on the number of days in given month) starting from start_date&lt;/dd&gt;&lt;dt&gt;quarter&lt;/dt&gt;&lt;dd&gt;A full quarter (3 months) starting from start_date&lt;/dd&gt;&lt;/dl&gt; @param amount [Integer] The number of given intervals, starting from start_date, to fetch. E.g. 3 (months). @param field_key [String] The date field key which deals will be retrieved from @param [Hash] opts the optional parameters @option opts [Integer] :user_id If supplied, only deals matching the given user will be returned. @option opts [Integer] :pipeline_id If supplied, only deals matching the given pipeline will be returned @option opts [Integer] :filter_id If supplied, only deals matching the given filter will be returned @option opts [NumberBoolean] :exclude_deals Whether to exclude deals list (1) or not (0). Note that when deals are excluded, the timeline summary (counts and values) is still returned. @option opts [String] :totals_convert_currency 3-letter currency code of any of the supported currencies. When supplied, totals_converted is returned per each interval which contains the currency-converted total amounts in the given currency. You may also set this parameter to &#39;default_currency&#39; in which case users default currency is used. @return [GetDealsTimeline]

# File lib/pipedrive-openapi-client/api/deals_api.rb, line 1927
def deals_timeline_get(start_date, interval, amount, field_key, opts = {})
  data, _status_code, _headers = deals_timeline_get_with_http_info(start_date, interval, amount, field_key, opts)
  data
end
deals_timeline_get_with_http_info(start_date, interval, amount, field_key, opts = {}) click to toggle source

Get deals timeline Returns open and won deals, grouped by defined interval of time set in a date-type dealField (field_key) — e.g. when month is the chosen interval, and 3 months are asked starting from January 1st, 2012, deals are returned grouped into 3 groups — January, February and March — based on the value of the given field_key. @param start_date [Date] Date where the first interval starts. Format: YYYY-MM-DD @param interval [String] The type of interval&lt;dl class&#x3D;&quot;fields-list&quot;&gt;&lt;dt&gt;day&lt;/dt&gt;&lt;dd&gt;Day&lt;/dd&gt;&lt;dt&gt;week&lt;/dt&gt;&lt;dd&gt;A full week (7 days) starting from start_date&lt;/dd&gt;&lt;dt&gt;month&lt;/dt&gt;&lt;dd&gt;A full month (depending on the number of days in given month) starting from start_date&lt;/dd&gt;&lt;dt&gt;quarter&lt;/dt&gt;&lt;dd&gt;A full quarter (3 months) starting from start_date&lt;/dd&gt;&lt;/dl&gt; @param amount [Integer] The number of given intervals, starting from start_date, to fetch. E.g. 3 (months). @param field_key [String] The date field key which deals will be retrieved from @param [Hash] opts the optional parameters @option opts [Integer] :user_id If supplied, only deals matching the given user will be returned. @option opts [Integer] :pipeline_id If supplied, only deals matching the given pipeline will be returned @option opts [Integer] :filter_id If supplied, only deals matching the given filter will be returned @option opts [NumberBoolean] :exclude_deals Whether to exclude deals list (1) or not (0). Note that when deals are excluded, the timeline summary (counts and values) is still returned. @option opts [String] :totals_convert_currency 3-letter currency code of any of the supported currencies. When supplied, totals_converted is returned per each interval which contains the currency-converted total amounts in the given currency. You may also set this parameter to &#39;default_currency&#39; in which case users default currency is used. @return [Array<(GetDealsTimeline, Integer, Hash)>] GetDealsTimeline data, response status code and response headers

# File lib/pipedrive-openapi-client/api/deals_api.rb, line 1945
def deals_timeline_get_with_http_info(start_date, interval, amount, field_key, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DealsApi.deals_timeline_get ...'
  end
  # verify the required parameter 'start_date' is set
  if @api_client.config.client_side_validation && start_date.nil?
    fail ArgumentError, "Missing the required parameter 'start_date' when calling DealsApi.deals_timeline_get"
  end
  # verify the required parameter 'interval' is set
  if @api_client.config.client_side_validation && interval.nil?
    fail ArgumentError, "Missing the required parameter 'interval' when calling DealsApi.deals_timeline_get"
  end
  # verify enum value
  allowable_values = ["day", "week", "month", "quarter"]
  if @api_client.config.client_side_validation && !allowable_values.include?(interval)
    fail ArgumentError, "invalid value for \"interval\", must be one of #{allowable_values}"
  end
  # verify the required parameter 'amount' is set
  if @api_client.config.client_side_validation && amount.nil?
    fail ArgumentError, "Missing the required parameter 'amount' when calling DealsApi.deals_timeline_get"
  end
  # verify the required parameter 'field_key' is set
  if @api_client.config.client_side_validation && field_key.nil?
    fail ArgumentError, "Missing the required parameter 'field_key' when calling DealsApi.deals_timeline_get"
  end
  # resource path
  local_var_path = '/deals/timeline'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'start_date'] = start_date
  query_params[:'interval'] = interval
  query_params[:'amount'] = amount
  query_params[:'field_key'] = field_key
  query_params[:'user_id'] = opts[:'user_id'] if !opts[:'user_id'].nil?
  query_params[:'pipeline_id'] = opts[:'pipeline_id'] if !opts[:'pipeline_id'].nil?
  query_params[:'filter_id'] = opts[:'filter_id'] if !opts[:'filter_id'].nil?
  query_params[:'exclude_deals'] = opts[:'exclude_deals'] if !opts[:'exclude_deals'].nil?
  query_params[:'totals_convert_currency'] = opts[:'totals_convert_currency'] if !opts[:'totals_convert_currency'].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] || 'GetDealsTimeline' 

  # 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: DealsApi#deals_timeline_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end