acts_as_pushable 0.3.0 → 0.3.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
2
  SHA1:
3
- metadata.gz: 2f6ba8a11226b1b0d7acde10cbaee82fbf763f07
4
- data.tar.gz: b1fb5b1eea5225015c4d41557882537d5429e206
3
+ metadata.gz: f4e397a6603406b0ea6ed33de74d6eaa11bc1bc3
4
+ data.tar.gz: a7bea3db7a052fefa22fe83d9d1aec51d443f830
5
5
  SHA512:
6
- metadata.gz: e84af18153948d8d53a498405e5801d84ff2a95ad16568899b592ec926e4c11e12e0cae42160889585fe7ab5b8b0815019e91ec353dde4559ed5004115569634
7
- data.tar.gz: 55dd800796c96b4f361c28e23d35a3557d4e401e9cc4669d9dff1932b4051792f54335acd45e088fd7dde0402831a78213e5348aedc3140a192c0fc17a518a2c
6
+ metadata.gz: d72fe1f5b3b7811528399d8ebabe7d5ddead27a2c5b87e21da173aefa197d7b7ac7c4151088636dd0f7f6d3c224abb28aa55c7bb132bdde3fc774ad6c14ef506
7
+ data.tar.gz: f654a8793e68b33855640bc86cbfbd51f9f7390c2a7780d120ccf65b90e2c8569eb607e14086db000f6b3fe590ce89dac15083bc4961b66c17e371975d38617d
@@ -7,6 +7,7 @@ module ActsAsPushable
7
7
  validates :active, inclusion: { in: [true, false] }
8
8
 
9
9
  before_validation :set_valid_at, on: :create
10
+ before_validation :strip_spaces_from_token, on: :create, if: :token
10
11
 
11
12
  scope :active, -> { where(invalidated_at: nil, active: true) }
12
13
 
@@ -23,7 +24,7 @@ module ActsAsPushable
23
24
  def deactivate
24
25
  self.update_attributes({
25
26
  active: false,
26
- deactivated_at: Time.now,
27
+ deactivated_at: Time.current,
27
28
  })
28
29
  end
29
30
 
@@ -40,7 +41,11 @@ module ActsAsPushable
40
41
  private
41
42
 
42
43
  def set_valid_at
43
- self.valid_at = Time.now
44
+ self.valid_at = Time.current
45
+ end
46
+
47
+ def strip_spaces_from_token
48
+ self.token = token.delete(' ')
44
49
  end
45
50
  end
46
51
  end
@@ -13,8 +13,8 @@ module ActsAsPushable
13
13
  devices = development_apn.devices + production_apn.devices
14
14
 
15
15
  devices.each do |device|
16
- device = ActsAsPushable::Device.find_by_token(device)
17
- device.update_attribute('invalidated_at', Time.now) if device
16
+ device = ActsAsPushable::Device.find_by_token(device.delete(' '))
17
+ device.update_attribute('invalidated_at', Time.current) if device
18
18
  end
19
19
  end
20
20
  end
@@ -6,7 +6,7 @@ module ActsAsPushable
6
6
  def perform
7
7
  response = client.send([device.token], gcm_options)
8
8
  if response[:not_registered_ids].include? device.token
9
- device.update_attribute 'invalidated_at', Time.now
9
+ device.update_attribute 'invalidated_at', Time.current
10
10
  end
11
11
  response
12
12
  end
@@ -1,3 +1,3 @@
1
1
  module ActsAsPushable
2
- VERSION = '0.3.0'
2
+ VERSION = '0.3.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_pushable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Butler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-04 00:00:00.000000000 Z
11
+ date: 2016-12-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails