Skip to content

Instantly share code, notes, and snippets.

@lobot
lobot / tracking-event-changes-php
Created June 1, 2022 18:26
tracking-event-changes-php
<?php require __DIR__ . '/vendor/autoload.php';
$lob = new \Lob\Lob('<LOB_TEST_API_KEY>');
$to = json_decode('{
"name": "Harry Zhang",
"address_line1": "210 King Street",
"address_city": "San Francisco",
"address_state": "CA",
"address_zip": "94107"
@lobot
lobot / tracking-event-changes-ruby
Last active June 1, 2022 18:45
tracking-event-changes-ruby
require 'lob.rb'
require 'pp'
require 'rubygems'
require 'json'
lob = Lob::Client.new(api_key: "<LOB_TEST_API_KEY>")
to_address = '{
"name": "Harry Zhang",
"address_line1": "210 King Street",
@lobot
lobot / tracking-event-changes-python
Last active June 1, 2022 18:45
tracking-event-changes-python
import lob
lob.api_key = "<LOB_TEST_API_KEY>"
toAddress = {
"name": "Harry Zhang",
"address_line1": "210 King Street",
"address_city": "San Francisco",
"address_state": "CA",
"address_zip": "94107"
@lobot
lobot / tracking-event-changes-typescript
Last active June 1, 2022 18:43
tracking-event-changes-typescript
import {Configuration, Postcard, PostcardsApi, PostcardEditable, AddressEditable } from "@lob/lob-typescript-sdk"
async function demo() {
const config: Configuration = new Configuration({
username: "<LOB_TEST_API_KEY>"
})
let toAddress = new AddressEditable({
name: "Harry Zhang",
address_line1: "210 King Street",
// Bottom of page
<script src="https://cdn.lob.com/lob-address-elements/0.1.0/lob-address-elements.min.js" data-lob-key="YOUR_KEY_GOES_HERE" ></script>
</body>
</html>
<div>
<label for="primary1">Address 1*</label>
<input id="primary1" data-lob-primary>
</div>
<div>
<label for="primary1">Address</label>
<input id="primary1">
</div>
import {
Configuration,Postcard, PostcardsApi, PostcardEditable
} from "@lob/lob-typescript-sdk";
async function demo() {
const config: Configuration = new Configuration({
username: "<YOUR_TEST_KEY>"
});
const postcardData : PostcardEditable = {
@lobot
lobot / cancel-check-method
Created January 5, 2022 22:59
sending-check-cancel-check-method
/*
* GET / route to cancel a check.
*/
function cancelACheck(req, res) {
const checkId = req.params.checkId
Lob.checks.delete(checkId, function (err, response) {
const check = response
res.render('check', { check })
});
}
@lobot
lobot / check-controller-js
Created January 5, 2022 22:57
sending-check-controller-js
import dotenv from 'dotenv';
dotenv.config();
const Lob = require('lob')(process.env.LOB_API_KEY);
import Check from "../models/check"
/*
* GET / route to show the createCheck form.
*/
function createCheck(req, res) {
//catch any response on the url
let response = req.query.response