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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 337e54646581dcc1694dd56be3c7e12450053f5aa1e08bb1fc0b051cbd91df7d
4
- data.tar.gz: 6ff5e452f8de466346a8ec80c3909f6f5dd217f684d4a4b14f233d8c2d8ec9a1
3
+ metadata.gz: 579c8aa0126f3be8b33931db4c47f1ed6c63b9da86d5005f06cb382394da4ebc
4
+ data.tar.gz: 588b4a5c011f1d4bba98cd8379a61cf9ea8e8e75eea45765ba88236b1e54d630
5
5
  SHA512:
6
- metadata.gz: 8bc105281afb3a49260743d65b683da32744b0b15f1af0f9d75973116e8552392ce001782b18cc19f766aa42785d80d5faf2ce0f6cbd460059f1188c20cdd897
7
- data.tar.gz: 2573918a34e7fae7089bcf14f569ef2556729e402f5fe115c4690b4ba38610e646ba219b228df69e2dc5e0d62430089c2c41b85da896dd1b51e2b7b8d799f09a
6
+ metadata.gz: 964f0a78fac49b85c180fea4364c10ac61aa8df8654d2ec61826cfc8a4334006ac1e6927339983cb5005a45a3fcf2e5f1526315e667332eb0c44854acec3c479
7
+ data.tar.gz: 46453f5186c7f347bda2397c2a34c534fbf2943556eaeff5427abc12076571a9a301cfedd279e0ea45a8bf13f2bae21327238dae0c2842943cf2c1743a7b12e6
@@ -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, :topic, :collapse_id
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
- @apns_id = SecureRandom.uuid
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 content_available
99
- aps['content-available'] = 1
100
- else
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
@@ -1,4 +1,6 @@
1
1
  module Lorkhan
2
+ ##
3
+ # @private
2
4
  class Request
3
5
  attr_reader :path, :headers, :body
4
6
 
@@ -1,3 +1,3 @@
1
1
  module Lorkhan
2
- VERSION = '2.0.1'.freeze
2
+ VERSION = '3.0.0'.freeze
3
3
  end
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: 2.0.1
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-09-24 00:00:00.000000000 Z
11
+ date: 2019-10-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: connection_pool