maia 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/maia/message.rb +7 -5
- data/lib/maia/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NzVlMDhkY2RiZjA5YjlhODlhZmFiODM0NmU4NDJhZWQxY2M4NGFhMA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NDVlNjBhZGY3MTBhYjI4MDJkYmM4NDIwN2IwMmFlM2M4ZGJjMjQyZA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YjI4MDhjMWM1ODgzMjA3MTAzMzU5ZTk4MDE2ZGQzZjViZTFmNjQyYTczZjk4
|
10
|
+
NDlkMDY5MmM0MWJiNTdhMmY3ZDJhZDI2ZTZhZmIxNjcyYTI5YjA3OGZhMjk1
|
11
|
+
OTZlODg0MGMyYjY5MGEyMGRjZTg2MGVhMTM4NDk5YzQ3YWEwMjI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NWViZTVlODljZjVjZDNiMjQzYWRmYjcyYWU5YzE4ZWJiNmQ5Nzk0MDAxNDg3
|
14
|
+
NDFkYjJmOWRhOGVlMmEwMjdkMTY5YzIzZDc4YjQzY2Q5MmMyODkxODhhMGYx
|
15
|
+
NzI1ODI5NDFmNGYyYzc3YjFkYjc1ODU4ZTY5ZmU1NGM4NGVmNGM=
|
data/lib/maia/message.rb
CHANGED
@@ -2,7 +2,7 @@ module Maia
|
|
2
2
|
class Message
|
3
3
|
MAX_TOKENS_AT_ONCE = 999
|
4
4
|
|
5
|
-
def send_to(pushable)
|
5
|
+
def send_to(pushable, wait: false)
|
6
6
|
devices =
|
7
7
|
case pushable
|
8
8
|
when ActiveRecord::Relation
|
@@ -10,15 +10,17 @@ module Maia
|
|
10
10
|
when ActiveRecord::Base
|
11
11
|
pushable.devices
|
12
12
|
else
|
13
|
-
|
13
|
+
fail 'Maia can only send to ActiveRecord objects!'
|
14
14
|
end
|
15
15
|
|
16
|
-
enqueue devices, to_h
|
16
|
+
enqueue devices, to_h, wait: wait
|
17
17
|
end
|
18
18
|
|
19
|
-
def enqueue(devices, payload)
|
19
|
+
def enqueue(devices, payload, wait: false)
|
20
|
+
worker = wait ? Maia::Messenger.set(wait: wait) : Maia::Messenger
|
21
|
+
|
20
22
|
devices.pluck(:token).each_slice(MAX_TOKENS_AT_ONCE) do |tokens|
|
21
|
-
|
23
|
+
worker.perform_later tokens, payload.deep_stringify_keys
|
22
24
|
end
|
23
25
|
end
|
24
26
|
|
data/lib/maia/version.rb
CHANGED
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: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Logan Serman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|