ebay-api 1.13.7 → 6.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (218) hide show
  1. package/LICENSE +18 -19
  2. package/README.md +512 -118
  3. package/lib/api/apiFactory.d.ts +27 -0
  4. package/lib/api/apiFactory.js +100 -0
  5. package/lib/api/apiFactory.js.map +1 -0
  6. package/lib/api/base.d.ts +13 -0
  7. package/lib/api/base.js +25 -0
  8. package/lib/api/base.js.map +1 -0
  9. package/lib/api/index.d.ts +11 -0
  10. package/lib/api/index.js +18 -0
  11. package/lib/api/index.js.map +1 -0
  12. package/lib/api/restful/buy/browse/index.d.ts +84 -0
  13. package/lib/api/restful/buy/browse/index.js +142 -0
  14. package/lib/api/restful/buy/browse/index.js.map +1 -0
  15. package/lib/api/restful/buy/deal/index.d.ts +55 -0
  16. package/lib/api/restful/buy/deal/index.js +80 -0
  17. package/lib/api/restful/buy/deal/index.js.map +1 -0
  18. package/lib/api/restful/buy/feed/index.d.ts +43 -0
  19. package/lib/api/restful/buy/feed/index.js +85 -0
  20. package/lib/api/restful/buy/feed/index.js.map +1 -0
  21. package/lib/api/restful/buy/index.d.ts +17 -0
  22. package/lib/api/restful/buy/index.js +21 -0
  23. package/lib/api/restful/buy/index.js.map +1 -0
  24. package/lib/api/restful/buy/marketing/index.d.ts +27 -0
  25. package/lib/api/restful/buy/marketing/index.js +51 -0
  26. package/lib/api/restful/buy/marketing/index.js.map +1 -0
  27. package/lib/api/restful/buy/marketplaceInsights/index.d.ts +28 -0
  28. package/lib/api/restful/buy/marketplaceInsights/index.js +51 -0
  29. package/lib/api/restful/buy/marketplaceInsights/index.js.map +1 -0
  30. package/lib/api/restful/buy/offer/index.d.ts +23 -0
  31. package/lib/api/restful/buy/offer/index.js +37 -0
  32. package/lib/api/restful/buy/offer/index.js.map +1 -0
  33. package/lib/api/restful/buy/order/index.d.ts +264 -0
  34. package/lib/api/restful/buy/order/index.js +369 -0
  35. package/lib/api/restful/buy/order/index.js.map +1 -0
  36. package/lib/api/restful/commerce/catalog/index.d.ts +73 -0
  37. package/lib/api/restful/commerce/catalog/index.js +108 -0
  38. package/lib/api/restful/commerce/catalog/index.js.map +1 -0
  39. package/lib/api/restful/commerce/charity/index.d.ts +34 -0
  40. package/lib/api/restful/commerce/charity/index.js +56 -0
  41. package/lib/api/restful/commerce/charity/index.js.map +1 -0
  42. package/lib/api/restful/commerce/identity/index.d.ts +14 -0
  43. package/lib/api/restful/commerce/identity/index.js +27 -0
  44. package/lib/api/restful/commerce/identity/index.js.map +1 -0
  45. package/lib/api/restful/commerce/index.d.ts +15 -0
  46. package/lib/api/restful/commerce/index.js +19 -0
  47. package/lib/api/restful/commerce/index.js.map +1 -0
  48. package/lib/api/restful/commerce/notification/index.d.ts +117 -0
  49. package/lib/api/restful/commerce/notification/index.js +187 -0
  50. package/lib/api/restful/commerce/notification/index.js.map +1 -0
  51. package/lib/api/restful/commerce/taxonomy/index.d.ts +78 -0
  52. package/lib/api/restful/commerce/taxonomy/index.js +135 -0
  53. package/lib/api/restful/commerce/taxonomy/index.js.map +1 -0
  54. package/lib/api/restful/commerce/translation/index.d.ts +15 -0
  55. package/lib/api/restful/commerce/translation/index.js +25 -0
  56. package/lib/api/restful/commerce/translation/index.js.map +1 -0
  57. package/lib/api/restful/developer/analytics/index.d.ts +22 -0
  58. package/lib/api/restful/developer/analytics/index.js +45 -0
  59. package/lib/api/restful/developer/analytics/index.js.map +1 -0
  60. package/lib/api/restful/developer/index.d.ts +5 -0
  61. package/lib/api/restful/developer/index.js +9 -0
  62. package/lib/api/restful/developer/index.js.map +1 -0
  63. package/lib/api/restful/index.d.ts +63 -0
  64. package/lib/api/restful/index.js +165 -0
  65. package/lib/api/restful/index.js.map +1 -0
  66. package/lib/api/restful/postOrder/cancellation/index.d.ts +57 -0
  67. package/lib/api/restful/postOrder/cancellation/index.js +95 -0
  68. package/lib/api/restful/postOrder/cancellation/index.js.map +1 -0
  69. package/lib/api/restful/postOrder/case/index.d.ts +63 -0
  70. package/lib/api/restful/postOrder/case/index.js +97 -0
  71. package/lib/api/restful/postOrder/case/index.js.map +1 -0
  72. package/lib/api/restful/postOrder/index.d.ts +11 -0
  73. package/lib/api/restful/postOrder/index.js +15 -0
  74. package/lib/api/restful/postOrder/index.js.map +1 -0
  75. package/lib/api/restful/postOrder/inquiry/index.d.ts +82 -0
  76. package/lib/api/restful/postOrder/inquiry/index.js +131 -0
  77. package/lib/api/restful/postOrder/inquiry/index.js.map +1 -0
  78. package/lib/api/restful/postOrder/return/index.d.ts +231 -0
  79. package/lib/api/restful/postOrder/return/index.js +361 -0
  80. package/lib/api/restful/postOrder/return/index.js.map +1 -0
  81. package/lib/api/restful/sell/account/index.d.ts +217 -0
  82. package/lib/api/restful/sell/account/index.js +337 -0
  83. package/lib/api/restful/sell/account/index.js.map +1 -0
  84. package/lib/api/restful/sell/analytics/index.d.ts +41 -0
  85. package/lib/api/restful/sell/analytics/index.js +61 -0
  86. package/lib/api/restful/sell/analytics/index.js.map +1 -0
  87. package/lib/api/restful/sell/compliance/index.d.ts +37 -0
  88. package/lib/api/restful/sell/compliance/index.js +57 -0
  89. package/lib/api/restful/sell/compliance/index.js.map +1 -0
  90. package/lib/api/restful/sell/feed/index.d.ts +151 -0
  91. package/lib/api/restful/sell/feed/index.js +255 -0
  92. package/lib/api/restful/sell/feed/index.js.map +1 -0
  93. package/lib/api/restful/sell/finances/index.d.ts +74 -0
  94. package/lib/api/restful/sell/finances/index.js +105 -0
  95. package/lib/api/restful/sell/finances/index.js.map +1 -0
  96. package/lib/api/restful/sell/fulfillment/index.d.ts +137 -0
  97. package/lib/api/restful/sell/fulfillment/index.js +199 -0
  98. package/lib/api/restful/sell/fulfillment/index.js.map +1 -0
  99. package/lib/api/restful/sell/index.d.ts +29 -0
  100. package/lib/api/restful/sell/index.js +33 -0
  101. package/lib/api/restful/sell/index.js.map +1 -0
  102. package/lib/api/restful/sell/inventory/index.d.ts +248 -0
  103. package/lib/api/restful/sell/inventory/index.js +346 -0
  104. package/lib/api/restful/sell/inventory/index.js.map +1 -0
  105. package/lib/api/restful/sell/listing/index.d.ts +14 -0
  106. package/lib/api/restful/sell/listing/index.js +25 -0
  107. package/lib/api/restful/sell/listing/index.js.map +1 -0
  108. package/lib/api/restful/sell/logistics/index.d.ts +44 -0
  109. package/lib/api/restful/sell/logistics/index.js +66 -0
  110. package/lib/api/restful/sell/logistics/index.js.map +1 -0
  111. package/lib/api/restful/sell/marketing/index.d.ts +443 -0
  112. package/lib/api/restful/sell/marketing/index.js +609 -0
  113. package/lib/api/restful/sell/marketing/index.js.map +1 -0
  114. package/lib/api/restful/sell/metadata/index.d.ts +77 -0
  115. package/lib/api/restful/sell/metadata/index.js +131 -0
  116. package/lib/api/restful/sell/metadata/index.js.map +1 -0
  117. package/lib/api/restful/sell/negotiation/index.d.ts +24 -0
  118. package/lib/api/restful/sell/negotiation/index.js +39 -0
  119. package/lib/api/restful/sell/negotiation/index.js.map +1 -0
  120. package/lib/api/restful/sell/recommendation/index.d.ts +26 -0
  121. package/lib/api/restful/sell/recommendation/index.js +39 -0
  122. package/lib/api/restful/sell/recommendation/index.js.map +1 -0
  123. package/lib/api/traditional/XMLRequest.d.ts +98 -0
  124. package/lib/api/traditional/XMLRequest.js +191 -0
  125. package/lib/api/traditional/XMLRequest.js.map +1 -0
  126. package/lib/api/traditional/clientAlerts/index.d.ts +9 -0
  127. package/lib/api/traditional/clientAlerts/index.js +15 -0
  128. package/lib/api/traditional/clientAlerts/index.js.map +1 -0
  129. package/lib/api/traditional/clientAlerts/types.d.ts +31 -0
  130. package/lib/api/traditional/clientAlerts/types.js +36 -0
  131. package/lib/api/traditional/clientAlerts/types.js.map +1 -0
  132. package/lib/api/traditional/fields.d.ts +1948 -0
  133. package/lib/api/traditional/fields.js +1949 -0
  134. package/lib/api/traditional/fields.js.map +1 -0
  135. package/lib/api/traditional/finding/index.d.ts +12 -0
  136. package/lib/api/traditional/finding/index.js +16 -0
  137. package/lib/api/traditional/finding/index.js.map +1 -0
  138. package/lib/api/traditional/index.d.ts +17 -0
  139. package/lib/api/traditional/index.js +207 -0
  140. package/lib/api/traditional/index.js.map +1 -0
  141. package/lib/api/traditional/merchandising/index.d.ts +7 -0
  142. package/lib/api/traditional/merchandising/index.js +11 -0
  143. package/lib/api/traditional/merchandising/index.js.map +1 -0
  144. package/lib/api/traditional/shopping/index.d.ts +11 -0
  145. package/lib/api/traditional/shopping/index.js +16 -0
  146. package/lib/api/traditional/shopping/index.js.map +1 -0
  147. package/lib/api/traditional/trading/index.d.ts +142 -0
  148. package/lib/api/traditional/trading/index.js +146 -0
  149. package/lib/api/traditional/trading/index.js.map +1 -0
  150. package/lib/auth/authNAuth.d.ts +49 -0
  151. package/lib/auth/authNAuth.js +122 -0
  152. package/lib/auth/authNAuth.js.map +1 -0
  153. package/lib/auth/index.d.ts +17 -0
  154. package/lib/auth/index.js +32 -0
  155. package/lib/auth/index.js.map +1 -0
  156. package/lib/auth/oAuth2.d.ts +90 -0
  157. package/lib/auth/oAuth2.js +258 -0
  158. package/lib/auth/oAuth2.js.map +1 -0
  159. package/lib/ebay-api.min.js +2 -0
  160. package/lib/ebay-api.min.js.map +1 -0
  161. package/lib/enums/apiEnums.d.ts +49 -0
  162. package/lib/enums/apiEnums.js +55 -0
  163. package/lib/enums/apiEnums.js.map +1 -0
  164. package/lib/enums/index.d.ts +2 -0
  165. package/lib/enums/index.js +15 -0
  166. package/lib/enums/index.js.map +1 -0
  167. package/lib/enums/restfulEnums.d.ts +966 -0
  168. package/lib/enums/restfulEnums.js +1012 -0
  169. package/lib/enums/restfulEnums.js.map +1 -0
  170. package/lib/errors/index.d.ts +66 -0
  171. package/lib/errors/index.js +208 -0
  172. package/lib/errors/index.js.map +1 -0
  173. package/lib/index.d.ts +56 -0
  174. package/lib/index.js +99 -0
  175. package/lib/index.js.map +1 -0
  176. package/lib/request.d.ts +26 -0
  177. package/lib/request.js +51 -0
  178. package/lib/request.js.map +1 -0
  179. package/lib/types/apiTypes.d.ts +28 -0
  180. package/lib/types/apiTypes.js +3 -0
  181. package/lib/types/apiTypes.js.map +1 -0
  182. package/lib/types/index.d.ts +3 -0
  183. package/lib/types/index.js +16 -0
  184. package/lib/types/index.js.map +1 -0
  185. package/lib/types/restfulTypes.d.ts +1082 -0
  186. package/lib/types/restfulTypes.js +3 -0
  187. package/lib/types/restfulTypes.js.map +1 -0
  188. package/lib/types/traditonalTypes.d.ts +34 -0
  189. package/lib/types/traditonalTypes.js +3 -0
  190. package/lib/types/traditonalTypes.js.map +1 -0
  191. package/package.json +115 -21
  192. package/.npmignore +0 -17
  193. package/.travis.yml +0 -7
  194. package/examples/Finding-FindItemsByKeywords.js +0 -46
  195. package/examples/Merchandising-GetMostWatchedItemsRequest.js +0 -16
  196. package/examples/Shopping-GetSingleItem.js +0 -18
  197. package/examples/Trading-GetOrders.js +0 -26
  198. package/index.js +0 -10
  199. package/lib/deep-to-array.js +0 -42
  200. package/lib/defaults.js +0 -69
  201. package/lib/errors.js +0 -44
  202. package/lib/json-parser.js +0 -336
  203. package/lib/key-lists.js +0 -64
  204. package/lib/urls.js +0 -64
  205. package/lib/versions.js +0 -35
  206. package/lib/xml-converter.js +0 -21
  207. package/lib/xml-request.js +0 -207
  208. package/scripts/parse-input-xml.js +0 -41
  209. package/test/deep-to-array.test.js +0 -100
  210. package/test/errors.test.js +0 -75
  211. package/test/helpers.js +0 -22
  212. package/test/mocha.opts +0 -1
  213. package/test/mocks/GetMultipleItems.xml +0 -115
  214. package/test/mocks/GetOrders-empty.xml +0 -17
  215. package/test/mocks/GetOrders.xml +0 -463
  216. package/test/pagination.test.js +0 -5
  217. package/test/parsing.test.js +0 -248
  218. package/test/xml-request.test.js +0 -447
@@ -1,207 +0,0 @@
1
- var
2
- _ = require('lodash'),
3
- debug = require('debug')('ebay:request'),
4
- timer = require('debug')('ebay:timer'),
5
- request = require('request'),
6
- util = require('util'),
7
- async = require('async'),
8
- xmlBuilder = require('xml'),
9
- buildRequestUrl = require('./urls').buildRequestUrl,
10
- getDefaultHeaders = require('./defaults').getDefaultHeaders,
11
- convertXmlToJson = require('./xml-converter').convertXmlToJson,
12
- parseResponseJson = require('./json-parser').parseResponseJson,
13
- deepToArray = require('./deep-to-array').deepToArray,
14
- EbayClientError = require('./errors').EbayClientError;
15
-
16
-
17
- /*
18
- build XML input for XML requests (POST).
19
- @param {object} options: request context. see `xmlRequest()` docs.
20
- for repeatable fields, use an array value (see below).
21
- */
22
- function buildXmlInput(options) {
23
- debug('buildXmlInput', options);
24
-
25
- var data = {}, root;
26
- var params = options.params || {};
27
-
28
- root = data[options.opType + 'Request'] = []; // e.g. <GetOrdersRequest>
29
-
30
- if (options.serviceName === 'Finding') {
31
- root.push({'_attr': {'xmlns': 'http://www.ebay.com/marketplace/search/v1/services'}});
32
- }
33
- else {
34
- root.push({'_attr': {'xmlns': 'urn:ebay:apis:eBLBaseComponents'}});
35
- }
36
-
37
- if (options.authToken) {
38
- root.push({ 'RequesterCredentials': [ { 'eBayAuthToken' : options.authToken } ] });
39
- }
40
-
41
- // concat
42
- root.push.apply(root, deepToArray(params));
43
-
44
- debug('Converting to XML', data);
45
-
46
- var xmlBody =
47
- '<?xml version="1.0" encoding="UTF-8"?>\n' +
48
- xmlBuilder([data], true);
49
-
50
- debug('XML body', xmlBody);
51
-
52
- return xmlBody;
53
- }
54
-
55
-
56
- /*
57
- @param {object} @options:
58
- @option {object} reqOptions: passed to request
59
-
60
- @option {string} appId
61
- @option {string} opType
62
- @option {string} version
63
-
64
- @option {string} devId
65
- @option {string} certId
66
- @option {string} authToken
67
-
68
- @option {string} globalId
69
- @option {string} siteId
70
-
71
- @option {object} params: this gets converted to an XML body with request parameters.
72
- - all filters go in here. use nested objects where appropriate. see the API docs.
73
-
74
- @option {int} parseDepth: how many levels down to try to parse/interpret the response.
75
- - see `parseResponseJson()` and its tests.
76
- - higher number can make app-level code easier, but is riskier;
77
- lower number here shifts the parsing burden to the application.
78
-
79
- ...
80
-
81
- note, `options` may be modified by ref.
82
-
83
- @param {function} callback: gets response
84
- */
85
- exports.xmlRequest = function(options, callback) {
86
- var _startTime = Date.now();
87
-
88
- debug('XML request', options);
89
- options = options || {};
90
-
91
- if (! options.serviceName) return callback(new Error("Missing serviceName"));
92
- if (! options.opType) return callback(new Error("Missing opType"));
93
-
94
- options.xmlConverter = options.xmlConverter || convertXmlToJson;
95
- options.parser = options.parser || parseResponseJson;
96
-
97
- // for default parser
98
- options.parseDepth = options.parseDepth != null ? options.parseDepth : -1; // default parse all the way
99
-
100
- options.reqOptions = options.reqOptions || {};
101
- options.reqOptions.headers = options.reqOptions.headers || {};
102
- _.defaults(options.reqOptions.headers, getDefaultHeaders(options));
103
-
104
- // allow options to override default url (and body) if they want to.
105
- options.reqOptions = _.extend({
106
- url: buildRequestUrl(options),
107
- body: buildXmlInput(options),
108
- // As of 3/22/2016, the eBay API has several servers that can only
109
- // negotiate TLS v1.0 sessions, and several servers that can negotiate TLS
110
- // v1.0, v1.1 and v1.2. Node/OpenSSL get confused by this, and occasionally
111
- // attempt to parse a v1.2 response using TLS v1.0 and vice versa. The
112
- // error you get back from the request looks something like this:
113
- //
114
- // { [Error: write EPROTO 140113357338496:error:1408F10B:SSL
115
- // routines:SSL3_GET_RECORD:wrong version number:../deps/openssl/openssl/ssl/s3_pkt.c:362:
116
- // ] code: 'EPROTO',
117
- // errno: 'EPROTO',
118
- // syscall: 'write' }
119
- //
120
- // As far as I can tell, this isn't patched yet, in Node or OpenSSL. But
121
- // setting the following options forces all connections to be negotiated
122
- // with TLS v1.0, effectively fixing the issue.
123
- //
124
- // More reading:
125
- //
126
- // https://github.com/aws/aws-sdk-js/issues/862
127
- // https://github.com/nodejs/node/issues/3692
128
- // https://www.ssllabs.com/ssltest/analyze.html?d=api.ebay.com
129
- agentOptions: {
130
- ciphers: 'ALL',
131
- secureProtocol: 'TLSv1_method',
132
- },
133
- }, options.reqOptions);
134
-
135
- debug('XML request options', options.reqOptions);
136
- timer('time to initiate request', Date.now() - _startTime);
137
-
138
- request.post(options.reqOptions, function(error, response) {
139
-
140
- debug('response', error ? {error: error} : {statusCode: response.statusCode, body: response.body});
141
- timer('time to response', Date.now() - _startTime);
142
-
143
- if (error) {
144
- return callback(error);
145
- }
146
-
147
- // this is tricky -- API should return 200 with body in every valid scenario,
148
- // so a non-200 probably means something's wrong on the client side with the request.
149
- // so expect an EbayClientError.
150
- if (response.statusCode !== 200) {
151
- return callback(new EbayClientError(
152
- util.format("Bad response status code", response.statusCode, (response.body ? response.body.toString() : null))
153
- ));
154
- }
155
-
156
- // raw XML wanted?
157
- if (options.raw) {
158
- return callback(null, response.body);
159
- }
160
-
161
- async.waterfall([
162
- // convert xml to json
163
- function _toJson(next) {
164
- options.xmlConverter(response.body, options, function(error, data) {
165
- if (error) return next(error);
166
- debug('Parsed XML', data);
167
- timer('time to parsed XML', Date.now() - _startTime);
168
- next(null, data);
169
- });
170
- },
171
-
172
- function _parseJson(data, next) {
173
- // will pass error if response includes an error message,
174
- // or if actually can't parse.
175
- // `options.parseDepth` is very important here.
176
- options.parser(data, options, next);
177
- }
178
- ],
179
- function _done(error, data) {
180
- timer('time to parsed JSON', Date.now() - _startTime);
181
- var extraErrorProps = {};
182
-
183
- if (error) {
184
- // as much context as possible for forensic debugging.
185
- // (includes `serviceName`, `reqOptions`, etc; not functions.)
186
- extraErrorProps.requestContext = _.omit(options, _.functions(options));
187
- extraErrorProps.requestContext.response = _.pick(response, ['statusCode', 'body']);
188
-
189
- if (/Ebay/i.test(error.name)) {
190
- // already differentiated into custom error classes.
191
- _.extend(error, extraErrorProps);
192
- callback(error, data);
193
- }
194
- else {
195
- // some other parsing error
196
- // @review - is the original stack trace lost here?
197
- error = new EbayClientError("Error parsing JSON: " + error.message, extraErrorProps);
198
- callback(error, data);
199
- }
200
- }
201
- else {
202
- callback(null, data);
203
- }
204
- });
205
-
206
- });
207
- };
@@ -1,41 +0,0 @@
1
- #! /usr/bin/env node
2
-
3
- /**
4
- * script for debugging: input XML from eBay,
5
- * gets run through xml->js converter and JSON parser,
6
- * and outputs JSON (as an app using this module would get when it calls `xmlRequest()`).
7
- *
8
- * use for example with XML retrieved from API via `curl`, or eBay's API test tool.
9
- *
10
- * usage: `cat ebay-response.xml | parse-input-xml.js > ebay-response-parsed.json`
11
- */
12
-
13
- var
14
- async = require('async'),
15
- convertXmlToJson = require('../lib/xml-converter').convertXmlToJson,
16
- parseResponseJson = require('../lib/json-parser').parseResponseJson,
17
- inputXml = '';
18
-
19
- process.stdin.on('data', function(chunk) {
20
- inputXml += chunk.toString();
21
- });
22
-
23
- process.stdin.on('end', function() {
24
- async.waterfall([
25
- function(next) {
26
- // (don't know the context of the request anymore,
27
- // so anything `options`-specific in the parser won't work.)
28
- convertXmlToJson(inputXml, {}, next);
29
- },
30
- function(data, next) {
31
- parseResponseJson(data, {}, next);
32
- }
33
- ],
34
- function(error, parsedJson) {
35
- if (error) {
36
- console.log(error, error instanceof Error)
37
- throw error;
38
- }
39
- process.stdout.write(JSON.stringify(parsedJson));
40
- });
41
- });
@@ -1,100 +0,0 @@
1
- require('./helpers');
2
-
3
- describe('`deepToArray`', function() {
4
- var deepToArray = require('../lib/deep-to-array').deepToArray;
5
-
6
- it('converts plain value to array', function() {
7
- expect(deepToArray(5)).to.deep.equal([5]);
8
- });
9
-
10
- it('converts object to array', function() {
11
- expect(deepToArray({
12
- 'a': '1',
13
- 'b': '2'
14
- })).to.deep.equal(
15
- [
16
- {'a': ['1']},
17
- {'b': ['2']}
18
- ]
19
- );
20
- });
21
-
22
- it('splits out array elements into objects', function() {
23
- expect(deepToArray(
24
- {
25
- thing: ['a', 'b', 'c'],
26
- itemFilter: [
27
- {name: 'FreeShippingOnly', value: 'true'},
28
- {name: 'MaxPrice', value: '150'},
29
- ]
30
- }
31
- )).to.deep.equal(
32
- [
33
- {thing: ['a']},
34
- {thing: ['b']},
35
- {thing: ['c']},
36
- {
37
- itemFilter: [
38
- {name: ['FreeShippingOnly']},
39
- {value: ['true']},
40
- ]
41
- },
42
- {
43
- itemFilter: [
44
- {name: ['MaxPrice']},
45
- {value: ['150']},
46
- ]
47
- }
48
- ]
49
- );
50
- });
51
-
52
- it('converts everything recursively to arrays', function() {
53
- expect(deepToArray({
54
- 'Thing': {
55
- 'Has': {
56
- 'Weird': 'Structure',
57
- 'Strange': 'Data'
58
- }
59
- },
60
- 'Things': [
61
- {'foo': 'bar'}
62
- ],
63
- 'More': 'Things',
64
- 'Finally': ['Thing1', 'Thing2'],
65
- 'Already': [{'An': 'Array'}]
66
- }))
67
- .to.deep.equal(
68
- [
69
- {
70
- 'Thing': [{
71
- 'Has': [
72
- {'Weird': ['Structure']},
73
- {'Strange': ['Data']}
74
- ]
75
- }]
76
- },
77
- {
78
- 'Things': [
79
- {'foo': ['bar']}
80
- ]
81
- },
82
- {
83
- 'More': ['Things']
84
- },
85
- {
86
- 'Finally': ['Thing1']
87
- },
88
- {
89
- 'Finally': ['Thing2']
90
- },
91
- {
92
- 'Already': [
93
- {'An': ['Array']}
94
- ]
95
- }
96
- ]
97
- );
98
- });
99
-
100
- });
@@ -1,75 +0,0 @@
1
- require('./helpers');
2
-
3
- var
4
- errors = require('../lib/errors'),
5
- _ = require('lodash');
6
-
7
-
8
- describe('error classes', function() {
9
-
10
- [
11
- 'EbayClientError',
12
- 'EbaySystemError',
13
- 'EbayRequestError',
14
- 'EbayAuthenticationError'
15
- ]
16
- .forEach(function(errorClassName) {
17
- describe(errorClassName, function() {
18
- var errorClass = errors[errorClassName];
19
-
20
- it('exists', function() {
21
- expect(errorClass).to.be.ok;
22
- });
23
-
24
- it('is an Error', function() {
25
- var err = new errorClass('Test');
26
- expect(err).to.be.instanceOf(Error);
27
- });
28
-
29
- it('is an EbayClientError', function() {
30
- var err = new errorClass('Test');
31
- expect(err).to.be.instanceOf(errors.EbayClientError);
32
- });
33
-
34
- it('can have a message', function() {
35
- var err = new errorClass('Test');
36
- expect(err).to.have.property('message', 'Test');
37
- });
38
-
39
- it('has a stack', function() {
40
- var err = new errorClass('Test');
41
- expect(err).to.have.property('stack');
42
- var stackLines = err.stack.split('\n');
43
- expect(stackLines[0]).to.equal(errorClassName + ': Test')
44
- expect(stackLines[1]).to.contain(__dirname);
45
- });
46
-
47
- it('can have arbitrary properties assigned', function() {
48
- var err = new errorClass('Test', {
49
- foo: 'bar',
50
- details: {errorCode: '123'},
51
- errors: ['um', 'hm']
52
- });
53
-
54
- expect(_.pick(err, ['foo', 'details', 'errors'])).to.deep.equal({
55
- foo: 'bar',
56
- details: {errorCode: '123'},
57
- errors: ['um', 'hm']
58
- });
59
- });
60
-
61
- it('can\'t overwrite base properties with extra properties', function() {
62
- var err = new errorClass('Original message', {
63
- message: 'New message',
64
- name: 'UhOh',
65
- stack: 'ByeBye'
66
- });
67
-
68
- expect(err.message).to.equal('Original message');
69
- expect(err.name).to.equal(errorClassName);
70
- expect(err.stack).not.to.equal('ByeBye');
71
- });
72
-
73
- });
74
- });
75
- });
package/test/helpers.js DELETED
@@ -1,22 +0,0 @@
1
- /**
2
- * test helpers. run once.
3
- */
4
-
5
- module.exports = (function() {
6
-
7
- var chai = require('chai');
8
- global.expect = chai.expect;
9
-
10
- global.sinon = require('sinon');
11
-
12
- chai.use(require("sinon-chai"));
13
-
14
- beforeEach('sandbox', function() {
15
- this.sinon = sinon.sandbox.create();
16
- });
17
-
18
- afterEach('unstub', function() {
19
- this.sinon.restore();
20
- });
21
-
22
- })();
package/test/mocha.opts DELETED
@@ -1 +0,0 @@
1
- --reporter spec
@@ -1,115 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <GetMultipleItemsResponse xmlns="urn:ebay:apis:eBLBaseComponents">
3
- <Timestamp>2015-10-13T15:00:00.000Z</Timestamp>
4
- <Ack>Success</Ack>
5
- <Version>939</Version>
6
- <Build>E939_CORE_APIXO_17691495_R1</Build>
7
- <Item>
8
- <ItemID>222222222222</ItemID>
9
- <BestOfferEnabled>false</BestOfferEnabled>
10
- <EndTime>2015-11-09T00:00:00.000Z</EndTime>
11
- <StartTime>2015-10-10T00:00:00.000Z</StartTime>
12
- <ViewItemURLForNaturalSearch>http://www.ebay.com/itm/Mason-Jars-/222222222222</ViewItemURLForNaturalSearch>
13
- <ListingType>FixedPriceItem</ListingType>
14
- <Location>San Francisco, California</Location>
15
- <PaymentMethods>PayPal</PaymentMethods>
16
- <GalleryURL>http://thumbs1.ebaystatic.com/pict/2222222222228080_1.jpg</GalleryURL>
17
- <PictureURL>http://i.ebayimg.com/00/s/MTAwMFg3NTA=/z/WSIAAWSIAAWSIAA/$_12.JPG?set_id=880000500F</PictureURL>
18
- <PictureURL>http://i.ebayimg.com/00/s/MTAwMFg3NTA=/z/WSIAAWSIAAWSIAA-/$_12.JPG?set_id=880000500F</PictureURL>
19
- <PostalCode>99999</PostalCode>
20
- <PrimaryCategoryID>20696</PrimaryCategoryID>
21
- <PrimaryCategoryName>Home &amp; Garden:Kitchen, Dining &amp; Bar:Glassware</PrimaryCategoryName>
22
- <Quantity>12</Quantity>
23
- <Seller>
24
- <UserID>test_user</UserID>
25
- <FeedbackRatingStar>None</FeedbackRatingStar>
26
- <FeedbackScore>0</FeedbackScore>
27
- <PositiveFeedbackPercent>0.0</PositiveFeedbackPercent>
28
- </Seller>
29
- <BidCount>0</BidCount>
30
- <ConvertedCurrentPrice currencyID="USD">3.0</ConvertedCurrentPrice>
31
- <CurrentPrice currencyID="USD">3.0</CurrentPrice>
32
- <ListingStatus>Active</ListingStatus>
33
- <QuantitySold>3</QuantitySold>
34
- <ShipToLocations>US</ShipToLocations>
35
- <ShipToLocations>CA</ShipToLocations>
36
- <ShipToLocations>GB</ShipToLocations>
37
- <ShipToLocations>DK</ShipToLocations>
38
- <ShipToLocations>RO</ShipToLocations>
39
- <ShipToLocations>SK</ShipToLocations>
40
- <ShipToLocations>BG</ShipToLocations>
41
- <ShipToLocations>CZ</ShipToLocations>
42
- <ShipToLocations>FI</ShipToLocations>
43
- <ShipToLocations>HU</ShipToLocations>
44
- <ShipToLocations>LV</ShipToLocations>
45
- <ShipToLocations>LT</ShipToLocations>
46
- <ShipToLocations>MT</ShipToLocations>
47
- <ShipToLocations>EE</ShipToLocations>
48
- <ShipToLocations>AU</ShipToLocations>
49
- <ShipToLocations>GR</ShipToLocations>
50
- <ShipToLocations>PT</ShipToLocations>
51
- <ShipToLocations>CY</ShipToLocations>
52
- <ShipToLocations>SI</ShipToLocations>
53
- <ShipToLocations>JP</ShipToLocations>
54
- <ShipToLocations>CN</ShipToLocations>
55
- <ShipToLocations>SE</ShipToLocations>
56
- <ShipToLocations>KR</ShipToLocations>
57
- <ShipToLocations>ID</ShipToLocations>
58
- <ShipToLocations>TW</ShipToLocations>
59
- <ShipToLocations>TH</ShipToLocations>
60
- <ShipToLocations>BE</ShipToLocations>
61
- <ShipToLocations>FR</ShipToLocations>
62
- <ShipToLocations>HK</ShipToLocations>
63
- <ShipToLocations>IE</ShipToLocations>
64
- <ShipToLocations>NL</ShipToLocations>
65
- <ShipToLocations>PL</ShipToLocations>
66
- <ShipToLocations>ES</ShipToLocations>
67
- <ShipToLocations>IT</ShipToLocations>
68
- <ShipToLocations>DE</ShipToLocations>
69
- <ShipToLocations>AT</ShipToLocations>
70
- <ShipToLocations>RU</ShipToLocations>
71
- <ShipToLocations>IL</ShipToLocations>
72
- <ShipToLocations>MX</ShipToLocations>
73
- <ShipToLocations>NZ</ShipToLocations>
74
- <ShipToLocations>PH</ShipToLocations>
75
- <ShipToLocations>SG</ShipToLocations>
76
- <ShipToLocations>CH</ShipToLocations>
77
- <ShipToLocations>NO</ShipToLocations>
78
- <ShipToLocations>SA</ShipToLocations>
79
- <ShipToLocations>UA</ShipToLocations>
80
- <ShipToLocations>AE</ShipToLocations>
81
- <ShipToLocations>QA</ShipToLocations>
82
- <ShipToLocations>KW</ShipToLocations>
83
- <ShipToLocations>BH</ShipToLocations>
84
- <ShipToLocations>HR</ShipToLocations>
85
- <ShipToLocations>MY</ShipToLocations>
86
- <ShipToLocations>CL</ShipToLocations>
87
- <ShipToLocations>CO</ShipToLocations>
88
- <ShipToLocations>CR</ShipToLocations>
89
- <ShipToLocations>DO</ShipToLocations>
90
- <ShipToLocations>PA</ShipToLocations>
91
- <ShipToLocations>TT</ShipToLocations>
92
- <ShipToLocations>GT</ShipToLocations>
93
- <ShipToLocations>SV</ShipToLocations>
94
- <ShipToLocations>HN</ShipToLocations>
95
- <ShipToLocations>JM</ShipToLocations>
96
- <Site>US</Site>
97
- <TimeLeft>P27DT6H1M31S</TimeLeft>
98
- <Title>Mason Jars</Title>
99
- <HitCount>14</HitCount>
100
- <PrimaryCategoryIDPath>11700:20625:20696</PrimaryCategoryIDPath>
101
- <Country>US</Country>
102
- <ReturnPolicy>
103
- <ReturnsAccepted>ReturnsNotAccepted</ReturnsAccepted>
104
- </ReturnPolicy>
105
- <AutoPay>false</AutoPay>
106
- <IntegratedMerchantCreditCardEnabled>false</IntegratedMerchantCreditCardEnabled>
107
- <HandlingTime>2</HandlingTime>
108
- <ConditionID>3000</ConditionID>
109
- <ConditionDisplayName>Used</ConditionDisplayName>
110
- <GlobalShipping>true</GlobalShipping>
111
- <ConditionDescription>Used but clean, no tops.</ConditionDescription>
112
- <QuantitySoldByPickupInStore>0</QuantitySoldByPickupInStore>
113
- <NewBestOffer>false</NewBestOffer>
114
- </Item>
115
- </GetMultipleItemsResponse>​
@@ -1,17 +0,0 @@
1
- <!-- mock empty orders (user has no recently-modified order) -->
2
- <?xml version="1.0" encoding="UTF-8"?>
3
- <GetOrdersResponse xmlns="urn:ebay:apis:eBLBaseComponents">
4
- <Timestamp>2015-10-11T15:01:00.222Z</Timestamp>
5
- <Ack>Success</Ack>
6
- <Version>939</Version>
7
- <Build>E939_CORE_APIXO_17691495_R1</Build>
8
- <PaginationResult>
9
- <TotalNumberOfPages>0</TotalNumberOfPages>
10
- <TotalNumberOfEntries>0</TotalNumberOfEntries>
11
- </PaginationResult>
12
- <HasMoreOrders>false</HasMoreOrders>
13
- <OrderArray></OrderArray>
14
- <OrdersPerPage>100</OrdersPerPage>
15
- <PageNumber>1</PageNumber>
16
- <ReturnedOrderCountActual>0</ReturnedOrderCountActual>
17
- </GetOrdersResponse>