notifiable-rails 0.27.0 → 0.27.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/notifiable/device_token.rb +12 -1
- data/lib/notifiable/version.rb +1 -1
- data/spec/model/device_token_spec.rb +2 -2
- data/spec/test_app/log/test.log +2265 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c3c177ac0aa69878e018e081427052140eeb6f80
|
4
|
+
data.tar.gz: 75cbb9a5a26126e9c632feeecb989ff94ffe070e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f60aeddb3dddf3132d2a9f05b0b8799989a04dbf3270a28685afc4ebd021875ff4bfc856cfe95a2df97696f513bb4d9fedb0ef91c3d382f6df5a69a903b275d2
|
7
|
+
data.tar.gz: c4b7cfc0305a08ca17fbc1ed7f2638d6e27b0623aaf172cbc11f52174afc8d792b17147871a0650522f307df703a680eb12a59dd8c79bb3e2b3f9068713a24f0
|
@@ -16,6 +16,17 @@ module Notifiable
|
|
16
16
|
validates :language, length: { in: 2..3 }, allow_blank: true # ISO 639-1 or ISO 6369-2 language code
|
17
17
|
validates :country, length: { is: 2 }, allow_blank: true # ISO 3166-1 alpha-2 country code
|
18
18
|
|
19
|
-
scope :nearby, -> (lon, lat, radius){ where("ST_DWithin(lonlat, ST_MakePoint(?,?), ?)", lon, lat, radius) }
|
19
|
+
scope :nearby, -> (lon, lat, radius){ where("ST_DWithin(lonlat, ST_MakePoint(?,?), ?)", lon, lat, radius) }
|
20
|
+
|
21
|
+
before_save :downcase_language, :downcase_country
|
22
|
+
|
23
|
+
private
|
24
|
+
def downcase_language
|
25
|
+
language.downcase! if language
|
26
|
+
end
|
27
|
+
|
28
|
+
def downcase_country
|
29
|
+
country.downcase! if country
|
30
|
+
end
|
20
31
|
end
|
21
32
|
end
|
data/lib/notifiable/version.rb
CHANGED
@@ -54,7 +54,7 @@ describe Notifiable::DeviceToken do
|
|
54
54
|
|
55
55
|
describe "#language" do
|
56
56
|
context 'ISO 639-1' do
|
57
|
-
subject(:token) { create(:device_token, language: '
|
57
|
+
subject(:token) { create(:device_token, language: 'EN') }
|
58
58
|
it { expect(token.language).to eq 'en' }
|
59
59
|
end
|
60
60
|
|
@@ -72,7 +72,7 @@ describe Notifiable::DeviceToken do
|
|
72
72
|
describe "#country" do
|
73
73
|
context 'ISO 3166-1' do
|
74
74
|
subject { create(:device_token, country: 'GB') }
|
75
|
-
it { expect(subject.country).to eq '
|
75
|
+
it { expect(subject.country).to eq 'gb' }
|
76
76
|
end
|
77
77
|
|
78
78
|
context 'nil' do
|