Skip to content

Commit

Permalink
Allow products to be added to deals.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaygen committed Feb 7, 2013
1 parent 23cfbf3 commit 15d34b7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/pipedrive/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Base < OpenStruct
format :json

extend Forwardable
def_delegators 'self.class', :get, :resource_path
def_delegators 'self.class', :get, :post, :resource_path, :bad_response

attr_reader :data

Expand Down
5 changes: 5 additions & 0 deletions lib/pipedrive/deal.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
module Pipedrive
class Deal < Base

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

end
end

0 comments on commit 15d34b7

Please sign in to comment.