Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(campaigns): Added support for Campaigns #275

Merged
merged 2 commits into from
Aug 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Create NYC folder
run: mkdir .nyc_output
- name: Install Dependencies
run: npm install
run: npm install --legacy-peer-deps
- name: Run tests
env:
LOB_API_KEY: ${{ secrets.API_KEY }}
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ coverage

*.sublime-*
.idea/
.vscode
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
Node.js wrapper for the [Lob.com](https://lob.com) API. See full Lob.com documentation [here](https://lob.com/docs/node).
******
Starting a new project, we recommend using our <a href="https://github.com/lob/lob-typescript-sdk"><strong>TypeScript SDK</strong></a>!

Move your existing project from lob-node to lob-typescript-sdk? <a href="https://github.com/lob/lob-typescript-sdk/blob/main/Migration.md">Checkout this migration guide.</a>
******

Expand Down Expand Up @@ -114,7 +114,7 @@ We've provided various examples for you to try out [here](https://github.com/lob

There are simple scripts to demonstrate how to create all the core Lob objects (checks, letters, postcards. etc.) as well as more complex examples that utilize other libraries and external files.

#### Accessing Response Headers
### Accessing Response Headers

You can access response headers via a hidden `_response` property.

Expand Down
2 changes: 1 addition & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const ClientVersion = require('../package.json').version;
const Resources = require('./resources');

const LOB_HOST = 'https://api.lob.com/v1/';
const LOB_HOST = process.env.LOB_HOST || 'https://api.lob.com/v1/';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I add this so I could test in staging by passing LOB_HOST in when running npm test

const LOB_USERAGENT = `Lob/v1 NodeBindings/${ClientVersion}`;

const Lob = function (apiKey, options) {
Expand Down
34 changes: 34 additions & 0 deletions lib/resources/campaigns.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
'use strict';

const ResourceBase = require('./resourceBase');

class Campaigns extends ResourceBase {

constructor (config) {
super('campaigns', config);
}

list (options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}

return this._transmit('GET', null, options, null, callback);
}

retrieve (id, callback) {
return this._transmit('GET', id, null, null, callback);
}

delete (id, callback) {
return this._transmit('DELETE', id, null, null, callback);
}

create (params, callback) {
return this._transmit('POST', null, null, params, callback);
}

}

module.exports = Campaigns;
1 change: 1 addition & 0 deletions lib/resources/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module.exports = {
bankAccounts: require('./bankAccounts'),
bulkIntlVerifications: require('./bulkIntlVerifications'),
bulkUSVerifications: require('./bulkUSVerifications'),
campaigns: require('./campaigns'),
cards: require('./cards'),
cardOrders: require('./cardOrders'),
checks: require('./checks'),
Expand Down
Loading