Class: Pipedrive::DealsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/pipedrive-openapi-client/api/deals_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ DealsApi

Returns a new instance of DealsApi.



19
20
21
# File 'lib/pipedrive-openapi-client/api/deals_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/pipedrive-openapi-client/api/deals_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#deals_delete(ids, opts = {}) ⇒ DeleteMultipleDeals

Delete multiple deals in bulk Marks multiple deals as deleted.

Parameters:

  • ids (String)

    Comma-separated IDs that will be deleted

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



27
28
29
30
# 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 = {}) ⇒ Array<(DeleteMultipleDeals, Integer, Hash)>

Delete multiple deals in bulk Marks multiple deals as deleted.

Parameters:

  • ids (String)

    Comma-separated IDs that will be deleted

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(DeleteMultipleDeals, Integer, Hash)>)

    DeleteMultipleDeals data, response status code and response headers



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# 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(term, opts = {}) ⇒ GetDealsByName

Find deals by name <strong>This endpoint is deprecated. Please use <a href="developers.pipedrive.com/docs/api/v1/#!/Deals/get_deals_search">/v1/deals/search</a> or <a href="developers.pipedrive.com/docs/api/v1/#!/ItemSearch/get_itemSearch">/v1/itemSearch</a> instead</strong>.
Searches all deals by their title.

Parameters:

  • term (String)

    Search term to look for

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :person_id (Integer)

    ID of the person the Deal is associated with.

  • :org_id (Integer)

    ID of the organization the Deal is associated with.

Returns:



92
93
94
95
# File 'lib/pipedrive-openapi-client/api/deals_api.rb', line 92

def deals_find_get(term, opts = {})
  data, _status_code, _headers = deals_find_get_with_http_info(term, opts)
  data
end

#deals_find_get_with_http_info(term, opts = {}) ⇒ Array<(GetDealsByName, Integer, Hash)>

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&quot;&gt;/v1/deals/search&lt;/a&gt; or &lt;a href&#x3D;&quot;developers.pipedrive.com/docs/api/v1/#!/ItemSearch/get_itemSearch&quot;&gt;/v1/itemSearch&lt;/a&gt; instead&lt;/strong&gt;. &lt;br&gt; Searches all deals by their title.

Parameters:

  • term (String)

    Search term to look for

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :person_id (Integer)

    ID of the person the Deal is associated with.

  • :org_id (Integer)

    ID of the organization the Deal is associated with.

Returns:

  • (Array<(GetDealsByName, Integer, Hash)>)

    GetDealsByName data, response status code and response headers



104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# 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 = {}) ⇒ GetDeals

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>.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :user_id (Integer)

    If supplied, only deals matching the given user will be returned.

  • :filter_id (Integer)

    ID of the filter to use

  • :stage_id (Integer)

    If supplied, only deals within the given stage will be returned.

  • :status (String)

    Only fetch deals with specific status. If omitted, all not deleted deals are fetched. (default to ‘all_not_deleted’)

  • :start (Integer)

    Pagination start (default to 0)

  • :limit (Integer)

    Items shown per page

  • :sort (String)

    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).

  • :owned_by_you (NumberBoolean)

    When supplied, only deals owned by you are returned. However filter_id takes precedence over owned_by_you when both are supplied.

Returns:



166
167
168
169
# 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 = {}) ⇒ Array<(GetDeals, Integer, Hash)>

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&quot; target&#x3D;&quot;_blank&quot; rel&#x3D;&quot;noopener noreferrer&quot;&gt;this tutorial&lt;/a&gt;.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :user_id (Integer)

    If supplied, only deals matching the given user will be returned.

  • :filter_id (Integer)

    ID of the filter to use

  • :stage_id (Integer)

    If supplied, only deals within the given stage will be returned.

  • :status (String)

    Only fetch deals with specific status. If omitted, all not deleted deals are fetched.

  • :start (Integer)

    Pagination start

  • :limit (Integer)

    Items shown per page

  • :sort (String)

    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).

  • :owned_by_you (NumberBoolean)

    When supplied, only deals owned by you are returned. However filter_id takes precedence over owned_by_you when both are supplied.

Returns:

  • (Array<(GetDeals, Integer, Hash)>)

    GetDeals data, response status code and response headers



183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
# 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 = {}) ⇒ nil

List activities associated with a deal Lists activities associated with a deal.

Parameters:

  • id (Integer)

    ID of the deal

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :start (Integer)

    Pagination start (default to 0)

  • :limit (Integer)

    Items shown per page

  • :done (NumberBoolean)

    Whether the activity is done or not. 0 &#x3D; Not done, 1 &#x3D; Done. If omitted returns both Done and Not done activities.

  • :exclude (String)

    A comma-separated string of activity IDs to exclude from result

Returns:

  • (nil)


247
248
249
250
# 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 = {}) ⇒ Array<(nil, Integer, Hash)>

List activities associated with a deal Lists activities associated with a deal.

Parameters:

  • id (Integer)

    ID of the deal

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :start (Integer)

    Pagination start

  • :limit (Integer)

    Items shown per page

  • :done (NumberBoolean)

    Whether the activity is done or not. 0 &#x3D; Not done, 1 &#x3D; Done. If omitted returns both Done and Not done activities.

  • :exclude (String)

    A comma-separated string of activity IDs to exclude from result

Returns:

  • (Array<(nil, Integer, Hash)>)

    nil, response status code and response headers



261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
# 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 = {}) ⇒ DeleteDeal

Delete a deal Marks a deal as deleted.

Parameters:

  • id (Integer)

    ID of the deal

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



315
316
317
318
# 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 = {}) ⇒ Array<(DeleteDeal, Integer, Hash)>

Delete a deal Marks a deal as deleted.

Parameters:

  • id (Integer)

    ID of the deal

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(DeleteDeal, Integer, Hash)>)

    DeleteDeal data, response status code and response headers



325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
# 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 = {}) ⇒ GetDuplicatedDeal

Duplicate deal Duplicate a deal

Parameters:

  • id (Integer)

    ID of the deal

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



377
378
379
380
# 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 = {}) ⇒ Array<(GetDuplicatedDeal, Integer, Hash)>

Duplicate deal Duplicate a deal

Parameters:

  • id (Integer)

    ID of the deal

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(GetDuplicatedDeal, Integer, Hash)>)

    GetDuplicatedDeal data, response status code and response headers



387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
# 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 = {}) ⇒ nil

List files attached to a deal Lists files associated with a deal.

Parameters:

  • id (Integer)

    ID of the deal

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :start (Integer)

    Pagination start (default to 0)

  • :limit (Integer)

    Items shown per page

  • :include_deleted_files (NumberBoolean)

    When enabled, the list of files will also include deleted files. Please note that trying to download these files will not work.

  • :sort (String)

    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.

Returns:

  • (nil)


443
444
445
446
# 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 = {}) ⇒ Array<(nil, Integer, Hash)>

List files attached to a deal Lists files associated with a deal.

Parameters:

  • id (Integer)

    ID of the deal

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :start (Integer)

    Pagination start

  • :limit (Integer)

    Items shown per page

  • :include_deleted_files (NumberBoolean)

    When enabled, the list of files will also include deleted files. Please note that trying to download these files will not work.

  • :sort (String)

    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.

Returns:

  • (Array<(nil, Integer, Hash)>)

    nil, response status code and response headers



457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
# 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 = {}) ⇒ nil

List updates about a deal Lists updates about a deal.

Parameters:

  • id (Integer)

    ID of the deal

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :start (Integer)

    Pagination start (default to 0)

  • :limit (Integer)

    Items shown per page

  • :all_changes (String)

    Whether to show custom field updates or not. 1 &#x3D; Include custom field changes. If omitted returns changes without custom field updates.

  • :items (String)

    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)

Returns:

  • (nil)


515
516
517
518
# 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 = {}) ⇒ Array<(nil, Integer, Hash)>

List updates about a deal Lists updates about a deal.

Parameters:

  • id (Integer)

    ID of the deal

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :start (Integer)

    Pagination start

  • :limit (Integer)

    Items shown per page

  • :all_changes (String)

    Whether to show custom field updates or not. 1 &#x3D; Include custom field changes. If omitted returns changes without custom field updates.

  • :items (String)

    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)

Returns:

  • (Array<(nil, Integer, Hash)>)

    nil, response status code and response headers



529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
# 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 = {}) ⇒ DeleteDealFollower

Delete a follower from a deal Deletes a follower from a deal.

Parameters:

  • id (Integer)

    ID of the deal

  • follower_id (Integer)

    ID of the follower

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



584
585
586
587
# 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 = {}) ⇒ Array<(DeleteDealFollower, Integer, Hash)>

Delete a follower from a deal Deletes a follower from a deal.

Parameters:

  • id (Integer)

    ID of the deal

  • follower_id (Integer)

    ID of the follower

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(DeleteDealFollower, Integer, Hash)>)

    DeleteDealFollower data, response status code and response headers



595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
# 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 = {}) ⇒ nil

List followers of a deal Lists the followers of a deal.

Parameters:

  • id (Integer)

    ID of the deal

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (nil)


651
652
653
654
# 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 = {}) ⇒ Array<(nil, Integer, Hash)>

List followers of a deal Lists the followers of a deal.

Parameters:

  • id (Integer)

    ID of the deal

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(nil, Integer, Hash)>)

    nil, response status code and response headers



661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
# 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 = {}) ⇒ AddedDealFollower

Add a follower to a deal Adds a follower to a deal.

Parameters:

  • id (Integer)

    ID of the deal

  • user_id (Integer)

    ID of the user

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



712
713
714
715
# 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 = {}) ⇒ Array<(AddedDealFollower, Integer, Hash)>

Add a follower to a deal Adds a follower to a deal.

Parameters:

  • id (Integer)

    ID of the deal

  • user_id (Integer)

    ID of the user

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(AddedDealFollower, Integer, Hash)>)

    AddedDealFollower data, response status code and response headers



723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
# 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 = {}) ⇒ GetDeal

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>.

Parameters:

  • id (Integer)

    ID of the deal

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



782
783
784
785
# 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 = {}) ⇒ Array<(GetDeal, Integer, Hash)>

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&quot; target&#x3D;&quot;_blank&quot; rel&#x3D;&quot;noopener noreferrer&quot;&gt;this tutorial&lt;/a&gt;.

Parameters:

  • id (Integer)

    ID of the deal

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(GetDeal, Integer, Hash)>)

    GetDeal data, response status code and response headers



792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
# 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 = {}) ⇒ nil

List mail messages associated with a deal Lists mail messages associated with a deal.

Parameters:

  • id (Integer)

    ID of the deal

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :start (Integer)

    Pagination start (default to 0)

  • :limit (Integer)

    Items shown per page

Returns:

  • (nil)


846
847
848
849
# 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 = {}) ⇒ Array<(nil, Integer, Hash)>

List mail messages associated with a deal Lists mail messages associated with a deal.

Parameters:

  • id (Integer)

    ID of the deal

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :start (Integer)

    Pagination start

  • :limit (Integer)

    Items shown per page

Returns:

  • (Array<(nil, Integer, Hash)>)

    nil, response status code and response headers



858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
# 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 = {}) ⇒ GetMergedDeal

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>.

Parameters:

  • id (Integer)

    ID of the deal

  • merge_with_id (Integer)

    ID of the deal that the deal will be merged with

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



911
912
913
914
# 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 = {}) ⇒ Array<(GetMergedDeal, Integer, Hash)>

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&quot; target&#x3D;&quot;_blank&quot; rel&#x3D;&quot;noopener noreferrer&quot;&gt;this tutorial&lt;/a&gt;.

Parameters:

  • id (Integer)

    ID of the deal

  • merge_with_id (Integer)

    ID of the deal that the deal will be merged with

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(GetMergedDeal, Integer, Hash)>)

    GetMergedDeal data, response status code and response headers



922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
# 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 = {}) ⇒ DeleteDealParticipant

Delete a participant from a deal Deletes a participant from a deal.

Parameters:

  • id (Integer)

    ID of the deal

  • deal_participant_id (Integer)

    ID of the deal participant

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



982
983
984
985
# 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 = {}) ⇒ Array<(DeleteDealParticipant, Integer, Hash)>

Delete a participant from a deal Deletes a participant from a deal.

Parameters:

  • id (Integer)

    ID of the deal

  • deal_participant_id (Integer)

    ID of the deal participant

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(DeleteDealParticipant, Integer, Hash)>)

    DeleteDealParticipant data, response status code and response headers



993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
# 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 = {}) ⇒ nil

List participants of a deal Lists participants associated with a deal.

Parameters:

  • id (Integer)

    ID of the deal

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :start (Integer)

    Pagination start (default to 0)

  • :limit (Integer)

    Items shown per page

Returns:

  • (nil)


1051
1052
1053
1054
# 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 = {}) ⇒ Array<(nil, Integer, Hash)>

List participants of a deal Lists participants associated with a deal.

Parameters:

  • id (Integer)

    ID of the deal

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :start (Integer)

    Pagination start

  • :limit (Integer)

    Items shown per page

Returns:

  • (Array<(nil, Integer, Hash)>)

    nil, response status code and response headers



1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
# 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 = {}) ⇒ nil

Add a participant to a deal Adds a participant to a deal.

Parameters:

  • id (Integer)

    ID of the deal

  • person_id (Integer)

    ID of the person

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (nil)


1116
1117
1118
1119
# 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 = {}) ⇒ Array<(nil, Integer, Hash)>

Add a participant to a deal Adds a participant to a deal.

Parameters:

  • id (Integer)

    ID of the deal

  • person_id (Integer)

    ID of the person

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(nil, Integer, Hash)>)

    nil, response status code and response headers



1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
# 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 = {}) ⇒ nil

List permitted users List users permitted to access a deal

Parameters:

  • id (Integer)

    ID of the deal

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (nil)


1184
1185
1186
1187
# 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 = {}) ⇒ Array<(nil, Integer, Hash)>

List permitted users List users permitted to access a deal

Parameters:

  • id (Integer)

    ID of the deal

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(nil, Integer, Hash)>)

    nil, response status code and response headers



1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
# 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 = {}) ⇒ nil

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.

Parameters:

  • id (Integer)

    ID of the deal

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :start (Integer)

    Pagination start (default to 0)

  • :limit (Integer)

    Items shown per page

Returns:

  • (nil)


1246
1247
1248
1249
# 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 = {}) ⇒ Array<(nil, Integer, Hash)>

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.

Parameters:

  • id (Integer)

    ID of the deal

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :start (Integer)

    Pagination start

  • :limit (Integer)

    Items shown per page

Returns:

  • (Array<(nil, Integer, Hash)>)

    nil, response status code and response headers



1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
# 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 = {}) ⇒ nil

List products attached to a deal Lists products attached to a deal.

Parameters:

  • id (Integer)

    ID of the deal

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :start (Integer)

    Pagination start (default to 0)

  • :limit (Integer)

    Items shown per page

  • :include_product_data (NumberBoolean)

    Whether to fetch product data along with each attached product (1) or not (0, default).

Returns:

  • (nil)


1313
1314
1315
1316
# 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 = {}) ⇒ Array<(nil, Integer, Hash)>

List products attached to a deal Lists products attached to a deal.

Parameters:

  • id (Integer)

    ID of the deal

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :start (Integer)

    Pagination start

  • :limit (Integer)

    Items shown per page

  • :include_product_data (NumberBoolean)

    Whether to fetch product data along with each attached product (1) or not (0, default).

Returns:

  • (Array<(nil, Integer, Hash)>)

    nil, response status code and response headers



1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
# 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 = {}) ⇒ GetAddProductAttachementDetails

Add a product to the deal, eventually creating a new item called a deal-product Adds a product to the deal.

Parameters:

  • id (Integer)

    ID of the deal

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:



1380
1381
1382
1383
# 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 = {}) ⇒ Array<(GetAddProductAttachementDetails, Integer, Hash)>

Add a product to the deal, eventually creating a new item called a deal-product Adds a product to the deal.

Parameters:

  • id (Integer)

    ID of the deal

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:



1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
# 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 = {}) ⇒ DeleteDealProduct

Delete an attached product from a deal Deletes a product attachment from a deal, using the product_attachment_id.

Parameters:

  • id (Integer)

    ID of the deal

  • 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.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



1446
1447
1448
1449
# 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 = {}) ⇒ Array<(DeleteDealProduct, Integer, Hash)>

Delete an attached product from a deal Deletes a product attachment from a deal, using the product_attachment_id.

Parameters:

  • id (Integer)

    ID of the deal

  • 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.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(DeleteDealProduct, Integer, Hash)>)

    DeleteDealProduct data, response status code and response headers



1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
# 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 = {}) ⇒ GetProductAttachementDetails

Update product attachment details of the deal-product (a product already attached to a deal) Updates product attachment details.

Parameters:

  • id (Integer)

    ID of the deal

  • product_attachment_id (Integer)

    ID of the deal-product (the ID of the product attached to the deal)

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:



1515
1516
1517
1518
# 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 = {}) ⇒ Array<(GetProductAttachementDetails, Integer, Hash)>

Update product attachment details of the deal-product (a product already attached to a deal) Updates product attachment details.

Parameters:

  • id (Integer)

    ID of the deal

  • product_attachment_id (Integer)

    ID of the deal-product (the ID of the product attached to the deal)

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:



1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
# 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 = {}) ⇒ GetAddedDeal

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>.

Parameters:

  • id (Integer)

    ID of the deal

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :title (String)

    Deal title

  • :value (String)

    Value of the deal. If omitted, value will be set to 0.

  • :currency (String)

    Currency of the deal. Accepts a 3-character currency code. If omitted, currency will be set to the default currency of the authorized user.

  • :user_id (Integer)

    ID of the user who will be marked as the owner of this deal. If omitted, the authorized user ID will be used.

  • :person_id (Integer)

    ID of the person this deal will be associated with

  • :org_id (Integer)

    ID of the organization this deal will be associated with

  • :stage_id (Integer)

    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.

  • :status (String)

    open &#x3D; Open, won &#x3D; Won, lost &#x3D; Lost, deleted &#x3D; Deleted. If omitted, status will be set to open.

  • :probability (Float)

    Deal success probability percentage. Used/shown only when deal_probability for the pipeline of the deal is enabled.

  • :lost_reason (String)

    Optional message about why the deal was lost (to be used when status&#x3D;lost)

  • :visible_to (VisibleTo)

    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;

Returns:



1596
1597
1598
1599
# 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 = {}) ⇒ Array<(GetAddedDeal, Integer, Hash)>

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&quot; target&#x3D;&quot;_blank&quot; rel&#x3D;&quot;noopener noreferrer&quot;&gt;this tutorial&lt;/a&gt;.

Parameters:

  • id (Integer)

    ID of the deal

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :title (String)

    Deal title

  • :value (String)

    Value of the deal. If omitted, value will be set to 0.

  • :currency (String)

    Currency of the deal. Accepts a 3-character currency code. If omitted, currency will be set to the default currency of the authorized user.

  • :user_id (Integer)

    ID of the user who will be marked as the owner of this deal. If omitted, the authorized user ID will be used.

  • :person_id (Integer)

    ID of the person this deal will be associated with

  • :org_id (Integer)

    ID of the organization this deal will be associated with

  • :stage_id (Integer)

    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.

  • :status (String)

    open &#x3D; Open, won &#x3D; Won, lost &#x3D; Lost, deleted &#x3D; Deleted. If omitted, status will be set to open.

  • :probability (Float)

    Deal success probability percentage. Used/shown only when deal_probability for the pipeline of the deal is enabled.

  • :lost_reason (String)

    Optional message about why the deal was lost (to be used when status&#x3D;lost)

  • :visible_to (VisibleTo)

    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;

Returns:

  • (Array<(GetAddedDeal, Integer, Hash)>)

    GetAddedDeal data, response status code and response headers



1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
# 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 = {}) ⇒ GetAddedDeal

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>.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



1685
1686
1687
1688
# 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 = {}) ⇒ Array<(GetAddedDeal, Integer, Hash)>

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&quot; target&#x3D;&quot;_blank&quot; rel&#x3D;&quot;noopener noreferrer&quot;&gt;this tutorial&lt;/a&gt;.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(GetAddedDeal, Integer, Hash)>)

    GetAddedDeal data, response status code and response headers



1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
# 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 = {}) ⇒ BaseResponse

Search deals Searches all Deals by title, notes and/or custom fields. This endpoint is a wrapper of <a href="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.

Parameters:

  • term (String)

    The search term to look for. Minimum 2 characters (or 1 if using exact_match).

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :fields (String)

    A comma-separated string array. The fields to perform the search from. Defaults to all of them.

  • :exact_match (Boolean)

    When enabled, only full exact matches against the given term are returned. It is &lt;b&gt;not&lt;/b&gt; case sensitive.

  • :person_id (Integer)

    Will filter Deals by the provided Person ID. The upper limit of found Deals associated with the Person is 2000.

  • :organization_id (Integer)

    Will filter Deals by the provided Organization ID. The upper limit of found Deals associated with the Organization is 2000.

  • :status (String)

    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.

  • :include_fields (String)

    Supports including optional fields in the results which are not provided by default.

  • :start (Integer)

    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)

  • :limit (Integer)

    Items shown per page

Returns:



1752
1753
1754
1755
# 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 = {}) ⇒ Array<(BaseResponse, Integer, Hash)>

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&quot;&gt;/v1/itemSearch&lt;/a&gt; with a narrower OAuth scope. Found Deals can be filtered by Person ID and Organization ID.

Parameters:

  • term (String)

    The search term to look for. Minimum 2 characters (or 1 if using exact_match).

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :fields (String)

    A comma-separated string array. The fields to perform the search from. Defaults to all of them.

  • :exact_match (Boolean)

    When enabled, only full exact matches against the given term are returned. It is &lt;b&gt;not&lt;/b&gt; case sensitive.

  • :person_id (Integer)

    Will filter Deals by the provided Person ID. The upper limit of found Deals associated with the Person is 2000.

  • :organization_id (Integer)

    Will filter Deals by the provided Organization ID. The upper limit of found Deals associated with the Organization is 2000.

  • :status (String)

    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.

  • :include_fields (String)

    Supports including optional fields in the results which are not provided by default.

  • :start (Integer)

    Pagination start. Note that the pagination is based on main results and does not include related items when using search_for_related_items parameter.

  • :limit (Integer)

    Items shown per page

Returns:

  • (Array<(BaseResponse, Integer, Hash)>)

    BaseResponse data, response status code and response headers



1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
# 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 = {}) ⇒ GetDealsSummary

Get deals summary Returns summary of all the deals.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :status (String)

    Only fetch deals with specific status. open &#x3D; Open, won &#x3D; Won, lost &#x3D; Lost

  • :filter_id (Integer)

    user_id will not be considered. Only deals matching the given filter will be returned.

  • :user_id (Integer)

    Only deals matching the given user will be returned. user_id will not be considered if you use filter_id.

  • :stage_id (Integer)

    Only deals within the given stage will be returned.

Returns:



1850
1851
1852
1853
# 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 = {}) ⇒ Array<(GetDealsSummary, Integer, Hash)>

Get deals summary Returns summary of all the deals.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :status (String)

    Only fetch deals with specific status. open &#x3D; Open, won &#x3D; Won, lost &#x3D; Lost

  • :filter_id (Integer)

    user_id will not be considered. Only deals matching the given filter will be returned.

  • :user_id (Integer)

    Only deals matching the given user will be returned. user_id will not be considered if you use filter_id.

  • :stage_id (Integer)

    Only deals within the given stage will be returned.

Returns:

  • (Array<(GetDealsSummary, Integer, Hash)>)

    GetDealsSummary data, response status code and response headers



1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
# 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 = {}) ⇒ GetDealsTimeline

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.

Parameters:

  • start_date (Date)

    Date where the first interval starts. Format: YYYY-MM-DD

  • 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;

  • amount (Integer)

    The number of given intervals, starting from start_date, to fetch. E.g. 3 (months).

  • field_key (String)

    The date field key which deals will be retrieved from

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :user_id (Integer)

    If supplied, only deals matching the given user will be returned.

  • :pipeline_id (Integer)

    If supplied, only deals matching the given pipeline will be returned

  • :filter_id (Integer)

    If supplied, only deals matching the given filter will be returned

  • :exclude_deals (NumberBoolean)

    Whether to exclude deals list (1) or not (0). Note that when deals are excluded, the timeline summary (counts and values) is still returned.

  • :totals_convert_currency (String)

    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.

Returns:



1927
1928
1929
1930
# 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 = {}) ⇒ Array<(GetDealsTimeline, Integer, Hash)>

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.

Parameters:

  • start_date (Date)

    Date where the first interval starts. Format: YYYY-MM-DD

  • 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;

  • amount (Integer)

    The number of given intervals, starting from start_date, to fetch. E.g. 3 (months).

  • field_key (String)

    The date field key which deals will be retrieved from

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :user_id (Integer)

    If supplied, only deals matching the given user will be returned.

  • :pipeline_id (Integer)

    If supplied, only deals matching the given pipeline will be returned

  • :filter_id (Integer)

    If supplied, only deals matching the given filter will be returned

  • :exclude_deals (NumberBoolean)

    Whether to exclude deals list (1) or not (0). Note that when deals are excluded, the timeline summary (counts and values) is still returned.

  • :totals_convert_currency (String)

    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.

Returns:

  • (Array<(GetDealsTimeline, Integer, Hash)>)

    GetDealsTimeline data, response status code and response headers



1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
# 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