Skip to content
This repository was archived by the owner on Aug 20, 2020. It is now read-only.

Commit ec13cc7

Browse files
Conforms to SendGrid's open source policies
1 parent 1fa8d0f commit ec13cc7

File tree

4 files changed

+67
-155
lines changed

4 files changed

+67
-155
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Change Log
22
All notable changes to this project will be documented in this file.
3+
34
This project adheres to [Semantic Versioning](http://semver.org/).
45

56
## [1.0.1] - 2016-04-08

CONTRIBUTING.md

Lines changed: 44 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,28 @@
1-
Hello! Thank you for choosing to help contribute to the nodejs-http-client project. There are many ways you can contribute and help is always welcome.
2-
1+
Hello! Thank you for choosing to help contribute to one of the SendGrid open source libraries. There are many ways you can contribute and help is always welcome. We simply ask that you follow the following contribution policies.
2+
3+
- [CLAs and CCLAs](#cla)
4+
- [Roadmap & Milestones](#roadmap)
5+
- [Feature Request](#feature_request)
6+
- [Submit a Bug Report](#submit_a_bug_report)
7+
- [Improvements to the Codebase](#improvements_to_the_codebase)
8+
- [Understanding the Code Base](#understanding_the_codebase)
9+
- [Testing](#testing)
10+
- [Style Guidelines & Naming Conventions](#style_guidelines_and_naming_conventions)
11+
- [Creating a Pull Request](#creating_a_pull_request)
12+
13+
<a name="roadmap"></a>
314
We use [Milestones](https://github.com/sendgrid/nodejs-http-client/milestones) to help define current roadmaps, please feel free to grab an issue from the current milestone. Please indicate that you have begun work on it to avoid collisions. Once a PR is made, community review, comments, suggestions and additional PRs are welcomed and encouraged.
415

5-
* [Feature Request](#feature_request)
6-
* [Submit a Bug Report](#submit_a_bug_report)
7-
* [Improvements to the Codebase](#improvements_to_the_codebase)
8-
* [Understanding the Code Base](#understanding_the_codebase)
9-
* [Testing](#testing)
10-
* [Style Guidelines & Naming Conventions](#style_guidelines_and_naming_conventions)
11-
* [Creating a Pull Request](#creating_a_pull_request)
16+
<a name="cla"></a>
17+
## CLAs and CCLAs
18+
19+
Before you get started, SendGrid requires that a SendGrid Contributor License Agreement (CLA) or a SendGrid Company Contributor Licensing Agreement (CCLA) be filled out by every contributor to a SendGrid open source project.
20+
21+
Our goal with the CLA and CCLA is to clarify the rights of our contributors and reduce other risks arising from inappropriate contributions. The CLA also clarifies the rights SendGrid holds in each contribution and helps to avoid misunderstandings over what rights each contributor is required to grant to SendGrid when making a contribution. In this way the CLA and CCLA encourage broad participation by our open source community and help us build strong open source projects, free from any individual contributor withholding or revoking rights to any contribution.
22+
23+
SendGrid does not merge a pull request made against a SendGrid open source project until that pull request is associated with a signed CLA (or CCLA). Copies of the CLA and CCLA are available [here](https://drive.google.com/a/sendgrid.com/file/d/0B0PlcM9qA91LN2VEUTJWU2RIVXc/view).
24+
25+
You may submit your completed [CLA or CCLA](https://drive.google.com/a/sendgrid.com/file/d/0B0PlcM9qA91LN2VEUTJWU2RIVXc/view) to SendGrid at [[email protected]](mailto:[email protected]). SendGrid will then confirm you are ready to begin making contributions.
1226

1327
There are a few ways to contribute, which we'll enumerate below:
1428

@@ -37,49 +51,28 @@ Before you decide to create a new issue, please try the following:
3751

3852
### Please use our Bug Report Template
3953

40-
In order to make the process easier, we've included a sample bug report template (borrowed from [Ghost](https://github.com/TryGhost/Ghost/)). The template uses [GitHub flavored markdown](https://help.github.com/articles/github-flavored-markdown/) for formatting.
41-
42-
```
43-
Short and descriptive example bug report title
44-
45-
#### Issue Summary
46-
47-
A summary of the issue and the environment in which it occurs. If suitable, include the steps required to reproduce the bug. Please feel free to include screenshots, screencasts, code examples.
48-
49-
50-
#### Steps to Reproduce
51-
52-
1. This is the first step
53-
2. This is the second step
54-
3. Further steps, etc.
55-
56-
Any other information you want to share that is relevant to the issue being reported. Especially, why do you consider this to be a bug? What do you expect to happen instead?
57-
58-
#### Technical details:
59-
60-
* node-http-client Version: master (latest commit: [commit number])
61-
* Node.js Version: 4.1.2
62-
```
54+
In order to make the process easier, we've included a [sample bug report template](https://github.com/sendgrid/nodejs-http-client/.github/ISSUE_TEMPLATE) (borrowed from [Ghost](https://github.com/TryGhost/Ghost/)). The template uses [GitHub flavored markdown](https://help.github.com/articles/github-flavored-markdown/) for formatting.
6355

6456
<a name="improvements_to_the_codebase"></a>
6557
## Improvements to the Codebase
6658

67-
We welcome direct contributions to the rest code base. Thank you!
59+
We welcome direct contributions to the nodejs-http-client code base. Thank you!
6860

6961
### Development Environment ###
7062

71-
#### Install and run locally ####
63+
#### Install and Run Locally ####
7264

7365
##### Prerequisites #####
7466

75-
* Node.js 0.10 and up
76-
* Please see [package.json](https://github.com/sendgrid/nodejs-http-client/blob/master/package.json)
67+
- Node.js 0.10 and up
68+
- Please see [package.json](https://github.com/sendgrid/nodejs-http-client/blob/master/package.json)
7769

7870
##### Initial setup: #####
7971

80-
```
72+
```bash
8173
git clone https://github.com/sendgrid/nodejs-http-client.git
8274
cd nodejs-http-client
75+
npm install
8376
```
8477

8578
##### Execute: #####
@@ -88,13 +81,19 @@ See the [examples folder](https://github.com/sendgrid/nodejs-http-client/tree/ma
8881

8982
You will need to setup the following environment to use the SendGrid example:
9083

91-
```
84+
```bash
9285
echo "export SENDGRID_API_KEY='YOUR_API_KEY'" > sendgrid.env
9386
echo "sendgrid.env" >> .gitignore
9487
source ./sendgrid.env
9588
node examples/example.js
9689
```
9790

91+
To run the example:
92+
93+
```bash
94+
node ./examples/example.js
95+
```
96+
9897
<a name="understanding_the_codebase"></a>
9998
## Understanding the Code Base
10099

@@ -104,7 +103,7 @@ Working examples that demonstrate usage.
104103

105104
**client.js**
106105

107-
There is a object to hold both the request and response to the API server.
106+
There is a object to hold both the request and response to the API server.
108107

109108
The main function that does the heavy lifting (and external entry point) is `API`.
110109

@@ -113,7 +112,7 @@ The main function that does the heavy lifting (and external entry point) is `API
113112

114113
All PRs require passing tests before the PR will be reviewed.
115114

116-
All test files are in `[test/test.js](https://github.com/sendgrid/nodejs-http-client/blob/master/test/test.js)`.
115+
All test files are in [`test/test.js`](https://github.com/sendgrid/nodejs-http-client/blob/master/test/test.js).
117116

118117
For the purposes of contributing to this repo, please update the [`test.js`](https://github.com/sendgrid/nodejs-http-client/blob/master/test/test.js) file with unit tests as you modify the code.
119118

@@ -126,15 +125,11 @@ Run the test:
126125

127126
Generally, we follow the style guidelines as suggested by the official language. However, we ask that you conform to the styles that already exist in the library. If you wish to deviate, please explain your reasoning.
128127

129-
* [Unofficial Style Guide](https://github.com/felixge/node-style-guide)
130-
131-
Please run your code through [ESLint](http://eslint.org/) Standard style guide.
128+
- [Unofficial Style Guide](https://github.com/felixge/node-style-guide)
132129

133-
### Directory Structure
130+
Please run your code through:
134131

135-
* `examples` for example calls
136-
* `lib` for the main source code
137-
* `test` for the unit tests
132+
- [ESLint](http://eslint.org/) with the standard style guide.
138133

139134
## Creating a Pull Request<a name="creating_a_pull_request"></a>
140135

@@ -145,7 +140,7 @@ Please run your code through [ESLint](http://eslint.org/) Standard style guide.
145140
# Clone your fork of the repo into the current directory
146141
git clone https://github.com/sendgrid/nodejs-http-client
147142
# Navigate to the newly cloned directory
148-
cd nodejs-http-client
143+
cd sendgrid-python
149144
# Assign the original repo to a remote called "upstream"
150145
git remote add upstream https://github.com/sendgrid/nodejs-http-client
151146
```
@@ -189,4 +184,4 @@ Please run your code through [ESLint](http://eslint.org/) Standard style guide.
189184
7. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/)
190185
with a clear title and description against the `master` branch. All tests must be passing before we will review the PR.
191186

192-
If you have any additional questions, please feel free to [email](mailto:[email protected]) us or create an issue in this repo.
187+
If you have any additional questions, please feel free to [email](mailto:[email protected]) us or create an issue in this repo.

LICENSE renamed to LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2016 SendGrid
3+
Copyright (c) 2016 SendGrid, Inc.
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 21 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,17 @@
22

33
**HTTP REST client, simplified for Node.js**
44

5-
Here is a quick example:
5+
# Announcements
6+
7+
All updates to this library is documented in our [CHANGELOG](https://github.com/sendgrid/nodejs-http-client/blob/master/CHANGELOG.md).
8+
9+
# Installation
10+
11+
```bash
12+
npm install sendgrid-rest
13+
```
14+
15+
# Quick Start
616

717
`GET /your/api/{param}/call`
818

@@ -49,11 +59,7 @@ client.API(request, function (response) {
4959
})
5060
```
5161

52-
# Installation
53-
54-
`npm install sendgrid-rest`
55-
56-
## Usage ##
62+
# Usage
5763

5864
Following is an example using SendGrid. You can get your free account [here](https://sendgrid.com/free?source=nodejs-http-client).
5965

@@ -65,109 +71,19 @@ echo "sendgrid.env" >> .gitignore
6571
source ./sendgrid.env
6672
```
6773

68-
Following is an abridged example, here is the [full working code](https://github.com/sendgrid/nodejs-http-client/blob/master/examples/example.js).
74+
Here is the [full working code](https://github.com/sendgrid/nodejs-http-client/blob/master/examples/example.js).
75+
76+
To run the example:
6977

7078
```bash
7179
node examples/example
7280
```
7381

74-
```javascript
75-
var Client = require('sendgrid-rest').Client
76-
var emptyRequest = require('sendgrid-rest').request
77-
78-
// These values persist across of subsequent calls, unless overidden.
79-
var globalRequest = JSON.parse(JSON.stringify(emptyRequest))
80-
globalRequest.host = 'api.sendgrid.com';
81-
globalRequest.headers['Content-Type'] = 'application/json'
82-
// You must add your SendGrid API Key to your OS Environment
83-
globalRequest.headers['Authorization'] = 'Bearer '.concat(process.env.SENDGRID_API_KEY)
84-
var client = new Client(globalRequest)
85-
86-
// GET Collection
87-
var requestGet = JSON.parse(JSON.stringify(emptyRequest))
88-
requestGet.method = 'GET'
89-
requestGet.path = '/v3/api_keys'
90-
requestGet.queryParams['limit'] = 100
91-
requestGet.queryParams['offset'] = 0
92-
client.API(requestGet, function (response) {
93-
})
94-
95-
// POST
96-
var requestBody = {
97-
'name': 'My API Key from Node.js',
98-
'scopes': [
99-
'mail.send',
100-
'alerts.create',
101-
'alerts.read'
102-
]
103-
}
104-
var requestPost = JSON.parse(JSON.stringify(emptyRequest));
105-
requestPost.method = 'POST'
106-
requestPost.path = '/v3/api_keys'
107-
requestPost.requestBody = requestBody
108-
requestPost.headers['X-Test'] = 'test'
109-
function createAPIKey (callback) {
110-
client.API(requestPost, function (response) {
111-
var body = JSON.parse(response.responseBody)
112-
callback(body.api_key_id)
113-
})
114-
}
115-
116-
createAPIKey(function (returnValue) { // This ensures we POST a new key first, to get the api_key_id
117-
var api_key_id = '/'.concat(returnValue)
118-
119-
// GET SINGLE
120-
var requestGetSingle = JSON.parse(JSON.stringify(emptyRequest))
121-
requestGetSingle.method = 'GET'
122-
requestGetSingle.path = '/v3/api_keys'.concat(api_key_id)
123-
client.API(requestGetSingle, function (response) {
124-
})
125-
126-
// PATCH
127-
requestBody = {
128-
'name': 'A New Hope'
129-
}
130-
var requestPatch = JSON.parse(JSON.stringify(emptyRequest))
131-
requestPatch.method = 'PATCH'
132-
requestPatch.path = '/v3/api_keys'.concat(api_key_id)
133-
requestPatch.requestBody = requestBody
134-
client.API(requestPatch, function (response) {
135-
})
136-
137-
// PUT
138-
requestBody = {
139-
'name': 'A New Hope',
140-
'scopes': [
141-
'user.profile.read',
142-
'user.profile.update'
143-
]
144-
}
145-
var requestPut = JSON.parse(JSON.stringify(emptyRequest))
146-
requestPut.method = 'PUT'
147-
requestPut.path = '/v3/api_keys'.concat(api_key_id)
148-
requestPut.requestBody = requestBody
149-
client.API(requestPut, function (response) {
150-
})
151-
152-
// DELETE
153-
var requestDelete = JSON.parse(JSON.stringify(emptyRequest))
154-
requestDelete.method = 'DELETE'
155-
requestDelete.path = '/v3/api_keys'.concat(api_key_id)
156-
client.API(requestDelete, function (response) {
157-
})
158-
})
159-
160-
```
161-
162-
# Announcements
163-
164-
[2016.04.08] - We hit version 1!
165-
166-
# Roadmap
82+
## Roadmap
16783

168-
[Milestones](https://github.com/sendgrid/nodejs-http-client/milestones)
84+
If you are intersted in the future direction of this project, please take a look at our [milestones](https://github.com/sendgrid/nodejs-http-client/milestones). We would love to hear your feedback.
16985

170-
# How to Contribute
86+
## How to Contribute
17187

17288
We encourage contribution to our libraries, please see our [CONTRIBUTING](https://github.com/sendgrid/nodejs-http-client/blob/master/CONTRIBUTING.md) guide for details.
17389

@@ -177,9 +93,9 @@ We encourage contribution to our libraries, please see our [CONTRIBUTING](https:
17793

17894
# About
17995

180-
![SendGrid Logo]
181-
(https://assets3.sendgrid.com/mkt/assets/logos_brands/small/sglogo_2015_blue-9c87423c2ff2ff393ebce1ab3bd018a4.png)
182-
18396
nodejs-http-client is guided and supported by the SendGrid [Developer Experience Team](mailto:[email protected]).
18497

18598
nodejs-http-client is maintained and funded by SendGrid, Inc. The names and logos for nodejs-http-client are trademarks of SendGrid, Inc.
99+
100+
![SendGrid Logo]
101+
(https://assets3.sendgrid.com/mkt/assets/logos_brands/small/sglogo_2015_blue-9c87423c2ff2ff393ebce1ab3bd018a4.png)

0 commit comments

Comments
 (0)