maia 4.0.0 → 4.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 1f16e5e9cba3546a3653e1fd2e3f87d19fa46784
4
- data.tar.gz: aa5f6350dd17689e8dd01c999c3f509680b73e80
2
+ SHA256:
3
+ metadata.gz: 34b80024536d89e766bb44b64eaa13a75cdb7d63574b465ee5a0ea30749c09ee
4
+ data.tar.gz: 33bc3caff54507d8c67381c127cbb0d55a0c11922fe12324f2be4cde0dcea65b
5
5
  SHA512:
6
- metadata.gz: 51ae47908f1ae0e3a1e0b04eb3812023a20db60276b07fa2156583b325191ea7c3231057d0f461c36832dcfd9db6d37c831b10f1a58f5e2cd304431197f4ad71
7
- data.tar.gz: 1bbdf160cdeaefebd160966ad92c39ec18d795af55a2e0e4ec291b91e8af91dd199e0d1374cda1bea091f29f150a8f523584221c505274d12cd1ad72f9c82a9c
6
+ metadata.gz: 500a847f93b858a4741723873e3f8f8c12c12333b4433bd438c0294bdad713acd8633649f79966a9ef6f14816a176c4e914774e287c516dc375b70743e75dba1
7
+ data.tar.gz: 8e4f7e73d51e2f30f64500d4cbd9052d15e2247c31fc71561debccec8d6fcfcb14f6f0ed5b54d01f7871635d4283ed2c824c73eef02f36bb11dae0555ced915f
@@ -25,7 +25,7 @@ module Maia
25
25
  end
26
26
 
27
27
  def find_device(token = params[:device][:token])
28
- current_user.devices.find_by token: token
28
+ current_user.devices.find_by! token: token
29
29
  end
30
30
 
31
31
  def update_device(device)
@@ -11,18 +11,18 @@ module Maia
11
11
 
12
12
  def deliver(notification, *tokens, topic: nil)
13
13
  responses = ResponseCollection.new notification
14
- responses << deliver_all(notification, tokens)
15
- responses << deliver_all(notification, topic) if topic
14
+ responses << deliver_to_tokens(notification, tokens)
15
+ responses << deliver_to_topic(notification, topic) if topic
16
16
  responses
17
17
  end
18
18
 
19
19
  private
20
- def deliver_all(notification, recipients)
21
- batch(recipients).map do |batch|
22
- if batch.many?
23
- multicast notification, batch
24
- elsif batch.one?
20
+ def deliver_to_tokens(notification, tokens)
21
+ batch(tokens).map do |batch|
22
+ if batch.one?
25
23
  unicast notification, batch.first
24
+ elsif batch.many?
25
+ multicast notification, batch
26
26
  end
27
27
  end
28
28
  end
@@ -35,6 +35,10 @@ module Maia
35
35
  deliver! notification, recipients, registration_ids: recipients
36
36
  end
37
37
 
38
+ def deliver_to_topic(notification, topic)
39
+ deliver! notification, [], topic: topic
40
+ end
41
+
38
42
  def deliver!(notification, recipients, params = {})
39
43
  payload = notification.to_h.merge params
40
44
  Response.new @connection.write(payload), Array(recipients)
@@ -1,3 +1,3 @@
1
1
  module Maia
2
- VERSION = '4.0.0'.freeze
2
+ VERSION = '4.0.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: maia
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 4.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Logan Serman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-01 00:00:00.000000000 Z
11
+ date: 2019-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -92,48 +92,6 @@ dependencies:
92
92
  - - ">="
93
93
  - !ruby/object:Gem::Version
94
94
  version: '0'
95
- - !ruby/object:Gem::Dependency
96
- name: capybara
97
- requirement: !ruby/object:Gem::Requirement
98
- requirements:
99
- - - ">="
100
- - !ruby/object:Gem::Version
101
- version: '0'
102
- type: :development
103
- prerelease: false
104
- version_requirements: !ruby/object:Gem::Requirement
105
- requirements:
106
- - - ">="
107
- - !ruby/object:Gem::Version
108
- version: '0'
109
- - !ruby/object:Gem::Dependency
110
- name: capybara-webkit
111
- requirement: !ruby/object:Gem::Requirement
112
- requirements:
113
- - - ">="
114
- - !ruby/object:Gem::Version
115
- version: '0'
116
- type: :development
117
- prerelease: false
118
- version_requirements: !ruby/object:Gem::Requirement
119
- requirements:
120
- - - ">="
121
- - !ruby/object:Gem::Version
122
- version: '0'
123
- - !ruby/object:Gem::Dependency
124
- name: launchy
125
- requirement: !ruby/object:Gem::Requirement
126
- requirements:
127
- - - ">="
128
- - !ruby/object:Gem::Version
129
- version: '0'
130
- type: :development
131
- prerelease: false
132
- version_requirements: !ruby/object:Gem::Requirement
133
- requirements:
134
- - - ">="
135
- - !ruby/object:Gem::Version
136
- version: '0'
137
95
  - !ruby/object:Gem::Dependency
138
96
  name: webmock
139
97
  requirement: !ruby/object:Gem::Requirement
@@ -216,7 +174,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
216
174
  version: '0'
217
175
  requirements: []
218
176
  rubyforge_project:
219
- rubygems_version: 2.6.11
177
+ rubygems_version: 2.7.7
220
178
  signing_key:
221
179
  specification_version: 4
222
180
  summary: Manage device tokens and push messaging with Rails and FCM.