pipedrive.rb icon indicating copy to clipboard operation
pipedrive.rb copied to clipboard

How can I create a product?

Open TomasArruda opened this issue 6 years ago • 0 comments

Hello,

I am having some problems to create Product, I don't know what kind of parameters I should send to the creations endpoint. I managed to create a Product without the prices attribute, but once I added it fails.

Here is the request I am making:

Pipedrive::Product.new.create( { name: "test", code: "test", prices: [ { price: 1, currency: "EUR" } ] } )

And I am get this as a response:

#<Hashie::Mash additional_data=nil data=nil error="Price attribute must be set for each price." error_info="Acesse developers.pipedrive.com para mais informações sobre a API do Pipedrive." failed=false not_authorized=false success=false>

I checked the Pipedrive documentation and saw that the add product endpoint expects the following JSON: { "name": "", "code": "", "unit": "", "tax": "", "active_flag": "", "visible_to": "", "owner_id": "", "prices":[ { "price": "", "currency": "", "cost": "", "overhead_cost": "" } ] }

In summary, how can I use this gem to add a product with prices?

TomasArruda avatar Jan 28 '20 17:01 TomasArruda