Skip to content

Commit b91af7f

Browse files
authored
code cleanup and fix linting (#37)
* code cleanup and fix linting * remove yarn error * fix yarn
1 parent d306c3a commit b91af7f

29 files changed

+326
-350
lines changed

.eslintrc

Lines changed: 0 additions & 52 deletions
This file was deleted.

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
language: node_js
22
node_js:
3-
- "6"
4-
- "8.10.0"
3+
- '6'
4+
- '8.10.0'

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ Once you completed making the change, Please make sure to run the tests before y
1616
`npm run test` which will test your code.
1717

1818
**Working on your first Pull Request?**
19-
<a href="https://egghead.io/courses/how-to-contribute-to-an-open-source-project-on-github" target="_blank">How to Contribute to an Open Source Project on GitHub</a>.
19+
<a href='https://egghead.io/courses/how-to-contribute-to-an-open-source-project-on-github' target='_blank'>How to Contribute to an Open Source Project on GitHub</a>.
2020
Thanks to @kentcdodds for this amazing tutorial.

LICENSE

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ MIT License
33
Copyright (c) 2018 Ajaykumar
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
6-
of this software and associated documentation files (the "Software"), to deal
6+
of this software and associated documentation files (the 'Software'), to deal
77
in the Software without restriction, including without limitation the rights
88
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
99
copies of the Software, and to permit persons to whom the Software is
@@ -12,7 +12,7 @@ furnished to do so, subject to the following conditions:
1212
The above copyright notice and this permission notice shall be included in all
1313
copies or substantial portions of the Software.
1414

15-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1616
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1717
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1818
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER

README.md

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ npm install ebay-node-api
4848
let eBay = require('ebay-node-api')
4949

5050
let ebay = new eBay({
51-
clientID: "-- Client APP ID ----",
51+
clientID: '-- Client APP ID ----',
5252
// options - optional HTTP request timeout to apply to all requests.
53-
env: "SANDBOX" // optional default = "PRODUCTION"
53+
env: 'SANDBOX' // optional default = 'PRODUCTION'
5454
})
5555
```
5656
Creates a new `Ebay` instance.
@@ -74,13 +74,13 @@ If you using Sandbox environment, make sure to provide `env` variable in options
7474
## GetAccessToken
7575

7676
```javascript
77-
const Ebay = require("ebay-node-api");
77+
const Ebay = require('ebay-node-api');
7878

7979
let ebay = new Ebay({
80-
clientID: "--Client Id----",
80+
clientID: '--Client Id----',
8181
clientSecret: '-- Client Secret --',
8282
body: {
83-
grant_type: "client_credentials",
83+
grant_type: 'client_credentials',
8484
//you may need to define the oauth scope
8585
scope: 'https://api.ebay.com/oauth/api_scope'
8686
}
@@ -94,13 +94,13 @@ ebay.getAccessToken().then((data) => {
9494

9595
## FetchItemsByKeyword
9696
```javascript
97-
const Ebay = require("ebay-node-api");
97+
const Ebay = require('ebay-node-api');
9898

9999
let ebay = new Ebay({
100-
clientID: "-- Client APP ID ----",
100+
clientID: '-- Client APP ID ----',
101101
limit: 6
102102
});
103-
ebay.findItemsByKeywords("iphone").then((data) => {
103+
ebay.findItemsByKeywords('iphone').then((data) => {
104104
console.log(data); // fetches top 6 results in form of JSON.
105105
}, (error) => {
106106
console.log(error);
@@ -110,7 +110,7 @@ ebay.findItemsByKeywords("iphone").then((data) => {
110110
## GetItemsByCategory
111111
```javascript
112112
let ebay = new Ebay({
113-
clientID: "-- Client APP ID ----",
113+
clientID: '-- Client APP ID ----',
114114
limit: 6
115115
});
116116
ebay.findItemsByCategory(10181).then((data) => {
@@ -138,8 +138,8 @@ ebay.getAccessToken()
138138
ebay.getAccessToken()
139139
.then((data) => {
140140
ebay.getItemByLegacyId({
141-
"legacyItemId": 2628001 // Get Item Details Using a Legacy ID
142-
"legacyVariationSku": "V-00031-WHM" // default null
141+
'legacyItemId': 2628001 // Get Item Details Using a Legacy ID
142+
'legacyVariationSku': 'V-00031-WHM' // default null
143143
}).then((data) => {
144144
if (!data) console.log(data);
145145
// Data is in format of JSON
@@ -153,7 +153,7 @@ ebay.getAccessToken()
153153
```javascript
154154
ebay.getAccessToken()
155155
.then((data) => {
156-
ebay.getItemByItemGroup("151915076499").then((data) => {
156+
ebay.getItemByItemGroup('151915076499').then((data) => {
157157
// Data is in format of JSON
158158
// To check the format of Data, Go to this url (https://jsonblob.com/56cbea67-30b8-11e8-953c-5d1886dcf4a0)
159159
console.log(data)
@@ -168,8 +168,8 @@ ebay.getAccessToken()
168168
ebay.getAccessToken()
169169
.then((data) => {
170170
ebay.searchItems({
171-
keyword: "drone",
172-
limit: "3"
171+
keyword: 'drone',
172+
limit: '3'
173173
}).then((data) => {
174174
console.log(data);
175175
// Data is in format of JSON
@@ -183,7 +183,7 @@ ebay.getAccessToken()
183183
ebay.getAccessToken()
184184
.then((data) => {
185185
ebay.searchItems({
186-
keyword: "drone",
186+
keyword: 'drone',
187187
limit: 3,
188188
// filter: { maxDeliveryCost: 0 } old object based filter method
189189
filter: 'maxDeliveryCost:0' // new string based filter method. Format here: https://developer.ebay.com/api-docs/buy/static/ref-buy-browse-filters.html#conditionIds
@@ -201,9 +201,9 @@ ebay.getAccessToken()
201201
ebay.getAccessToken()
202202
.then((data) => {
203203
ebay.searchItems({
204-
keyword: "iphone",
204+
keyword: 'iphone',
205205
limit: 3,
206-
// filter: { price: "[300..800]", priceCurrency: "USD", conditions: "NEW" } old object based filter method
206+
// filter: { price: '[300..800]', priceCurrency: 'USD', conditions: 'NEW' } old object based filter method
207207
filter: 'price:[300..800],priceCurrency:USD,conditions{NEW}' // new string based filter method. Format here: https://developer.ebay.com/api-docs/buy/static/ref-buy-browse-filters.html#conditionIds
208208
}).then((data) => {
209209
console.log(data);
@@ -221,7 +221,7 @@ ebay.getMostWatchedItems({
221221
categoryId: 267 // optional
222222
}).then((data) => {
223223
if (data.errorMessage) {
224-
console.log("Error:" + data.errorMessage);
224+
console.log('Error:' + data.errorMessage);
225225
}
226226
console.log(JSON.stringify(data));
227227
});
@@ -232,7 +232,7 @@ ebay.getSimilarItems({
232232
itemId=280254552262 // optional
233233
}).then((data) => {
234234
if (data.errorMessage) {
235-
console.log("Error:" + data.errorMessage);
235+
console.log('Error:' + data.errorMessage);
236236
}
237237
console.log(JSON.stringify(data));
238238
// JSON format of similar items.
@@ -243,7 +243,7 @@ ebay.getSimilarItems({
243243
```javascript
244244
ebay.getAccessToken()
245245
.then((data) => {
246-
ebay.getDefaultCategoryTreeId("EBAY_US").then((data) => {
246+
ebay.getDefaultCategoryTreeId('EBAY_US').then((data) => {
247247
console.log(data);
248248
// for EN_US { categoryTreeId: '0', categoryTreeVersion: '119' }
249249
});
@@ -258,7 +258,7 @@ ebay.getAccessToken()
258258
// JSON format of complete category sub tree.
259259
});
260260

261-
ebay.getCategorySuggestions(0, "iphone").then((data) => {
261+
ebay.getCategorySuggestions(0, 'iphone').then((data) => {
262262
console.log(data);
263263
// JSON format of category suggestions.
264264
});
@@ -280,23 +280,23 @@ ebay.getAllCategories('1234').then((data) => {
280280

281281
// Get User Profile
282282
//https://developer.ebay.com/devzone/shopping/docs/callref/GetUserProfile.html
283-
ebay.getUserDetails({ userId: "ajaykumapratha_0", details: true }).then((data) => {
283+
ebay.getUserDetails({ userId: 'ajaykumapratha_0', details: true }).then((data) => {
284284
console.log(data);
285285
}, (error) => {
286286
console.log(error);
287287
});
288288

289289
// Get Item Status
290290
//https://developer.ebay.com/devzone/shopping/docs/callref/GetItemStatus.html
291-
ebay.getItemStatus(["153265274986", "153265274986"]).then((data) => {
291+
ebay.getItemStatus(['153265274986', '153265274986']).then((data) => {
292292
console.log(data);
293293
}, (error) => {
294294
console.log(error);
295295
});
296296

297297
//https://developer.ebay.com/devzone/shopping/docs/callref/GetShippingCosts.html
298298
ebay.getShippingCosts({
299-
itemId: "153265274986", destCountryCode: 'US',
299+
itemId: '153265274986', destCountryCode: 'US',
300300
destPostalCode: '95128'
301301
}).then((data) => {
302302
console.log(data);

demo/browseApi.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
const Ebay = require('../src/index');
2-
let access_token = "";
2+
const { clientId, clientSecret } = require('./credentials');
3+
4+
let access_token = '';
35
let ebay = new Ebay({
4-
clientID: "-- Client ID -----",
5-
clientSecret: '-- Client Secret---',
6+
clientID: clientId,
7+
clientSecret: clientSecret,
68
body: {
7-
grant_type: "client_credentials",
9+
grant_type: 'client_credentials',
810
scope: 'https://api.ebay.com/oauth/api_scope'
911

1012
}
@@ -26,7 +28,7 @@ ebay.getAccessToken()
2628
ebay.getAccessToken()
2729
.then((data) => {
2830
ebay.getItemByLegacyId({
29-
"legacyItemId": 2628001 // Get Item Details Using a Legacy ID
31+
'legacyItemId': 2628001 // Get Item Details Using a Legacy ID
3032
}).then((data) => {
3133
if (!data) console.log(data);
3234
// Data is in format of JSON
@@ -38,8 +40,8 @@ ebay.getAccessToken()
3840
ebay.getAccessToken()
3941
.then((data) => {
4042
ebay.getItemByLegacyId({
41-
"legacyItemId": 2628001,
42-
"legacyVariationSku": "V-00031-WHM"
43+
'legacyItemId': 2628001,
44+
'legacyVariationSku': 'V-00031-WHM'
4345
}).then((data) => {
4446
if (!data) console.log(data);
4547
// Data is in format of JSON
@@ -52,7 +54,7 @@ ebay.getAccessToken()
5254
// reference https://developer.ebay.com/api-docs/buy/browse/resources/item/methods/getItemsByItemGroup#uri.item_group_id
5355
ebay.getAccessToken()
5456
.then((data) => {
55-
ebay.getItemByItemGroup("151915076499").then((data) => {
57+
ebay.getItemByItemGroup('151915076499').then((data) => {
5658
// Data is in format of JSON
5759
// To check the format of Data, Go to this url (https://jsonblob.com/56cbea67-30b8-11e8-953c-5d1886dcf4a0)
5860
console.log(data)

demo/credentials.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
clientId: "-- client id ----",
3+
clientSecret: "--- client secret---"
4+
};

demo/fetchItemsByCategory.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
const Ebay = require('../src/index');
2+
const { clientId } = require('./credentials');
23

34
let ebay = new Ebay({
4-
clientID: "-- Client APP ID ----",
5+
clientID: clientId,
56
limit: 6
67
});
78
ebay.findItemsByCategory(10181).then((data) => {
89
console.log(data);
910
}, (error) => {
1011
console.log(error);
1112
});
12-
13-
14-
15-

demo/fetchItemsByKeyword.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
const Ebay = require('../src/index');
2+
const { clientId } = require('./credentials');
23

34
let ebay = new Ebay({
4-
clientID: "-- Client APP ID ----",
5+
clientID: clientId,
56
limit: 6
67
});
7-
ebay.findItemsByKeywords("iphone").then((data) => {
8+
ebay.findItemsByKeywords('iphone').then((data) => {
89
console.log(data);
910
}, (error) => {
1011
console.log(error);

demo/getAccessToken.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
const Ebay = require('../src/index');
1+
const EbayToken = require('oauth-ebay');
2+
const { clientId, clientSecret } = require('./credentials');
23

3-
let ebay = new Ebay({
4-
clientID: "--Client Id----",
5-
clientSecret: '-- Client Secret --',
6-
body: {
7-
grant_type: "client_credentials"
8-
}
4+
let ebay = new EbayToken({
5+
clientID: clientId,
6+
clientSecret: clientSecret,
7+
grantType: 'client_credentials'
98
});
109
ebay.getAccessToken().then((data) => {
1110
console.log(data);

0 commit comments

Comments
 (0)