Class: Pipedrive::Deal

Inherits:
Base
  • Object
show all
Defined in:
lib/pipedrive/deal.rb

Instance Attribute Summary

Attributes inherited from Base

#data

Instance Method Summary collapse

Methods inherited from Base

all, authenticate, bad_response, create, find, find_by_name, #initialize, new_list, resource_path, #update

Constructor Details

This class inherits a constructor from Pipedrive::Base

Instance Method Details

#activitiesObject



18
19
20
# File 'lib/pipedrive/deal.rb', line 18

def activities
  Activity.all(get "#{resource_path}/#{id}/activities")
end

#add_product(opts = {}) ⇒ Object



4
5
6
7
# File 'lib/pipedrive/deal.rb', line 4

def add_product(opts = {})
  res = post "#{resource_path}/#{id}/products", :body => opts
  res.success? ? res['data']['product_attachment_id'] : bad_response(res,opts)
end

#filesObject



22
23
24
# File 'lib/pipedrive/deal.rb', line 22

def files
  File.all(get "#{resource_path}/#{id}/files")
end

#notes(opts = {:sort_by => 'add_time', :sort_mode => 'desc'}) ⇒ Object



26
27
28
# File 'lib/pipedrive/deal.rb', line 26

def notes(opts = {:sort_by => 'add_time', :sort_mode => 'desc'})
  Note.all( get("/notes", :query => opts.merge(:deal_id => id) ) )
end

#productsObject



9
10
11
# File 'lib/pipedrive/deal.rb', line 9

def products
  Product.all(get "#{resource_path}/#{id}/products")
end

#remove_product(product_attachment_id) ⇒ Object



13
14
15
16
# File 'lib/pipedrive/deal.rb', line 13

def remove_product product_attachment_id
  res = delete "#{resource_path}/#{id}/products", { :body => { :product_attachment_id => product_attachment_id } }
  res.success? ? nil : bad_response(res,product_attachment_id)
end