pushpad 0.11.1 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -1
- data/LICENSE.txt +1 -1
- data/README.md +10 -8
- data/lib/pushpad/notification.rb +3 -1
- data/pushpad.gemspec +1 -1
- data/spec/pushpad/notification_spec.rb +16 -12
- metadata +7 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5ad9a17dc685ff8fe33a528b0814aec2596af0c1a6979e0750238326a3a601e5
|
4
|
+
data.tar.gz: 4eee2d3b34066a974a7d9648d834298c905a223ca4cad8e5e9092158c0a345fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e6cc505ef35a958b69d4f4763b120d3c8fda7185b447f65fe86730f92fcbf593a25ee234dc345df82d5c542eb963ada0f64e094678b9326eb34c3e4b7039b64
|
7
|
+
data.tar.gz: 9cc1392a374f64acfc747b9ed78423946773a8d6be5720a88e7ba16bb419391df2c5a8fb54bb557f57fd42050257dd7b11291bf3c017b80d6dfcb76aab7391dd
|
data/.travis.yml
CHANGED
data/LICENSE.txt
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
The MIT License (MIT)
|
2
2
|
|
3
|
-
Copyright (c) 2016 Pushpad (https://pushpad.xyz)
|
3
|
+
Copyright (c) 2016-2021 Pushpad (https://pushpad.xyz)
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
data/README.md
CHANGED
@@ -57,11 +57,12 @@ Pushpad.signature_for current_user.id
|
|
57
57
|
notification = Pushpad::Notification.new({
|
58
58
|
body: "Hello world!",
|
59
59
|
title: "Website Name", # optional, defaults to your project name
|
60
|
-
target_url: "
|
61
|
-
icon_url: "
|
62
|
-
image_url: "
|
60
|
+
target_url: "https://example.com", # optional, defaults to your project website
|
61
|
+
icon_url: "https://example.com/assets/icon.png", # optional, defaults to the project icon
|
62
|
+
image_url: "https://example.com/assets/image.png", # optional, an image to display in the notification content
|
63
63
|
ttl: 604800, # optional, drop the notification after this number of seconds if a device is offline
|
64
64
|
require_interaction: true, # optional, prevent Chrome on desktop from automatically closing the notification after a few seconds
|
65
|
+
silent: false, # optional, enable this option if you want a mute notification without any sound
|
65
66
|
urgent: false, # optional, enable this option only for time-sensitive alerts (e.g. incoming phone call)
|
66
67
|
custom_data: "123", # optional, a string that is passed as an argument to action button callbacks
|
67
68
|
# optional, add some action buttons to the notification
|
@@ -69,8 +70,8 @@ notification = Pushpad::Notification.new({
|
|
69
70
|
actions: [
|
70
71
|
{
|
71
72
|
title: "My Button 1",
|
72
|
-
target_url: "
|
73
|
-
icon: "
|
73
|
+
target_url: "https://example.com/button-link", # optional
|
74
|
+
icon: "https://example.com/assets/button-icon.png", # optional
|
74
75
|
action: "myActionName" # optional
|
75
76
|
}
|
76
77
|
],
|
@@ -114,7 +115,7 @@ The methods above return an hash:
|
|
114
115
|
|
115
116
|
- `"id"` is the id of the notification on Pushpad
|
116
117
|
- `"scheduled"` is the estimated reach of the notification (i.e. the number of devices to which the notification will be sent, which can be different from the number of users, since a user may receive notifications on multiple devices)
|
117
|
-
- `"uids"` (`deliver_to` only) are the user IDs that will be actually reached by the notification because they are subscribed to your notifications. For example if you send a notification to `['uid1', 'uid2', 'uid3']`, but only `'uid1'` is subscribed, you will get `['uid1']` in response. Note that if a user has unsubscribed after the last notification sent to him, he may still be reported for one time as subscribed (this is due to [the way](
|
118
|
+
- `"uids"` (`deliver_to` only) are the user IDs that will be actually reached by the notification because they are subscribed to your notifications. For example if you send a notification to `['uid1', 'uid2', 'uid3']`, but only `'uid1'` is subscribed, you will get `['uid1']` in response. Note that if a user has unsubscribed after the last notification sent to him, he may still be reported for one time as subscribed (this is due to [the way](https://blog.pushpad.xyz/2016/05/the-push-api-and-its-wild-unsubscription-mechanism/) the W3C Push API works).
|
118
119
|
- `"send_at"` is present only for scheduled notifications. The fields `"scheduled"` and `"uids"` are not available in this case.
|
119
120
|
|
120
121
|
The `id` and `scheduled_count` attribute are also stored on the notification object:
|
@@ -138,11 +139,12 @@ notification = Pushpad::Notification.find(42)
|
|
138
139
|
notification.id # => 42
|
139
140
|
notification.title # => "Foo Bar",
|
140
141
|
notification.body # => "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
|
141
|
-
notification.target_url # => "
|
142
|
+
notification.target_url # => "https://example.com",
|
142
143
|
notification.ttl # => 604800,
|
143
144
|
notification.require_interaction # => false,
|
145
|
+
notification.silent # => false,
|
144
146
|
notification.urgent # => false,
|
145
|
-
notification.icon_url # => "
|
147
|
+
notification.icon_url # => "https://example.com/assets/icon.png",
|
146
148
|
|
147
149
|
# `created_at` is a `Time` instance
|
148
150
|
notification.created_at.utc.to_s # => "2016-07-06 10:09:14 UTC",
|
data/lib/pushpad/notification.rb
CHANGED
@@ -12,7 +12,7 @@ module Pushpad
|
|
12
12
|
class ReadonlyError < RuntimeError
|
13
13
|
end
|
14
14
|
|
15
|
-
attr_accessor :body, :title, :target_url, :icon_url, :image_url, :ttl, :require_interaction, :urgent, :custom_data, :custom_metrics, :actions, :starred, :send_at
|
15
|
+
attr_accessor :body, :title, :target_url, :icon_url, :image_url, :ttl, :require_interaction, :silent, :urgent, :custom_data, :custom_metrics, :actions, :starred, :send_at
|
16
16
|
attr_reader :id, :created_at, :scheduled_count, :successfully_sent_count, :opened_count
|
17
17
|
|
18
18
|
def initialize(options)
|
@@ -29,6 +29,7 @@ module Pushpad
|
|
29
29
|
@image_url = options[:image_url]
|
30
30
|
@ttl = options[:ttl]
|
31
31
|
@require_interaction = options[:require_interaction]
|
32
|
+
@silent = options[:silent]
|
32
33
|
@urgent = options[:urgent]
|
33
34
|
@custom_data = options[:custom_data]
|
34
35
|
@custom_metrics = options[:custom_metrics]
|
@@ -118,6 +119,7 @@ module Pushpad
|
|
118
119
|
notification_params["image_url"] = self.image_url if self.image_url
|
119
120
|
notification_params["ttl"] = self.ttl if self.ttl
|
120
121
|
notification_params["require_interaction"] = self.require_interaction unless self.require_interaction.nil?
|
122
|
+
notification_params["silent"] = self.silent unless self.silent.nil?
|
121
123
|
notification_params["urgent"] = self.urgent unless self.urgent.nil?
|
122
124
|
notification_params["custom_data"] = self.custom_data if self.custom_data
|
123
125
|
notification_params["custom_metrics"] = self.custom_metrics if self.custom_metrics
|
data/pushpad.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
2
|
spec.name = "pushpad"
|
3
|
-
spec.version = '0.
|
3
|
+
spec.version = '0.12.0'
|
4
4
|
spec.authors = ["Pushpad"]
|
5
5
|
spec.email = ["support@pushpad.xyz"]
|
6
6
|
spec.summary = "Web push notifications for Chrome, Firefox, Opera, Edge and Safari using Pushpad."
|
@@ -55,10 +55,11 @@ module Pushpad
|
|
55
55
|
id: 5,
|
56
56
|
title: "Foo Bar",
|
57
57
|
body: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
|
58
|
-
target_url: "
|
58
|
+
target_url: "https://example.com",
|
59
59
|
created_at: "2016-07-06T10:09:14.835Z",
|
60
60
|
ttl: 604800,
|
61
61
|
require_interaction: false,
|
62
|
+
silent: false,
|
62
63
|
urgent: false,
|
63
64
|
icon_url: "https://example.com/assets/icon.png",
|
64
65
|
scheduled_count: 2,
|
@@ -109,10 +110,11 @@ module Pushpad
|
|
109
110
|
id: 5,
|
110
111
|
title: "Foo Bar",
|
111
112
|
body: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
|
112
|
-
target_url: "
|
113
|
+
target_url: "https://example.com",
|
113
114
|
created_at: "2016-07-06T10:09:14.835Z",
|
114
115
|
ttl: 604800,
|
115
116
|
require_interaction: false,
|
117
|
+
silent: false,
|
116
118
|
urgent: false,
|
117
119
|
icon_url: "https://example.com/assets/icon.png",
|
118
120
|
scheduled_count: 2,
|
@@ -274,19 +276,20 @@ module Pushpad
|
|
274
276
|
{
|
275
277
|
body: "Example message",
|
276
278
|
title: "Website Name",
|
277
|
-
target_url: "
|
278
|
-
icon_url: "
|
279
|
-
image_url: "
|
279
|
+
target_url: "https://example.com",
|
280
|
+
icon_url: "https://example.com/assets/icon.png",
|
281
|
+
image_url: "https://example.com/assets/image.png",
|
280
282
|
ttl: 604800,
|
281
283
|
require_interaction: true,
|
284
|
+
silent: true,
|
282
285
|
urgent: true,
|
283
286
|
custom_data: "123",
|
284
287
|
custom_metrics: ["examples", "another_metric"],
|
285
288
|
actions: [
|
286
289
|
{
|
287
290
|
title: "My Button 1",
|
288
|
-
target_url: "
|
289
|
-
icon: "
|
291
|
+
target_url: "https://example.com/button-link",
|
292
|
+
icon: "https://example.com/assets/button-icon.png",
|
290
293
|
action: "myActionName"
|
291
294
|
}
|
292
295
|
],
|
@@ -356,19 +359,20 @@ module Pushpad
|
|
356
359
|
{
|
357
360
|
body: "Example message",
|
358
361
|
title: "Website Name",
|
359
|
-
target_url: "
|
360
|
-
icon_url: "
|
361
|
-
image_url: "
|
362
|
+
target_url: "https://example.com",
|
363
|
+
icon_url: "https://example.com/assets/icon.png",
|
364
|
+
image_url: "https://example.com/assets/image.png",
|
362
365
|
ttl: 604800,
|
363
366
|
require_interaction: true,
|
367
|
+
silent: true,
|
364
368
|
urgent: true,
|
365
369
|
custom_data: "123",
|
366
370
|
custom_metrics: ["examples", "another_metric"],
|
367
371
|
actions: [
|
368
372
|
{
|
369
373
|
title: "My Button 1",
|
370
|
-
target_url: "
|
371
|
-
icon: "
|
374
|
+
target_url: "https://example.com/button-link",
|
375
|
+
icon: "https://example.com/assets/button-icon.png",
|
372
376
|
action: "myActionName"
|
373
377
|
}
|
374
378
|
],
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pushpad
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pushpad
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -38,7 +38,7 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
-
description:
|
41
|
+
description:
|
42
42
|
email:
|
43
43
|
- support@pushpad.xyz
|
44
44
|
executables: []
|
@@ -66,7 +66,7 @@ homepage: https://pushpad.xyz
|
|
66
66
|
licenses:
|
67
67
|
- MIT
|
68
68
|
metadata: {}
|
69
|
-
post_install_message:
|
69
|
+
post_install_message:
|
70
70
|
rdoc_options: []
|
71
71
|
require_paths:
|
72
72
|
- lib
|
@@ -81,9 +81,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
requirements: []
|
84
|
-
|
85
|
-
|
86
|
-
signing_key:
|
84
|
+
rubygems_version: 3.0.3
|
85
|
+
signing_key:
|
87
86
|
specification_version: 4
|
88
87
|
summary: Web push notifications for Chrome, Firefox, Opera, Edge and Safari using
|
89
88
|
Pushpad.
|