Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hubspot

Package Overview
Dependencies
Maintainers
5
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hubspot - npm Package Compare versions

Comparing version 2.3.10 to 2.3.11

4

History.md

@@ -0,1 +1,5 @@

# 2.3.11 / 2020-04-22
- Add Tickets related functionality
# 2.3.10 / 2020-04-14

@@ -2,0 +6,0 @@

2

index.d.ts

@@ -109,5 +109,5 @@ // Type definitions for hubspot 2.3.4

marketingEmail: MarketingEmail
ticket: Ticket
tickets: Ticket
}
export default Hubspot

@@ -66,3 +66,3 @@ const _ = require('lodash')

client.marketingEmail = new MarketingEmail(client)
client.ticket = new Ticket(client)
client.tickets = new Ticket(client)
}

@@ -69,0 +69,0 @@

@@ -13,4 +13,27 @@ class Ticket {

}
create(data) {
return this.client.apiRequest({
method: 'POST',
path: '/crm-objects/v1/objects/tickets',
body: data,
})
}
delete(id) {
return this.client.apiRequest({
method: 'DELETE',
path: `/crm-objects/v1/objects/tickets/${id}`,
})
}
update(id, data) {
return this.client.apiRequest({
method: 'PUT',
path: `/crm-objects/v1/objects/tickets/${id}`,
body: data,
})
}
}
module.exports = Ticket

@@ -5,4 +5,10 @@ import { RequestPromise } from 'request-promise'

getAll(opts?: {}): RequestPromise
create(data: {}): RequestPromise
delete(id: number): RequestPromise
update(id: number, data: {}): RequestPromise
}
export { Ticket }
{
"name": "hubspot",
"version": "2.3.10",
"version": "2.3.11",
"description": "A node wrapper for the HubSpot API",

@@ -5,0 +5,0 @@ "engines": {

@@ -474,3 +474,24 @@ # node-hubspot

```javascript
hubspot.ticket.getAll()
const data = [
{
name: 'subject',
value: 'This is an example ticket'
},
{
name: 'content',
value: 'Here are the details of the ticket.'
},
{
name: 'hs_pipeline',
value: '0'
},
{
name: 'hs_pipeline_stage',
value: '1'
}
];
hubspot.tickets.create(data);
hubspot.tickets.getAll();
hubspot.tickets.delete(id);
hubspot.tickets.update(id, newData);
```

@@ -477,0 +498,0 @@

@@ -5,2 +5,3 @@ const chai = require('chai')

const Hubspot = require('..')
const fakeHubspotApi = require('./helpers/fake_hubspot_api')
const apiKey = { apiKey: process.env.HUBSPOT_API_KEY || 'demo' }

@@ -12,3 +13,3 @@ const hubspot = new Hubspot(apiKey)

it('should return all tickets', () => {
return hubspot.ticket.getAll().then((data) => {
return hubspot.tickets.getAll().then((data) => {
expect(data).to.be.an('object')

@@ -19,2 +20,106 @@ expect(data.objects).to.be.a('array')

})
describe('create', () => {
const newTicket = {
properties: [
{
name: 'subject',
value: 'This is an example ticket',
},
{
name: 'content',
value: 'Here are the details of the ticket.',
},
{
name: 'hs_pipeline',
value: '0',
},
{
name: 'hs_pipeline_stage',
value: '1',
},
],
}
const ticketsEndpoint = {
path: '/crm-objects/v1/objects/tickets',
request: newTicket,
response: { properties: { subject: { value: 'This is an example ticket' } } },
}
fakeHubspotApi.setupServer({
postEndpoints: [ticketsEndpoint],
demo: true,
})
if (process.env.NOCK_OFF) {
it('will not run with NOCK_OFF set to true. See commit message.')
} else {
it('should create a ticket in a given portal', () => {
return hubspot.tickets.create(newTicket).then((data) => {
expect(data).to.be.an('object')
expect(data.properties.subject.value).to.equal('This is an example ticket')
})
})
}
})
describe('delete', () => {
const id = 'fake_id'
const ticketsEndpoint = {
path: `/crm-objects/v1/objects/tickets/${id}`,
response: { success: true },
}
fakeHubspotApi.setupServer({
deleteEndpoints: [ticketsEndpoint],
demo: true,
})
if (process.env.NOCK_OFF) {
it('will not run with NOCK_OFF set to true. See commit message.')
} else {
it('can delete', () => {
return hubspot.tickets.delete(id).then((data) => {
expect(data).to.be.an('object')
expect(data.success).to.be.eq(true)
})
})
}
})
describe('update', () => {
const id = 'mock_id'
const newData = {
properties: [
{
name: 'content',
value: 'This is now an updated ticket marked as high priority.',
},
],
}
const ticketsEndpoint = {
path: `/crm-objects/v1/objects/tickets/${id}`,
request: newData,
response: { success: true },
}
fakeHubspotApi.setupServer({
putEndpoints: [ticketsEndpoint],
demo: true,
})
if (process.env.NOCK_OFF) {
it('will not run with NOCK_OFF set to true. See commit message.')
} else {
it('can update a ticket', () => {
return hubspot.tickets.update(id, newData).then((data) => {
expect(data).to.be.an('object')
expect(data.success).to.be.eq(true)
})
})
}
})
})
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc