-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from treasure-data/fix_wrong_data_address_type
Fixed JSON format in MERGE field's type is address
- Loading branch information
Showing
4 changed files
with
87 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
src/main/java/org/embulk/output/mailchimp/model/AddressMergeFieldAttribute.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package org.embulk.output.mailchimp.model; | ||
|
||
import com.fasterxml.jackson.annotation.JsonCreator; | ||
import org.embulk.config.ConfigException; | ||
|
||
/** | ||
* Created by thangnc on 6/9/17. | ||
*/ | ||
public enum AddressMergeFieldAttribute | ||
{ | ||
ADDR1("addr1"), ADDR2("addr2"), CITY("city"), STATE("state"), ZIP("zip"), COUNTRY("country"); | ||
|
||
private String name; | ||
|
||
AddressMergeFieldAttribute(String type) | ||
{ | ||
this.name = type; | ||
} | ||
|
||
/** | ||
* Gets name. | ||
* | ||
* @return the name | ||
*/ | ||
public String getName() | ||
{ | ||
return name; | ||
} | ||
|
||
/** | ||
* Find by name method. | ||
* | ||
* @param name the name | ||
* @return the auth method | ||
*/ | ||
@JsonCreator | ||
public static AddressMergeFieldAttribute findByName(final String name) | ||
{ | ||
for (AddressMergeFieldAttribute method : values()) { | ||
if (method.getName().equals(name.toLowerCase())) { | ||
return method; | ||
} | ||
} | ||
|
||
throw new ConfigException( | ||
String.format("Unknown attributes '%s'. Supported attributes are [addr1, addr1, state, zip, country]", | ||
name)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters