-
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 #22 from treasure-data/fix_address_type
Added API to check address type and convert to json
- Loading branch information
Showing
8 changed files
with
237 additions
and
38 deletions.
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
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
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
102 changes: 102 additions & 0 deletions
102
src/main/java/org/embulk/output/mailchimp/model/MergeField.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,102 @@ | ||
package org.embulk.output.mailchimp.model; | ||
|
||
import com.fasterxml.jackson.annotation.JsonCreator; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import org.embulk.config.ConfigException; | ||
|
||
/** | ||
* Created by thangnc on 5/8/17. | ||
*/ | ||
public class MergeField | ||
{ | ||
@JsonProperty("merge_id") | ||
private int mergeId; | ||
|
||
private String name; | ||
private String tag; | ||
private String type; | ||
|
||
public int getMergeId() | ||
{ | ||
return mergeId; | ||
} | ||
|
||
public void setMergeId(int mergeId) | ||
{ | ||
this.mergeId = mergeId; | ||
} | ||
|
||
public String getName() | ||
{ | ||
return name; | ||
} | ||
|
||
public void setName(String name) | ||
{ | ||
this.name = name; | ||
} | ||
|
||
public String getTag() | ||
{ | ||
return tag; | ||
} | ||
|
||
public void setTag(String tag) | ||
{ | ||
this.tag = tag; | ||
} | ||
|
||
public String getType() | ||
{ | ||
return type; | ||
} | ||
|
||
public void setType(String type) | ||
{ | ||
this.type = type; | ||
} | ||
|
||
public enum MergeFieldType | ||
{ | ||
TEXT("text"), NUMBER("number"), ADDRESS("address"), PHONE("phone"), DATE("date"), URL("url"), | ||
IMAGEURL("imageurl"), RADIO("radio"), DROPDOWN("dropdown"), BIRTHDAY("birthday"), ZIP("zip"); | ||
|
||
private String type; | ||
|
||
MergeFieldType(String type) | ||
{ | ||
this.type = type; | ||
} | ||
|
||
/** | ||
* Gets type. | ||
* | ||
* @return the type | ||
*/ | ||
public String getType() | ||
{ | ||
return type; | ||
} | ||
|
||
/** | ||
* Find by type auth method. | ||
* | ||
* @param type the type | ||
* @return the auth method | ||
*/ | ||
@JsonCreator | ||
public static MergeFieldType findByType(final String type) | ||
{ | ||
for (MergeFieldType method : values()) { | ||
if (method.getType().equals(type.toLowerCase())) { | ||
return method; | ||
} | ||
} | ||
|
||
throw new ConfigException( | ||
String.format("Unknown merge field type '%s'. Supported targets are [text, number, address, phone, " + | ||
"date, url, imageurl, radio, dropdown, birthday, zip]", | ||
type)); | ||
} | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
src/main/java/org/embulk/output/mailchimp/model/MergeFields.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,24 @@ | ||
package org.embulk.output.mailchimp.model; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* Created by thangnc on 5/8/17. | ||
*/ | ||
public class MergeFields | ||
{ | ||
@JsonProperty("merge_fields") | ||
private List<MergeField> mergeFields; | ||
|
||
public List<MergeField> getMergeFields() | ||
{ | ||
return mergeFields; | ||
} | ||
|
||
public void setMergeFields(List<MergeField> mergeFields) | ||
{ | ||
this.mergeFields = mergeFields; | ||
} | ||
} |
Oops, something went wrong.