Skip to content

Can't update a product - round trip read/write fails #64

Description

@barnaclebarnes

I just tried to update a product and it seems that it is complaining about fields being null. You should be able to "round trip" a read/write. As a workaround how to do remove those additional fields from the update?

(byebug) product = client.products.where(sku: "Hold").first
#<BaseCRM::Product id=3036919, updated_at="2019-03-31T09:13:12Z", created_at="2019-03-31T09:13:12Z", active=true, description=nil, name="Hold Plan", sku="Hold", prices=[{:currency=>"USD", :amount=>"25.00"}], max_discount=nil, max_markup=nil, cost=nil, cost_currency=nil>
(byebug) product.name = "New Name"
"New Name"
(byebug) client.products.update(product)
*** BaseCRM::ErrorsCollection Exception: [b9qc3-kh39i-cqe7c-usmp0] http_status=422 Unprocessable Entity
code=blank message=attribute can't be blank details=This field may not be null. resource=product field=/data/cost
code=blank message=attribute can't be blank details=This field may not be null. resource=product field=/data/cost_currency
code=blank message=attribute can't be blank details=This field may not be null. resource=product field=/data/description
code=blank message=attribute can't be blank details=This field may not be null. resource=product field=/data/max_markup

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions