mailjet / mailjet-gem

[API v3] Mailjet official Ruby GEM
https://dev.mailjet.com
Other
130 stars 72 forks source link

formatted_payload in resource.rb returns incomplete hash #216

Closed stefanosello closed 2 years ago

stefanosello commented 3 years ago

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("example@domain.com")
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?

Retttro commented 2 years ago

Fixed in version 1.7.1. Closing.