chargebee / chargebee-ruby

Ruby library for the Chargebee API.
https://apidocs.chargebee.com/docs/api?lang=ruby
MIT License
32 stars 60 forks source link

Nested array attributes are incorrectly serialized #64

Closed gerbal closed 2 years ago

gerbal commented 2 years ago

According to the Chargebee documentations, when a coupon with nested attributes is serialized, the path of the nested attributes should be preserved and double-nested arrays should be json encoded as arrays.

{"item_constraints": [{"item_price_ids": ["id1"]}]}

Is expected to be serialized to parameters as:

item_constraints[item_price_ids][0]=["id1"] 

However when this resource is serialized using this library, the nested array is not correctly nested

ChargeBee::Util.serialize({item_constraints: [{item_price_ids: ['id1']}]})

=> {"item_price_ids[0]"=>"id1"}
cb-prajaktachavan commented 2 years ago

Closing this issue as its been resolved in latest release v2.13.1.

cb-prajaktachavan commented 2 years ago

Hi, You should be passing this jsonarray as string '["id1","id2"]' within single quotes as this field is not list of values.