mailjet / mailjet-gem

[API v3] Mailjet official Ruby GEM

Home Page:https://dev.mailjet.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

formatted_payload in resource.rb returns incomplete hash

stefanosello opened this issue · comments

payload = payload.slice(*resourceprop.map(&:to_s))

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?

Fixed in version 1.7.1. Closing.