Sha256: 4bd234c99586bba30449d44983abcca5ffa19ff2db80cb7c581bad78ccf2f7d5

Contents?: true

Size: 1.13 KB

Versions: 24

Compression:

Stored size: 1.13 KB

Contents

package org.embulk.output.mailchimp.model;

import com.fasterxml.jackson.annotation.JsonCreator;
import org.embulk.config.ConfigException;

/**
 * Created by thangnc on 4/17/17.
 * <p>
 * MailChimp v3 supports 2 types of auth: OAuth and API key.
 */
public enum AuthMethod
{
    /**
     * OAuth2 type
     */
    OAUTH("oauth"),
    /**
     * API key type
     */
    API_KEY("api_key");

    private String type;

    AuthMethod(final 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 AuthMethod findByType(final String type)
    {
        for (AuthMethod method : values()) {
            if (method.getType().equals(type.toLowerCase())) {
                return method;
            }
        }

        throw new ConfigException(
                String.format("Unknown auth_method '%s'. Supported targets are [api_key, oauth]",
                              type));
    }
}

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
embulk-output-mailchimp-0.3.6 src/main/java/org/embulk/output/mailchimp/model/AuthMethod.java
embulk-output-mailchimp-0.3.4 src/main/java/org/embulk/output/mailchimp/model/AuthMethod.java
embulk-output-mailchimp-0.3.3 src/main/java/org/embulk/output/mailchimp/model/AuthMethod.java
embulk-output-mailchimp-0.3.2 src/main/java/org/embulk/output/mailchimp/model/AuthMethod.java