maia 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/maia/messenger.rb +13 -13
- 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
|
+
ZmFjZWIzOWY0YWI5M2IxOGI0YjE5NzY2N2JmODQ0ZWQ4YWRlMjdhNg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NjNkZDM3Zjc0OWVlZmQxYjE3ZTA2NGM3NzZjZjY5YzI4YzQ3MmM3Ng==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
N2E0ZDBmYzg0ZWUxY2E2Njk0NWQ0YTU5MzFmMjZmZThmZjM0MmIwYjNlODNl
|
10
|
+
NDViZWY0ZGZkOGFhZDY1N2EzZDZlN2YzZTljMzg5ZDc2YzcwNjBlZTk0ZDM5
|
11
|
+
ZjdjMTBhNWNjOTViZDQwYmQzMmY2MTVjNmQ1MDNjMmYyY2U5ZDg=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NjBkYjk4MjQyNmQ5YjVmYmZkMDNhOTkzZDYzZGYzODhlZGRlOWJlN2I4OTNk
|
14
|
+
YWIxZmVhZTYxYTIzZTA5MDZiODI2ZjI1MDQxOTY4M2UwNDg4YWM2MjRkODRj
|
15
|
+
ZjFjMzFlNDg0ODFhNTAwNjMwZWE1MjBjODgzOGExMjkyMmU0YmM=
|
data/lib/maia/messenger.rb
CHANGED
@@ -19,17 +19,21 @@ module Maia
|
|
19
19
|
end
|
20
20
|
|
21
21
|
private
|
22
|
+
def gcm
|
23
|
+
@_service ||= GCM::Service.new connection: connection
|
24
|
+
end
|
25
|
+
|
26
|
+
def connection
|
27
|
+
nil # use the default
|
28
|
+
end
|
29
|
+
|
22
30
|
def handle_failed_tokens(results)
|
23
31
|
results.each do |result|
|
24
32
|
device = Maia::Device.find_by(token: result.token)
|
25
|
-
|
26
|
-
|
33
|
+
logger.info "#{result.token} failed: #{result.error}"
|
34
|
+
if device && invalid_token_error?(result.error)
|
27
35
|
logger.info "Invalid token #{device.token} - destroying device #{device.id}."
|
28
|
-
device.destroy
|
29
|
-
when /MessageTooBig/
|
30
|
-
logger.info 'Message sent was too large.'
|
31
|
-
when /Timeout/
|
32
|
-
logger.info 'Request to GCM timed out'
|
36
|
+
device.destroy
|
33
37
|
end
|
34
38
|
end
|
35
39
|
end
|
@@ -46,12 +50,8 @@ module Maia
|
|
46
50
|
end
|
47
51
|
end
|
48
52
|
|
49
|
-
def
|
50
|
-
|
51
|
-
end
|
52
|
-
|
53
|
-
def connection
|
54
|
-
nil # use the default
|
53
|
+
def invalid_token_error?(error)
|
54
|
+
error =~ /InvalidRegistration|NotRegistered/
|
55
55
|
end
|
56
56
|
|
57
57
|
def user_already_has_token_registered?(user, token)
|
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.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Logan Serman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|