-
Notifications
You must be signed in to change notification settings - Fork 83
Updating grouping for existing or new subscriber #1
Comments
Hi James, Thank you for the feedback. I've added an example as you requested. See testSubscribe() method in Thanks Vasily |
By the way, I was using your maven-gae-plugin a year ago :) Nice job, thanks. |
No problem and thanks for the addition. I'm just one of many contributors to the gae plugin :) Speaking of GAE however - that is what I was hoping to use your sdk on. However due to the HttpClient dependencies it is not working (as HttpClient uses sockets which are not white listed on GAE). I suppose one solution I could persue would be to swap out the HttpClient code dependency for URLFetch - we have done this in the past for other libs. |
Had a further think about it. I was going to rewrite MailChimpClient to use GAE URLFetch, but that would add another dependency to the gae sdk. What I ended up doing was replacing HttpClient with standard java.net.* routines, which removes the HttpClient dependency and on GAE platforms is implemented transparently using the URL Fetch service. It only involved changing MailChimpClient.java - I will check it into my fork soon and you can integrate it if you like. |
The main reason I chose HttpClient is that it effectively caches connections. That is important for our main project (Ecwid). I'm afraid your implementation won't be as effective as HttpClient, will it? Maybe you want me to make method "execute(String url, String request)" protected, so that it can simply be overriden in the GAE-specific implementation? |
Yep - it won't be as efficient, but I don't really have a choice if I want to run it on GAE. Also, I suspect my scaling requirements are a fair bit lower than yours (I'm just dealing with my own customers/subscribers). I have checked in my rewrite of the execute method in my fork. It's called MailChimpGAEClient.java - it's a bit kludgy - I think your protected method idea is better. |
Is this what you had in mind? cheers james |
Yes, that is exactly what I had in mind. However, I've come to something which I think is a better solution: d2befa3 Just supply your implementation of MailChimpAPIConnection to MailChimpClient's constructor. |
James, Again, I've reconsidered the desing: addbdaf What we should do now to support GAE is as follows:
Thanks |
Sounds good - I will try the above and you can cherry pick it if you like it. If all works well it would be great to push a new version to maven central also - I'd rather not maintain a parallel version of the artefacts. I'll merge again and keep you posted. |
Hi Vasily, Here is the commit: jbroberg@17baaee Could you check one final thing before you push again to mvn central? I notice that when I use the ListSubscribeMethod twice in a row for the same subscriber, but change the groupings, new groups are added but omitted groups are not removed, despite setting replace_interests = true Can you replicate this issue? |
Thank you for the contribution, I've cherry-picked your commit. Strangely, my integration tests run slightly faster with your implementation comparing to the default one. Maybe I should consider getting rid of HttpClient dependency. As for the issue with groupings, I'll have a look at it soon, thanks for reporting. |
James, I have doubts regarding the following line in your code:
I've never heard about application/POST mime type, so I supposed that it was a typo and changed it. |
Yes, I've replicated this. It seems that the API docs are simply misleading. Have a look at the following thread: https://groups.google.com/forum/#!msg/mailchimp-api-discuss/5y-Td4k-39k/kq18CiNBHkQJ Experimenting, I've found out that replace_interests=true affects merge_vars.GROUPINGS.groups values, not merge_vars.GROUPINGS as one may expect. |
Hi Vasily, Regarding the "application/POST" type - I think I was initially confused as to how the parameters were passed/serialised. If it works without it, leave it out. Ok - so workaround for "removing" a grouping according to that thread is to assign it an empty or null value. If that works I'm happy! |
Hi Vasily, I can confirm setting an empty merge_vars.GROUPINGS.groups value achieves the necessary function I was after (removing them from the group). Do you think you could cut a new release and send it to maven central? cheers! James |
Hi James, The new release had already been sent: 1.3.0.2. |
Hi there,
Thanks so much for this library - it is very useful. It would be great if you could include an example (e.g. in the unit tests) of setting or updating the grouping information on a subscriber, for instance when adding a new subscriber via listSubscribe using GROUPINGS in merge_vars.
cheers
James
The text was updated successfully, but these errors were encountered: