notifiable-rails 0.27.0 → 0.27.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: 0f553cf117f698544c12c15741a99d2407ed21c0
4
- data.tar.gz: a91c686a29edd343d41f8029dae927bd2e7db062
3
+ metadata.gz: c3c177ac0aa69878e018e081427052140eeb6f80
4
+ data.tar.gz: 75cbb9a5a26126e9c632feeecb989ff94ffe070e
5
5
  SHA512:
6
- metadata.gz: 5aee2e3faac50c9708f6b56f3ae6ee355aaae9e508a9de6b2cd6c3f9f02f398c3ff307b2f42933150046cff68072f9e5e6cd91036bc779e8a45969fa1295c1b9
7
- data.tar.gz: a600d5bd77e8fac4c226d7bf3cd1fd67616a9aa6e2aa85a877786e411d641596eb0b662977928a9e37cbae676934a0deea84104cc1d24ca20b0f4c1d9d4af698
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
@@ -1,3 +1,3 @@
1
1
  module Notifiable
2
- VERSION = "0.27.0"
2
+ VERSION = "0.27.1"
3
3
  end
@@ -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: 'en') }
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 'GB' }
75
+ it { expect(subject.country).to eq 'gb' }
76
76
  end
77
77
 
78
78
  context 'nil' do