pushpad 0.11.0 → 0.11.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +3 -3
- data/lib/pushpad/notification.rb +3 -3
- data/lib/pushpad/subscription.rb +1 -1
- data/pushpad.gemspec +1 -1
- data/spec/pushpad/notification_spec.rb +6 -6
- data/spec/pushpad/subscription_spec.rb +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: c0f05f2f24a86d00d4d1e13e436eae9f610d8dc57daa43b870f87b651a485b8c
|
4
|
+
data.tar.gz: 6b29277e18ee9d4b0fac014b80883faf9895f76847cb889cd81efaae9b723ce4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3dae98b1e646c1d50324d2a11d619a3ab89c3fda58bdaa99e3d999c0d1a370eee8920369281395601cd07b29a027a12d5bf5e1b062ce139e7b6499a5fc8cb156
|
7
|
+
data.tar.gz: 154f7121f0da043d7677dedc9fec25bd892ea247fe36f92743db9dc5e7a8e85175f312db6ed7f1fe13bbbc4051a4b3a56f0363b48aaacaabbb4456062a5153f4
|
data/README.md
CHANGED
@@ -55,8 +55,8 @@ Pushpad.signature_for current_user.id
|
|
55
55
|
|
56
56
|
```ruby
|
57
57
|
notification = Pushpad::Notification.new({
|
58
|
-
body: "Hello world!",
|
59
|
-
title: "Website Name", # optional, defaults to your project name
|
58
|
+
body: "Hello world!",
|
59
|
+
title: "Website Name", # optional, defaults to your project name
|
60
60
|
target_url: "http://example.com", # optional, defaults to your project website
|
61
61
|
icon_url: "http://example.com/assets/icon.png", # optional, defaults to the project icon
|
62
62
|
image_url: "http://example.com/assets/image.png", # optional, an image to display in the notification content
|
@@ -68,7 +68,7 @@ notification = Pushpad::Notification.new({
|
|
68
68
|
# see https://pushpad.xyz/docs/action_buttons
|
69
69
|
actions: [
|
70
70
|
{
|
71
|
-
title: "My Button 1",
|
71
|
+
title: "My Button 1",
|
72
72
|
target_url: "http://example.com/button-link", # optional
|
73
73
|
icon: "http://example.com/assets/button-icon.png", # optional
|
74
74
|
action: "myActionName" # optional
|
data/lib/pushpad/notification.rb
CHANGED
@@ -38,7 +38,7 @@ module Pushpad
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def self.find(id)
|
41
|
-
response = Request.get("https://pushpad.xyz/notifications/#{id}")
|
41
|
+
response = Request.get("https://pushpad.xyz/api/v1/notifications/#{id}")
|
42
42
|
|
43
43
|
unless response.code == "200"
|
44
44
|
raise FindError, "Response #{response.code} #{response.message}: #{response.body}"
|
@@ -54,7 +54,7 @@ module Pushpad
|
|
54
54
|
query_parameters = {}
|
55
55
|
query_parameters[:page] = options[:page] if options.key?(:page)
|
56
56
|
|
57
|
-
response = Request.get("https://pushpad.xyz/projects/#{project_id}/notifications",
|
57
|
+
response = Request.get("https://pushpad.xyz/api/v1/projects/#{project_id}/notifications",
|
58
58
|
query_parameters: query_parameters)
|
59
59
|
|
60
60
|
unless response.code == "200"
|
@@ -97,7 +97,7 @@ module Pushpad
|
|
97
97
|
project_id = options[:project_id] || Pushpad.project_id
|
98
98
|
raise "You must set project_id" unless project_id
|
99
99
|
|
100
|
-
endpoint = "https://pushpad.xyz/projects/#{project_id}/notifications"
|
100
|
+
endpoint = "https://pushpad.xyz/api/v1/projects/#{project_id}/notifications"
|
101
101
|
response = Request.post(endpoint, req_body)
|
102
102
|
|
103
103
|
unless response.code == "201"
|
data/lib/pushpad/subscription.rb
CHANGED
@@ -18,7 +18,7 @@ module Pushpad
|
|
18
18
|
project_id = options[:project_id] || Pushpad.project_id
|
19
19
|
raise "You must set project_id" unless project_id
|
20
20
|
|
21
|
-
endpoint = "https://pushpad.xyz/projects/#{project_id}/subscriptions"
|
21
|
+
endpoint = "https://pushpad.xyz/api/v1/projects/#{project_id}/subscriptions"
|
22
22
|
response = Request.head(endpoint, query_parameters: query_parameters)
|
23
23
|
|
24
24
|
unless response.code == "200"
|
data/pushpad.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
2
|
spec.name = "pushpad"
|
3
|
-
spec.version = '0.11.
|
3
|
+
spec.version = '0.11.1'
|
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."
|
@@ -7,35 +7,35 @@ module Pushpad
|
|
7
7
|
let(:notification) { Pushpad::Notification.new body: "Example message" }
|
8
8
|
|
9
9
|
def stub_notification_get(attributes)
|
10
|
-
stub_request(:get, "https://pushpad.xyz/notifications/#{attributes[:id]}").
|
10
|
+
stub_request(:get, "https://pushpad.xyz/api/v1/notifications/#{attributes[:id]}").
|
11
11
|
to_return(status: 200, body: attributes.to_json)
|
12
12
|
end
|
13
13
|
|
14
14
|
def stub_failing_notification_get(notification_id)
|
15
|
-
stub_request(:get, "https://pushpad.xyz/notifications/#{notification_id}").
|
15
|
+
stub_request(:get, "https://pushpad.xyz/api/v1/notifications/#{notification_id}").
|
16
16
|
to_return(status: 404)
|
17
17
|
end
|
18
18
|
|
19
19
|
def stub_notifications_get(options)
|
20
|
-
stub_request(:get, "https://pushpad.xyz/projects/#{options[:project_id]}/notifications").
|
20
|
+
stub_request(:get, "https://pushpad.xyz/api/v1/projects/#{options[:project_id]}/notifications").
|
21
21
|
with(query: hash_including(options.fetch(:query, {}))).
|
22
22
|
to_return(status: 200, body: options[:list].to_json)
|
23
23
|
end
|
24
24
|
|
25
25
|
def stub_failing_notifications_get(options)
|
26
|
-
stub_request(:get, "https://pushpad.xyz/projects/#{options[:project_id]}/notifications").
|
26
|
+
stub_request(:get, "https://pushpad.xyz/api/v1/projects/#{options[:project_id]}/notifications").
|
27
27
|
to_return(status: 403)
|
28
28
|
end
|
29
29
|
|
30
30
|
def stub_notification_post(project_id, params = {}, response_body = "{}")
|
31
31
|
|
32
|
-
stub_request(:post, "https://pushpad.xyz/projects/#{project_id}/notifications").
|
32
|
+
stub_request(:post, "https://pushpad.xyz/api/v1/projects/#{project_id}/notifications").
|
33
33
|
with(body: hash_including(params)).
|
34
34
|
to_return(status: 201, body: response_body)
|
35
35
|
end
|
36
36
|
|
37
37
|
def stub_failing_notification_post(project_id)
|
38
|
-
stub_request(:post, "https://pushpad.xyz/projects/#{project_id}/notifications").
|
38
|
+
stub_request(:post, "https://pushpad.xyz/api/v1/projects/#{project_id}/notifications").
|
39
39
|
to_return(status: 403)
|
40
40
|
end
|
41
41
|
|
@@ -3,14 +3,14 @@ require "spec_helper"
|
|
3
3
|
module Pushpad
|
4
4
|
describe Subscription do
|
5
5
|
def stub_subscriptions_head(options)
|
6
|
-
stub_request(:head, "https://pushpad.xyz/projects/#{options[:project_id]}/subscriptions").
|
6
|
+
stub_request(:head, "https://pushpad.xyz/api/v1/projects/#{options[:project_id]}/subscriptions").
|
7
7
|
with(query: hash_including(options.fetch(:query, {}))).
|
8
8
|
to_return(status: 200,
|
9
9
|
headers: { "X-Total-Count" => options.fetch(:total_count, 10) })
|
10
10
|
end
|
11
11
|
|
12
12
|
def stub_failing_subscriptions_head(options)
|
13
|
-
stub_request(:head, "https://pushpad.xyz/projects/#{options[:project_id]}/subscriptions").
|
13
|
+
stub_request(:head, "https://pushpad.xyz/api/v1/projects/#{options[:project_id]}/subscriptions").
|
14
14
|
to_return(status: 503)
|
15
15
|
end
|
16
16
|
|
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.11.
|
4
|
+
version: 0.11.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pushpad
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-02-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -82,7 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
82
82
|
version: '0'
|
83
83
|
requirements: []
|
84
84
|
rubyforge_project:
|
85
|
-
rubygems_version: 2.
|
85
|
+
rubygems_version: 2.7.6
|
86
86
|
signing_key:
|
87
87
|
specification_version: 4
|
88
88
|
summary: Web push notifications for Chrome, Firefox, Opera, Edge and Safari using
|