lorkhan 2.0.1 → 3.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 +4 -4
- data/lib/lorkhan/notification.rb +12 -19
- data/lib/lorkhan/request.rb +2 -0
- data/lib/lorkhan/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 579c8aa0126f3be8b33931db4c47f1ed6c63b9da86d5005f06cb382394da4ebc
|
4
|
+
data.tar.gz: 588b4a5c011f1d4bba98cd8379a61cf9ea8e8e75eea45765ba88236b1e54d630
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 964f0a78fac49b85c180fea4364c10ac61aa8df8654d2ec61826cfc8a4334006ac1e6927339983cb5005a45a3fcf2e5f1526315e667332eb0c44854acec3c479
|
7
|
+
data.tar.gz: 46453f5186c7f347bda2397c2a34c534fbf2943556eaeff5427abc12076571a9a301cfedd279e0ea45a8bf13f2bae21327238dae0c2842943cf2c1743a7b12e6
|
data/lib/lorkhan/notification.rb
CHANGED
@@ -49,18 +49,20 @@ module Lorkhan
|
|
49
49
|
|
50
50
|
DEFAULT_SOUND_NAME = 'default'.freeze
|
51
51
|
|
52
|
-
attr_reader :token, :apns_id, :priority, :alert, :content_available
|
52
|
+
attr_reader :token, :apns_id, :priority, :alert, :content_available, :topic
|
53
53
|
attr_accessor :custom_payload, :badge, :sound, :category, :url_args, :mutable_content
|
54
|
-
attr_accessor :expiration, :
|
54
|
+
attr_accessor :expiration, :collapse_id
|
55
55
|
|
56
56
|
##
|
57
57
|
# Create a new notification
|
58
58
|
#
|
59
59
|
# token: The Device token that the notification will be delivered to
|
60
60
|
##
|
61
|
-
def initialize(token)
|
61
|
+
def initialize(id, topic, token)
|
62
|
+
@id = id
|
62
63
|
@token = token
|
63
|
-
@
|
64
|
+
@topic = topic
|
65
|
+
@apns_id = id || SecureRandom.uuid
|
64
66
|
@expiration = 0
|
65
67
|
@content_available = false
|
66
68
|
@priority = PRIORITY_DELIVER_IMMEDIATELY
|
@@ -78,33 +80,24 @@ module Lorkhan
|
|
78
80
|
|
79
81
|
def alert=(alert)
|
80
82
|
@alert = alert
|
81
|
-
if @alert
|
82
|
-
@content_available = false
|
83
|
-
@priority = PRIORITY_DELIVER_IMMEDIATELY
|
84
|
-
end
|
83
|
+
@priority = PRIORITY_DELIVER_IMMEDIATELY if @alert
|
85
84
|
end
|
86
85
|
|
87
86
|
def content_available=(content_available)
|
88
87
|
@content_available = content_available
|
89
|
-
if content_available == true
|
90
|
-
@alert = nil
|
91
|
-
@priority = PRIORITY_DELIVER_BACKGROUND
|
92
|
-
end
|
88
|
+
@priority = PRIORITY_DELIVER_BACKGROUND if content_available == true
|
93
89
|
end
|
94
90
|
|
95
91
|
def to_h
|
96
92
|
{}.tap do |root|
|
97
93
|
root[:aps] = {}.tap do |aps|
|
98
|
-
if
|
99
|
-
|
100
|
-
|
101
|
-
aps[:alert] = alert if alert
|
102
|
-
aps[:badge] = badge if badge
|
103
|
-
aps[:sound] = sound if sound
|
104
|
-
end
|
94
|
+
aps[:alert] = alert if alert
|
95
|
+
aps[:badge] = badge if badge
|
96
|
+
aps[:sound] = sound if sound
|
105
97
|
aps[:category] = category if category
|
106
98
|
aps['url-args'] = url_args if url_args
|
107
99
|
aps['mutable-content'] = 1 if mutable_content
|
100
|
+
aps['content-available'] = 1 if content_available
|
108
101
|
end
|
109
102
|
root.merge!(custom_payload) if custom_payload
|
110
103
|
end
|
data/lib/lorkhan/request.rb
CHANGED
data/lib/lorkhan/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lorkhan
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maddie Schipper
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-10-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: connection_pool
|