pushpad 0.12.0 → 1.0.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5ad9a17dc685ff8fe33a528b0814aec2596af0c1a6979e0750238326a3a601e5
4
- data.tar.gz: 4eee2d3b34066a974a7d9648d834298c905a223ca4cad8e5e9092158c0a345fb
3
+ metadata.gz: 48d7160263b210c7897b4171bb69b21916e155e3e3c5c252a23ab99f0d64252d
4
+ data.tar.gz: e06bc7a3e1d946403e45cc4ed57672d1fd97e4076d9d0538bf42ba7b13a5aaf1
5
5
  SHA512:
6
- metadata.gz: 3e6cc505ef35a958b69d4f4763b120d3c8fda7185b447f65fe86730f92fcbf593a25ee234dc345df82d5c542eb963ada0f64e094678b9326eb34c3e4b7039b64
7
- data.tar.gz: 9cc1392a374f64acfc747b9ed78423946773a8d6be5720a88e7ba16bb419391df2c5a8fb54bb557f57fd42050257dd7b11291bf3c017b80d6dfcb76aab7391dd
6
+ metadata.gz: 33bc016ccd42f4ea8cced6e3b0a98e91c22c196ff1481b504f64ae231ec0ff0d67c4e47bd5fb5fd0ab42c544d3d97e559893ed85d71cce7057e355a5d138863e
7
+ data.tar.gz: 927b49b786b2ed3114d6a1c8b88dddcea72a21c6688a4bc9adc51e6206a5a0d6229134fdaace40c7687e957f0eba3a7045edb1e512ccfac4436568704bcdf803
@@ -0,0 +1,22 @@
1
+ name: CI
2
+ on:
3
+ push:
4
+ branches: [ master ]
5
+ pull_request:
6
+ branches: [ master ]
7
+ jobs:
8
+ test:
9
+ runs-on: ubuntu-latest
10
+ strategy:
11
+ fail-fast: false
12
+ matrix:
13
+ ruby-version: ['2.7', '3.0', '3.1']
14
+ steps:
15
+ - uses: actions/checkout@v3
16
+ - name: Set up Ruby
17
+ uses: ruby/setup-ruby@v1
18
+ with:
19
+ ruby-version: ${{ matrix.ruby-version }}
20
+ bundler-cache: true
21
+ - name: Run tests
22
+ run: bundle exec rspec
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2016-2021 Pushpad (https://pushpad.xyz)
3
+ Copyright (c) 2016-2022 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
@@ -1,9 +1,9 @@
1
1
  # Pushpad - Web Push Notifications
2
2
 
3
- [![Build Status](https://travis-ci.org/pushpad/pushpad-ruby.svg?branch=master)](https://travis-ci.org/pushpad/pushpad-ruby)
4
3
  [![Gem Version](https://badge.fury.io/rb/pushpad.svg)](https://badge.fury.io/rb/pushpad)
4
+ ![Build Status](https://github.com/pushpad/pushpad-ruby/workflows/CI/badge.svg)
5
5
 
6
- [Pushpad](https://pushpad.xyz) is a service for sending push notifications from your web app. It supports the **Push API** (Chrome, Firefox, Opera, Edge) and **APNs** (Safari).
6
+ [Pushpad](https://pushpad.xyz) is a service for sending push notifications from your web app. It supports the **Push API** (Chrome, Firefox, Opera, Edge) and **APNs** (Safari desktop). iOS support is coming in 2023.
7
7
 
8
8
  Features:
9
9
 
@@ -59,6 +59,7 @@ notification = Pushpad::Notification.new({
59
59
  title: "Website Name", # optional, defaults to your project name
60
60
  target_url: "https://example.com", # optional, defaults to your project website
61
61
  icon_url: "https://example.com/assets/icon.png", # optional, defaults to the project icon
62
+ badge_url: "https://example.com/assets/badge.png", # optional, defaults to the project badge
62
63
  image_url: "https://example.com/assets/image.png", # optional, an image to display in the notification content
63
64
  ttl: 604800, # optional, drop the notification after this number of seconds if a device is offline
64
65
  require_interaction: true, # optional, prevent Chrome on desktop from automatically closing the notification after a few seconds
@@ -137,21 +138,22 @@ notification = Pushpad::Notification.find(42)
137
138
 
138
139
  # get basic attributes
139
140
  notification.id # => 42
140
- notification.title # => "Foo Bar",
141
- notification.body # => "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
142
- notification.target_url # => "https://example.com",
143
- notification.ttl # => 604800,
144
- notification.require_interaction # => false,
145
- notification.silent # => false,
146
- notification.urgent # => false,
147
- notification.icon_url # => "https://example.com/assets/icon.png",
141
+ notification.title # => "Foo Bar"
142
+ notification.body # => "Lorem ipsum dolor sit amet, consectetur adipiscing elit."
143
+ notification.target_url # => "https://example.com"
144
+ notification.ttl # => 604800
145
+ notification.require_interaction # => false
146
+ notification.silent # => false
147
+ notification.urgent # => false
148
+ notification.icon_url # => "https://example.com/assets/icon.png"
149
+ notification.badge_url # => "https://example.com/assets/badge.png"
148
150
 
149
151
  # `created_at` is a `Time` instance
150
- notification.created_at.utc.to_s # => "2016-07-06 10:09:14 UTC",
152
+ notification.created_at.utc.to_s # => "2016-07-06 10:09:14 UTC"
151
153
 
152
154
  # get statistics
153
155
  notification.scheduled_count # => 1
154
- notification.successfully_sent_count # => 4,
156
+ notification.successfully_sent_count # => 4
155
157
  notification.opened_count # => 2
156
158
  ```
157
159
 
@@ -162,7 +164,7 @@ notifications = Pushpad::Notification.find_all(project_id: 5)
162
164
 
163
165
  # same attributes as for single notification in example above
164
166
  notifications[0].id # => 42
165
- notifications[0].title # => "Foo Bar",
167
+ notifications[0].title # => "Foo Bar"
166
168
  ```
167
169
 
168
170
  If `Pushpad.project_id` is defined, the `project_id` option can be
@@ -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, :silent, :urgent, :custom_data, :custom_metrics, :actions, :starred, :send_at
15
+ attr_accessor :body, :title, :target_url, :icon_url, :badge_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)
@@ -26,6 +26,7 @@ module Pushpad
26
26
  @title = options[:title]
27
27
  @target_url = options[:target_url]
28
28
  @icon_url = options[:icon_url]
29
+ @badge_url = options[:badge_url]
29
30
  @image_url = options[:image_url]
30
31
  @ttl = options[:ttl]
31
32
  @require_interaction = options[:require_interaction]
@@ -116,6 +117,7 @@ module Pushpad
116
117
  notification_params["title"] = self.title if self.title
117
118
  notification_params["target_url"] = self.target_url if self.target_url
118
119
  notification_params["icon_url"] = self.icon_url if self.icon_url
120
+ notification_params["badge_url"] = self.badge_url if self.badge_url
119
121
  notification_params["image_url"] = self.image_url if self.image_url
120
122
  notification_params["ttl"] = self.ttl if self.ttl
121
123
  notification_params["require_interaction"] = self.require_interaction unless self.require_interaction.nil?
data/lib/pushpad.rb CHANGED
@@ -26,7 +26,7 @@ module Pushpad
26
26
 
27
27
  def self.signature_for(data)
28
28
  raise "You must set Pushpad.auth_token" unless Pushpad.auth_token
29
- OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha1'), self.auth_token, data.to_s)
29
+ OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha256'), self.auth_token, data.to_s)
30
30
  end
31
31
 
32
32
  end
data/pushpad.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "pushpad"
3
- spec.version = '0.12.0'
3
+ spec.version = '1.0.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."
@@ -62,6 +62,7 @@ module Pushpad
62
62
  silent: false,
63
63
  urgent: false,
64
64
  icon_url: "https://example.com/assets/icon.png",
65
+ badge_url: "https://example.com/assets/badge.png",
65
66
  scheduled_count: 2,
66
67
  successfully_sent_count: 4,
67
68
  opened_count: 1
@@ -117,6 +118,7 @@ module Pushpad
117
118
  silent: false,
118
119
  urgent: false,
119
120
  icon_url: "https://example.com/assets/icon.png",
121
+ badge_url: "https://example.com/assets/badge.png",
120
122
  scheduled_count: 2,
121
123
  successfully_sent_count: 4,
122
124
  opened_count: 1
@@ -278,6 +280,7 @@ module Pushpad
278
280
  title: "Website Name",
279
281
  target_url: "https://example.com",
280
282
  icon_url: "https://example.com/assets/icon.png",
283
+ badge_url: "https://example.com/assets/badge.png",
281
284
  image_url: "https://example.com/assets/image.png",
282
285
  ttl: 604800,
283
286
  require_interaction: true,
@@ -361,6 +364,7 @@ module Pushpad
361
364
  title: "Website Name",
362
365
  target_url: "https://example.com",
363
366
  icon_url: "https://example.com/assets/icon.png",
367
+ badge_url: "https://example.com/assets/badge.png",
364
368
  image_url: "https://example.com/assets/image.png",
365
369
  ttl: 604800,
366
370
  require_interaction: true,
data/spec/pushpad_spec.rb CHANGED
@@ -16,9 +16,9 @@ describe Pushpad do
16
16
  end
17
17
 
18
18
  describe "#signature_for" do
19
- it "produces the hex-encoded HMAC-SHA1 signature for the data passed as argument" do
19
+ it "produces the hex-encoded HMAC-SHA256 signature for the data passed as argument" do
20
20
  signature = Pushpad.signature_for('myuid1')
21
- expect(signature).to eq '27fbe136f5a4aa0b6be74c0e18fa8ce81ad91b60'
21
+ expect(signature).to eq 'd213a2f146dd9aae9cb935b5233d42fecc9414e2b0e98896af7a43e7fce3ef31'
22
22
  end
23
23
  end
24
24
  end
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.12.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pushpad
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-24 00:00:00.000000000 Z
11
+ date: 2022-11-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -45,9 +45,9 @@ executables: []
45
45
  extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
+ - ".github/workflows/ci.yml"
48
49
  - ".gitignore"
49
50
  - ".rspec"
50
- - ".travis.yml"
51
51
  - Gemfile
52
52
  - LICENSE.txt
53
53
  - README.md
@@ -81,7 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  requirements: []
84
- rubygems_version: 3.0.3
84
+ rubygems_version: 3.3.26
85
85
  signing_key:
86
86
  specification_version: 4
87
87
  summary: Web push notifications for Chrome, Firefox, Opera, Edge and Safari using
data/.travis.yml DELETED
@@ -1,5 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.6
4
- - 2.7
5
- - 3.0