Beispiel #1
0
        /// <summary>
        /// Set the type id of the webhook.
        /// </summary>
        /// <param name="type">The type of webhook.</param>
        /// <returns>The instance of the webhook.</returns>
        public IWebhook SetTypeId(WebHookType type)
        {
            this.type = type;
            this.id   = EnumLookup.GetWebhookTypeName(type);

            return(this);
        }
Beispiel #2
0
        public void Webhook_Should_Have_Applied_Properties_That_Are_Set(WebHookType type)
        {
            var webhook = new Webhook();

            webhook.SetTypeId(type);

            Assert.Equal(type, webhook.Type);
        }
        /// <summary>
        /// Get the name of the webhook type.
        /// </summary>
        /// <param name="type">The webhook type.</param>
        /// <returns>Name of the webhook type.</returns>
        public static string GetWebhookTypeName(WebHookType type)
        {
            var name = string.Empty;

            switch (type)
            {
            case WebHookType.CLICKED:
                name = "clicked";
                break;

            case WebHookType.COMPLAINED:
                name = "complained";
                break;

            case WebHookType.DELIVERED:
                name = "delivered";
                break;

            case WebHookType.OPENED:
                name = "opened";
                break;

            case WebHookType.PERMANENT_FAIL:
                name = "permanent_fail";
                break;

            case WebHookType.TEMPORARY_FAIL:
                name = "temporary_fail";
                break;

            case WebHookType.UNSUBSCRIBED:
                name = "unsubscribed";
                break;
            }

            return(name);
        }