fulcrum-app
Advanced tools
Comparing version 2.4.0 to 2.4.1
@@ -39,2 +39,6 @@ 'use strict'; | ||
var _uuid = require('uuid'); | ||
var _uuid2 = _interopRequireDefault(_uuid); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -53,4 +57,5 @@ | ||
value: function () { | ||
var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(file, attributes) { | ||
var formData, options, resp; | ||
var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(file) { | ||
var id = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; | ||
var formData, accessKey, options, resp; | ||
return _regenerator2.default.wrap(function _callee$(_context) { | ||
@@ -61,5 +66,6 @@ while (1) { | ||
formData = new _formData2.default(); | ||
accessKey = id || _uuid2.default.v4(); | ||
formData.append(this.resourceName + '[access_key]', attributes.access_key); | ||
formData.append(this.resourceName + '[access_key]', accessKey); | ||
formData.append(this.resourceName + '[track]', file); | ||
@@ -73,10 +79,10 @@ | ||
}; | ||
_context.next = 6; | ||
_context.next = 7; | ||
return this.client.api.post(this.createAction, options); | ||
case 6: | ||
case 7: | ||
resp = _context.sent; | ||
return _context.abrupt('return', resp.body[this.resourceName]); | ||
return _context.abrupt('return', resp[this.resourceName]); | ||
case 8: | ||
case 9: | ||
case 'end': | ||
@@ -89,3 +95,3 @@ return _context.stop(); | ||
function uploadTrack(_x, _x2) { | ||
function uploadTrack(_x) { | ||
return _ref.apply(this, arguments); | ||
@@ -92,0 +98,0 @@ } |
@@ -75,2 +75,6 @@ 'use strict'; | ||
if (attrs.hasOwnProperty('track')) { | ||
formData.append(this.resourceName + '[track]', attrs.track); | ||
} | ||
var fileOptions = null; | ||
@@ -77,0 +81,0 @@ |
{ | ||
"name": "fulcrum-app", | ||
"version": "2.4.0", | ||
"version": "2.4.1", | ||
"description": "JavaScript wrapper for the Fulcrum API", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
import FormData from 'form-data'; | ||
import Mixin from 'mixmatch'; | ||
import uuid from 'uuid'; | ||
export default class Track extends Mixin { | ||
async uploadTrack(file, attributes) { | ||
async uploadTrack(file, id = null) { | ||
const formData = new FormData(); | ||
const accessKey = id || uuid.v4(); | ||
formData.append(`${this.resourceName}[access_key]`, attributes.access_key); | ||
formData.append(`${this.resourceName}[access_key]`, accessKey); | ||
formData.append(`${this.resourceName}[track]`, file); | ||
@@ -19,3 +21,3 @@ | ||
const resp = await this.client.api.post(this.createAction, options); | ||
return resp.body[this.resourceName]; | ||
return resp[this.resourceName]; | ||
} | ||
@@ -22,0 +24,0 @@ |
@@ -18,2 +18,6 @@ import uuid from 'uuid'; | ||
if (attrs.hasOwnProperty('track')) { | ||
formData.append(`${this.resourceName}[track]`, attrs.track); | ||
} | ||
let fileOptions = null; | ||
@@ -20,0 +24,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
213833
3870