API version overwritten by response
It is not possible to call Mailjet::Eventcallbackurl.create(...) more than once because the API version set with Mailjet.configure (such as v3) is overwritten by the Version attribute returned by the API call. (This Version attribute is 1 for ungrouped and 2 for grouped callbacks. Since support for this grouped feature is currently missing (see #266), this issue went undetected.)
The version is overwritten here:
https://github.com/mailjet/mailjet-gem/blob/c086506435567a1938f3ff3eaefe4f553e417849/lib/mailjet/resource.rb#L309
And this new value is then used in this weird bit of code to overwrite the API version:
https://github.com/mailjet/mailjet-gem/blob/c086506435567a1938f3ff3eaefe4f553e417849/lib/mailjet/resource.rb#L254
I'm not quite sure how best to fix this. Honestly, the implementation is, well, confusing and lacking isolation. The API settings (handed down to the resource classes) and other such resource state must be separated from the attributes read from the API response – to prevent name conflicts like this one.
As a really ugly workaround, I force reset the version after the API call:
Mailjet::Eventcallbackurl.version = Mailjet.config.api_version
As a side note, maybe the connection should be memoized here:
https://github.com/mailjet/mailjet-gem/blob/c086506435567a1938f3ff3eaefe4f553e417849/lib/mailjet/resource.rb#L31