pusher 5.1.3 → 5.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 5.2.0
4
+
5
+ - [CHANGED] Remove old notification references. It's no longer being used
6
+
3
7
  ## 5.1.3
4
8
 
5
9
  [FIXED] Parsing of the extraTokens in webhook's isValid method
package/lib/pusher.js CHANGED
@@ -9,7 +9,6 @@ const requests = require("./requests")
9
9
  const PusherConfig = require("./pusher_config")
10
10
  const Token = require("./token")
11
11
  const WebHook = require("./webhook")
12
- const NotificationClient = require("./notification_client")
13
12
 
14
13
  const validateChannel = function (channel) {
15
14
  if (
@@ -52,10 +51,8 @@ const validateUserData = function (userData) {
52
51
  * @constructor
53
52
  * @param {Object} options
54
53
  * @param {String} [options.host="api.pusherapp.com"] API hostname
55
- * @param {String} [options.notification_host="api.pusherapp.com"] Notification API hostname
56
54
  * @param {Boolean} [options.useTLS=false] whether to use TLS
57
55
  * @param {Boolean} [options.encrypted=false] deprecated; renamed to `useTLS`
58
- * @param {Boolean} [options.notification_encrypted=false] whether to use TLS for notifications
59
56
  * @param {Integer} [options.port] port, default depends on the scheme
60
57
  * @param {Integer} options.appId application ID
61
58
  * @param {String} options.key application key
@@ -65,11 +62,6 @@ const validateUserData = function (userData) {
65
62
  */
66
63
  function Pusher(options) {
67
64
  this.config = new PusherConfig(options)
68
- const notificationOptions = Object.assign({}, options, {
69
- host: options.notificationHost,
70
- encrypted: options.notificationEncrypted,
71
- })
72
- this.notificationClient = new NotificationClient(notificationOptions)
73
65
  }
74
66
 
75
67
  /** Create a Pusher instance using a URL.
@@ -237,10 +229,6 @@ Pusher.prototype.triggerBatch = function (batch) {
237
229
  return events.triggerBatch(this, batch)
238
230
  }
239
231
 
240
- Pusher.prototype.notify = function () {
241
- this.notificationClient.notify.apply(this.notificationClient, arguments)
242
- }
243
-
244
232
  /** Makes a POST request to Pusher, handles the authentication.
245
233
  *
246
234
  * Returns a promise resolving to a response, or rejecting to a RequestError.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pusher",
3
3
  "description": "Node.js client to interact with the Pusher Channels REST API",
4
- "version": "5.1.3",
4
+ "version": "5.2.0",
5
5
  "author": "Pusher <support@pusher.com>",
6
6
  "contributors": [
7
7
  {
@@ -1,25 +0,0 @@
1
- const requests = require("./requests")
2
- const NotificationConfig = require("./notification_config")
3
-
4
- function NotificationClient(options) {
5
- this.config = new NotificationConfig(options)
6
- }
7
-
8
- NotificationClient.prototype.notify = function (interests, notification) {
9
- if (!Array.isArray(interests)) {
10
- throw new Error("Interests must be an array")
11
- }
12
-
13
- if (interests.length == 0) {
14
- throw new Error("Interests array must not be empty")
15
- }
16
-
17
- const body = Object.assign({ interests: interests }, notification)
18
- return requests.send(this.config, {
19
- method: "POST",
20
- body: body,
21
- path: "/notifications",
22
- })
23
- }
24
-
25
- module.exports = NotificationClient
@@ -1,18 +0,0 @@
1
- const Config = require("./config")
2
-
3
- const DEFAULT_HOST = "nativepush-cluster1.pusher.com"
4
- const API_PREFIX = "server_api"
5
- const API_VERSION = "v1"
6
-
7
- function NotificationConfig(options) {
8
- Config.call(this, options)
9
- this.host = options.host || DEFAULT_HOST
10
- }
11
-
12
- Object.assign(NotificationConfig.prototype, Config.prototype)
13
-
14
- NotificationConfig.prototype.prefixPath = function (subPath) {
15
- return "/" + API_PREFIX + "/" + API_VERSION + "/apps/" + this.appId + subPath
16
- }
17
-
18
- module.exports = NotificationConfig
@@ -1,49 +0,0 @@
1
- const expect = require("expect.js")
2
- const NotificationClient = require("../../../lib/notification_client")
3
- const nock = require("nock")
4
-
5
- describe("NativeNotificationClient", function () {
6
- let client
7
-
8
- beforeEach(function () {
9
- client = new NotificationClient({
10
- appId: 1234,
11
- key: "f00d",
12
- secret: "tofu",
13
- })
14
- nock.cleanAll()
15
- nock.disableNetConnect()
16
- })
17
-
18
- afterEach(function () {
19
- nock.cleanAll()
20
- nock.enableNetConnect()
21
- })
22
-
23
- xit("should send in the success case", function (done) {
24
- const mock = nock("nativepush-cluster1.pusher.com:80")
25
- client.notify(
26
- ["yolo"],
27
- {
28
- apns: {
29
- aps: {
30
- alert: {
31
- title: "yolo",
32
- body: "woot",
33
- },
34
- },
35
- },
36
- gcm: {
37
- notification: {
38
- title: "huzzah",
39
- icon: "woot",
40
- },
41
- },
42
- },
43
- function () {
44
- expect(mock.isDone()).to.be(true)
45
- done()
46
- }
47
- )
48
- })
49
- })