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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YmJjNjA4NDhmYTE0YjI2OWY0NTQ5NjNjNmRkNmM4NjkxNmNkYjhiNA==
4
+ ZmFjZWIzOWY0YWI5M2IxOGI0YjE5NzY2N2JmODQ0ZWQ4YWRlMjdhNg==
5
5
  data.tar.gz: !binary |-
6
- ZDFiNzMzNmM5MDllOThjMTQ2NmI0Y2Q5OTY3MzNiZDlkMzExOTIzMQ==
6
+ NjNkZDM3Zjc0OWVlZmQxYjE3ZTA2NGM3NzZjZjY5YzI4YzQ3MmM3Ng==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NzJlOWYwNzM1MjYwNDAxZjgxMjlkMTYyMjcyNzhiNjk1OGE5Nzk5NmQ2N2U4
10
- MGIxYzY0OTJiZTJmYjM0YzI5MDViODExOGU4ZjY4MjY5ZmMyMGM0MmQ1N2Q4
11
- NThhMTYzMzI5YTE0ODkwM2UxNzFkYzUzMDZkMzExNWMwODM0YmQ=
9
+ N2E0ZDBmYzg0ZWUxY2E2Njk0NWQ0YTU5MzFmMjZmZThmZjM0MmIwYjNlODNl
10
+ NDViZWY0ZGZkOGFhZDY1N2EzZDZlN2YzZTljMzg5ZDc2YzcwNjBlZTk0ZDM5
11
+ ZjdjMTBhNWNjOTViZDQwYmQzMmY2MTVjNmQ1MDNjMmYyY2U5ZDg=
12
12
  data.tar.gz: !binary |-
13
- YmFlYjU4OWNhYmU1YjczMTJkZTAxMmE4NWM0NGE3MzMyZDBlMzFmMGQwZjhh
14
- ODg5MWEzYzI0YTg3OTAxOGFkYzliNTdhZjY2MTIyNTQyYjcwOWUyZGVlMjU2
15
- NmNiMjBkYzEyN2ZhN2FiZmQ3ZDJiOGIxODRlNmIxY2JhZTZiNzM=
13
+ NjBkYjk4MjQyNmQ5YjVmYmZkMDNhOTkzZDYzZGYzODhlZGRlOWJlN2I4OTNk
14
+ YWIxZmVhZTYxYTIzZTA5MDZiODI2ZjI1MDQxOTY4M2UwNDg4YWM2MjRkODRj
15
+ ZjFjMzFlNDg0ODFhNTAwNjMwZWE1MjBjODgzOGExMjkyMmU0YmM=
@@ -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
- case result.error
26
- when /InvalidRegistration/, /NotRegistered/
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 if device
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 gcm
50
- @_service ||= GCM::Service.new connection: connection
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)
@@ -1,3 +1,3 @@
1
1
  module Maia
2
- VERSION = '0.0.4'
2
+ VERSION = '0.0.5'
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: 0.0.4
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-18 00:00:00.000000000 Z
11
+ date: 2015-12-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails