Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
Send build folder for version 0.2.1 fix and closes #3.
Browse files Browse the repository at this point in the history
  • Loading branch information
hmschreiner committed May 26, 2017
1 parent 6aebeb3 commit ab8f7f9
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 32 deletions.
44 changes: 14 additions & 30 deletions dist/endpoints/blog.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,60 +2,44 @@

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _errorHandler = require('../helpers/errorHandler');

var _errorHandler2 = _interopRequireDefault(_errorHandler);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

var Blog = function () {
function Blog() {
var api = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;

_classCallCheck(this, Blog);
var Blog = function Blog() {
var api = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;

if (api === null) throw new Error('Request instance must be provided on constructor.');

this.api = api;
}
if (api === null) throw new Error('Request instance must be provided on constructor.');

_createClass(Blog, [{
key: 'getAllBlogs',
value: function getAllBlogs(params) {
return {
getAllBlogs: function getAllBlogs(params) {

return this.api.get('content/api/v2/blogs', _extends({}, params)).then(function (response) {
return api.get('content/api/v2/blogs', _extends({}, params)).then(function (response) {
return response;
}).catch(function (error) {
return (0, _errorHandler2.default)(error);
});
}
}, {
key: 'getPosts',
value: function getPosts(params) {
},
getPosts: function getPosts(params) {

return this.api.get('content/api/v2/blog-posts', _extends({}, params)).then(function (response) {
return api.get('content/api/v2/blog-posts', _extends({}, params)).then(function (response) {
return response;
}).catch(function (error) {
return (0, _errorHandler2.default)(error);
});
}
}, {
key: 'getPostById',
value: function getPostById(postId) {
},
getPostById: function getPostById(postId) {

return this.api.get('content/api/v2/blog-posts/' + postId).then(function (response) {
return api.get('content/api/v2/blog-posts/' + postId).then(function (response) {
return response;
}).catch(function (error) {
return (0, _errorHandler2.default)(error);
});
}
}]);

return Blog;
}();
};
};

module.exports = Blog;
19 changes: 19 additions & 0 deletions dist/endpoints/contacts.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ var _responseHandler2 = _interopRequireDefault(_responseHandler);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

var Contacts = function () {
Expand Down Expand Up @@ -46,6 +48,23 @@ var Contacts = function () {
return (0, _errorHandler2.default)(error);
});
}
}, {
key: 'createContact',
value: function createContact(properties) {

var mappedProperties = Object.keys(properties).map(function (property) {
return {
property: property,
value: properties[property]
};
});

return this.api.post('contacts/v1/contact', { properties: [].concat(_toConsumableArray(mappedProperties)) }).then(function (response) {
return (0, _responseHandler2.default)(response);
}).catch(function (error) {
return (0, _errorHandler2.default)(error);
});
}
}]);

return Contacts;
Expand Down
6 changes: 5 additions & 1 deletion dist/helpers/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ var Request = function () {

}, {
key: 'post',
value: function post() {}
value: function post(endPoint) {
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

return this.apiInstance.post(endPoint + '?hapikey=' + this.apiKey, this.normalizeParams(params));
}

// TODO

Expand Down
2 changes: 1 addition & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ var NodeHubspotApi = function NodeHubspotApi() {
calendar: null,
companies: null,
contacts: new _contacts2.default(api),
blog: new _blog2.default(api),
blog: (0, _blog2.default)(api),
domains: null,
files: null
};
Expand Down

0 comments on commit ab8f7f9

Please sign in to comment.