usman 0.3.22 → 0.3.23
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/app/services/usman/mobile_registration_service.rb +12 -11
- data/lib/usman/version.rb +1 -1
- 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: 33ba753caf08121272839720af4e449f7d672b7b
|
|
4
|
+
data.tar.gz: 9d05d3a4c1c588675cd87041e5ae1ed1577fddfe
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e1f7936558d730092101c40def1efd7feb96cad43de7138b605a9fc718c5706aeb6b358b0c1535f66f698be19dcad836ad08100523dd3e9fdc6a8aca115c4242
|
|
7
|
+
data.tar.gz: d335fb1843c90755b61013b37ddd356c47efe691a7fef30dd1e905225bd05e5e3be8a0cceef64a1e95a69bdc54d8735202b5383f8e741e98ec7b5d48985c5d6d
|
|
@@ -17,7 +17,6 @@ module Usman
|
|
|
17
17
|
@country = Country.find_by_id(params[:country_id])
|
|
18
18
|
@city = City.find_by_id(params[:city_id])
|
|
19
19
|
|
|
20
|
-
# FIXME
|
|
21
20
|
# Edge case to catch city selected that of a different country
|
|
22
21
|
@city = nil unless @city.country == @country if @city
|
|
23
22
|
|
|
@@ -43,16 +42,16 @@ module Usman
|
|
|
43
42
|
@device.valid?
|
|
44
43
|
|
|
45
44
|
# Create a dummy user
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
@registration.devices.each do |d|
|
|
49
|
-
d.user = @registration.user
|
|
50
|
-
d.save
|
|
45
|
+
if @registration.user_id.blank?
|
|
46
|
+
create_a_dummy_user
|
|
51
47
|
end
|
|
52
48
|
|
|
53
49
|
if @registration.errors.any? or @device.errors.any?
|
|
54
50
|
errors = @registration.errors.to_hash.merge(@device.errors.to_hash)
|
|
55
51
|
set_error("api.register.invalid_inputs", errors)
|
|
52
|
+
else
|
|
53
|
+
@registration.save
|
|
54
|
+
@device.save
|
|
56
55
|
end
|
|
57
56
|
end
|
|
58
57
|
|
|
@@ -63,7 +62,7 @@ module Usman
|
|
|
63
62
|
end
|
|
64
63
|
|
|
65
64
|
def register_new_device
|
|
66
|
-
|
|
65
|
+
|
|
67
66
|
if @device && @device.blocked?
|
|
68
67
|
set_error("api.register.device_blocked")
|
|
69
68
|
return
|
|
@@ -97,6 +96,7 @@ module Usman
|
|
|
97
96
|
|
|
98
97
|
if @registration.errors.blank? && @device.errors.blank?
|
|
99
98
|
@registration.save
|
|
99
|
+
# Saving User to device table
|
|
100
100
|
@device.save
|
|
101
101
|
generate_new_otp
|
|
102
102
|
else
|
|
@@ -115,10 +115,11 @@ module Usman
|
|
|
115
115
|
end
|
|
116
116
|
|
|
117
117
|
def create_a_dummy_user
|
|
118
|
-
|
|
119
|
-
@
|
|
120
|
-
@
|
|
121
|
-
@registration.user
|
|
118
|
+
@user = User.new
|
|
119
|
+
@user.generate_dummy_data(@registration)
|
|
120
|
+
@user.save
|
|
121
|
+
@registration.user = @user
|
|
122
|
+
@device.user = @user if @device
|
|
122
123
|
end
|
|
123
124
|
|
|
124
125
|
def set_error(key, hsh={})
|
data/lib/usman/version.rb
CHANGED