New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support API v3 #13
Support API v3 #13
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some commented~
@Override | ||
public void validateOutputTask(final PluginTask task, final Schema schema, final int taskCount) | ||
{ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some validation may required?
build.gradle
Outdated
jcenter() | ||
// TODO(dmikurube): Remove this after embulk-base-restclient goes to jcenter. | ||
maven { | ||
url "http://dl.bintray.com/embulk-base-restclient/maven" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use https is better. I should also fix Stripe.
build.gradle
Outdated
spec.summary = %[Mailchimp output plugin for Embulk] | ||
spec.description = %[Dumps records to hubspot.] | ||
spec.email = ["thang@treasure-data.com"] | ||
spec.licenses = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add licenses for just in case.
build.gradle
Outdated
spec.version = "${project.version}" | ||
spec.authors = "Thang Nguyen" | ||
spec.summary = %[Mailchimp output plugin for Embulk] | ||
spec.description = %[Dumps records to hubspot.] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mailchimp?
circle.yml
Outdated
|
||
notify: | ||
webhooks: | ||
- url: http://td-beda.herokuapp.com/circleci_callback |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use https if possible.
} | ||
|
||
throw new ConfigException( | ||
String.format("Unknown target '%s'. Supported targets are [apikey, oauth]", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
api_key
?
.gitignore
Outdated
*.gemspec | ||
.gradle/ | ||
/classpath/ | ||
build/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add other pattern is better?
And /Gemfile.lock
is needed when JRuby based plugin.
https://github.com/treasure-data/embulk-input-intercom/blob/master/.gitignore
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And add LF is better.
ci/circle_mailchimp.yml as well
return response.getStatus() / 100 != 4; | ||
} | ||
} | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to throw ConfigException when API returns 401.
for (JsonNode contactData : contactsData) { | ||
ObjectNode property = jsonMapper.createObjectNode(); | ||
property.put("email_address", contactData.findPath("email").asText()); | ||
property.put("status", contactData.findPath("status").asText()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
contactData always contains email
and status
?
If no, no failure happens?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thks, i will add properties validator for these fields
build.gradle
Outdated
provided "org.embulk:embulk-core:0.8.15" | ||
compile "org.embulk.base.restclient:embulk-base-restclient:0.4.2" | ||
compile "org.embulk.base.restclient:embulk-util-retryhelper-jetty92:0.4.2" | ||
compile "org.glassfish.jersey.core:jersey-client:2.25.1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
required?
@sakama PTAL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
commented
provided | ||
} | ||
|
||
version = "0.3.0.1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's ok to use vx.x.x style versioning.
Something special reason?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sakama We wanted to release a "snapshot" version before PR is merged so that we can test on console-development, hence used an additional number.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make sense.
|
||
return responseBody != null && !responseBody.isEmpty() ? parseJson(responseBody) : MissingNode.getInstance(); | ||
} | ||
catch (HttpResponseException ex) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess all HttpResponseException were caught without retry. Is it OK?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HttpResponseException
should be not here. Its redundant. Then I will remove it.
} | ||
} | ||
|
||
if (isNullOrEmpty(task.getListId())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this block is never used.
Because you're using
@Config("list_id")
String getListId();
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIK, list_id
can be empty or null. Plugin does not know it can receive correct param or not
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah ok.
} | ||
|
||
throw new ConfigException( | ||
String.format("Unknown target '%s'. Supported targets are [api_key, oauth]", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/target/auth_method/
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, should be auth_method
. I will update
} | ||
|
||
throw new ConfigException( | ||
String.format("Unknown target '%s'. Supported statuses are [subscribed, pending, unsubscribed, cleaned]", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/target/status/
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noted and will fix
{ | ||
ConfigSource config = baseConfig; | ||
Schema schema = Schema.builder() | ||
.add("email", org.embulk.spi.type.Types.STRING) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor: You can also use following style.
import static org.embulk.spi.type.Types.STRING;
...
.add("email", Types.STRING)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noted and will fix
@thangnc In the future, please break a large PR like this into separate ones, each provides different functionality. |
int getTimeoutMillis(); | ||
|
||
@Config("auth_method") | ||
@ConfigDefault("access_token") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am afraid using "access_token" as default "auth_method" will break backwards compatibility. Since "auth_method" was not an option before, any existing config will not have any value. Default to access_token will break existing transfers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will let api_key
is default auth_method
in #15
@sakama can you take a look on this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
embulk-base-restclient