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
class Fluent: | |
def __init__(self, cache=None): | |
self._cache = cache or [] | |
# Build the cache, and handle special cases | |
def _(self, name): | |
# Enables method chaining | |
return Fluent(self._cache+[name]) | |
# Final method call |
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
exports.handler = function(context, event, callback) { | |
const sgMail = require('@sendgrid/mail'); | |
sgMail.setApiKey(process.env.SENDGRID_API_KEY); | |
msgBody = 'We just received a donation from ' + String(event.donation_from); | |
const msg = { | |
to: 'outgoing@example.com', | |
from: 'incoming@example.com', | |
subject: 'Audrey just received a donation!', | |
text: msgBody, | |
html: '<strong>' + msgBody + '</strong>', |
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
import requests | |
from requests.auth import HTTPBasicAuth | |
to_number = 'outgoing_number' | |
from_number = 'your_twilio_number' | |
message = 'Thank for your order, we will deliver after our cookie booth sale at around 6pm.' | |
account_sid = 'your_account_sid' | |
auth_token = 'your_auth_token' | |
auth = HTTPBasicAuth(account_sid, auth_token) | |
url = 'https://api.twilio.com/2010-04-01/Accounts/{}/Messages'.format(account_sid) | |
values = { |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<Response> | |
<Message><Body>You may place your local, Moreno Valley/Riverside, CA and surrounding areas, order and we will deliver for free (payment due upon delivery): http://www.mvgirlscout.org. Not local to the Inland Empire, California? No problem! Please place your order here to have your cookies shipped or you may donate boxes to deployed miliatry overseas here: https://bit.ly/GirlScoutCookieOnlineOrder | |
</Body></Message> | |
</Response> |
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
var myMessage = new SendGridMessage(); | |
myMessage.From = new MailAddress("elmer@thinkingserious.com"); | |
myMessage.AddTo("elmer.thomas@sendgrid.com"); | |
myMessage.Subject = "Testing the SendGrid Library"; | |
myMessage.Text = "Hello World"; | |
var sg_username = Environment.GetEnvironmentVariable("SENDGRID_USERNAME"); | |
var sg_password = Environment.GetEnvironmentVariable("SENDGRID_PASSWORD"); | |
var credentials = new NetworkCredential(sg_username, sg_password); | |
var transportWeb = new Web(credentials); | |
transportWeb.DeliverAsync(myMessage); |
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
@Test | |
public void test_alerts_get() throws IOException { | |
SendGrid sg = new SendGrid("SENDGRID_API_KEY", true); | |
sg.setHost("localhost:4010"); | |
sg.addRequestHeader("X-Mock", "200"); | |
Request request = new Request(); | |
request.method = Method.GET; | |
request.endpoint = "alerts"; | |
Response response = sg.api(request); |
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
package com.sendgrid; | |
import java.io.IOException; | |
import java.util.HashMap; | |
public class MockSendGrid extends SendGrid { | |
Request request; | |
public MockSendGrid(String apiKey) { |
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
"/user/webhooks/parse/settings": { | |
"get": { | |
"consumes": [ | |
"application/json" | |
], | |
"description": "**This endpoint allows you to retrieve all of your current inbound parse settings.**\n\nThe inbound parse webhook allows you to have incoming emails parsed, extracting some or all of the contnet, and then have that content POSTed by SendGrid to a URL of your choosing. For more information, please see our [User Guide](https://sendgrid.com/docs/API_Reference/Webhooks/parse.html).", | |
"operationId": "GET_user-webhooks-parse-settings", | |
"produces": [ | |
"application/json" | |
], |
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
<?php | |
class Fluent { | |
function __construct($cache) { | |
$this->cache = ($cache ? $cache : []); | |
} | |
// Build the cache, and handle special cases | |
public function _($name) { | |
array_push($this->cache, $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
class Fluent | |
def initialize(cache: nil) | |
@cache = cache ? cache : [] | |
end | |
# Reflection | |
def method_missing(name, *args, &block) | |
_(name.to_s) | |
end |
NewerOlder