How to use lob - 4 common examples

To help you get started, we’ve selected a few lob examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github motdotla / retromail / task.js View on Github external
execute(command, function(stdout) {
        var email     = new sendgrid.Email();
        email.to      = EMAIL;
        email.from    = EMAIL;
        email.subject = '[retromail] '+unix_time;
        email.text    = 'Attached is your retromail from '+unix_time;
        email.addFile({ path: output_path });

        sendgrid.send(email, function(err, json) {
          if (err) { return console.error(err); }
          console.log(json);
        });

        lob.addresses.create({
          name:             NAME,
          email:            EMAIL,
          address_line1:    ADDRESS_LINE1,
          address_line2:    ADDRESS_LINE2,
          address_city:     ADDRESS_CITY,
          address_state:    ADDRESS_STATE,
          address_zip:      ADDRESS_ZIP,
          address_country:  ADDRESS_COUNTRY 
        }, function(err, res) {
          var lob_address = res;

          lob.objects.create({
            name: output_path,
            file: "@"+output_path,
            setting_id: 100
          }, function(err, res) {
github motdotla / retromail / task.js View on Github external
}, function(err, res) {
            var lob_object = res;

            lob.jobs.create({
              name:     output_path,
              from:     lob_address.id, 
              to:       lob_address.id,
              object1:  lob_object.id
            }, function(err, res) {
              console.log(err, res);
            });
          });
        });
github motdotla / retromail / task.js View on Github external
}, function(err, res) {
          var lob_address = res;

          lob.objects.create({
            name: output_path,
            file: "@"+output_path,
            setting_id: 100
          }, function(err, res) {
            var lob_object = res;

            lob.jobs.create({
              name:     output_path,
              from:     lob_address.id, 
              to:       lob_address.id,
              object1:  lob_object.id
            }, function(err, res) {
              console.log(err, res);
            });
          });
        });
github opporty-com / Plasma-Cash / plasma-core / consensus / stakeTxHandle.js View on Github external
const unvote = async (transaction, oldOwner) => {
  let block = {}
  const {candidate, blockNumber} = transaction.data
  if (!candidate, !blockNumber) {
    return {answer: false, cause: rejectCauses.failData}
  }
  let value = typeof transaction.tokenId === 'string'
    ? 1 : transaction.tokenId.length
  let blockKey = 'block' + blockNumber.toString(10)
  try {
    block = (new Block(await redis.getAsync(Buffer.from(blockKey))))
  } catch (error) {
    logger.error(error.toString())
    return {answer: false, cause: rejectCauses.failData}
  }
  let tx = block.getTxByTokenId(transaction.tokenId)
  if (!tx) {
    return {answer: false, cause: rejectCauses.failData}
  }
  let stakeOwner = await web3.eth.personal.ecRecover(tx
    .getHash(true).toString('hex'),
  ethUtil.addHexPrefix(tx.signature.toString('hex')))
  if (stakeOwner != oldOwner) {
    return {answer: false, cause: rejectCauses.failData}
  }
  let stake = {voter: oldOwner, candidate, value}
  stateValidators.toLowerStake(stake)
  return {answer: true}
}

lob

Lob API wrapper

MIT
Latest version published 2 years ago

Package Health Score

50 / 100
Full package analysis