mailjet-gem icon indicating copy to clipboard operation
mailjet-gem copied to clipboard

formatted_payload in resource.rb returns incomplete hash

Open Mr5he11 opened this issue 2 years ago • 0 comments

https://github.com/mailjet/mailjet-gem/blob/675f75f5e402632f4d6a0ab017b680c752fa9ff9/lib/mailjet/resource.rb#L320

When trying to update a Mailjet::Contact through the update_attributes method, the remote instance doesn't get updated. For example:

target = Mailjet::Contact.find("[email protected]")
target.update_attributes("is_excluded_from_campaigns" => true)

doesn't change the remote Contact instance, according to the Mailjet console. Debugging a little bit it turned out that the update api gets called with the return value of formatted_payload as body, and that such method selects only a restricted set of attributes if the local instance is persisted (the linked code row is the exact point where this happens). Is this the correct behaviour?

Mr5he11 avatar Jul 21 '21 14:07 Mr5he11