usman 0.3.13 → 0.3.14

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 01ac583f7b2db6539f7c30c806d1c706c63d0c90
4
- data.tar.gz: 3fe75fd1f24555c3e8560f7e9568e22faf57e0d9
3
+ metadata.gz: eed7d98639d06ca2611f6cb360693e8f7e1354b1
4
+ data.tar.gz: c31ffb7805ba5a7a4bd2d5c33831d1d72671ae73
5
5
  SHA512:
6
- metadata.gz: aee20527bc3c9bd207f5f8e6a8c7bc449bfc0847bc82da46f5ab96fbc33922323c5128c57a444d6a51c7e18fafe67ce832cc5f836174848283ff46e588768373
7
- data.tar.gz: 5a79998e67e318b8e7dbfe42358342d80a8cfde4800091a78d6eb4b5ef8554093fdfdd7f3611e3235c1c2d516490e11d3b87f9050278b385ee88019002c1c817
6
+ metadata.gz: cdb61002edb95fb3bf61c3d5ab72c29a3733335ba6db3f6f1c3d880a80df470d372a03d038a937a6fc80f5ba9dc6847b35a4a49f33d13283297fcb15d2071204
7
+ data.tar.gz: d86daa0d9d479657b6a7345dfa27fd892f5897370707cb7487b9a7f04de49ba21dd3a4cc63f71d05881610a5ac10f2d4d867df6f111e3ec3c8be2f55fb3af9f9
@@ -162,5 +162,25 @@ class Feature < Usman::ApplicationRecord
162
162
  def display_name
163
163
  "#{name.to_s.demodulize.pluralize.titleize}"
164
164
  end
165
+
166
+ # Image Configuration
167
+ # -------------------
168
+ def image_configuration
169
+ {
170
+ "Image::FeaturePicture" => {
171
+ max_upload_limit: 1048576,
172
+ min_upload_limit: 1024,
173
+ resolutions: [400, 400],
174
+ form_upload_image_label: "Upload a new Image",
175
+ form_title: "Upload an Image (Feature)",
176
+ form_sub_title: "Please read the instructions below:",
177
+ form_instructions: [
178
+ "the filename should be in .jpg / .jpeg or .png format",
179
+ "the image resolutions should be <strong>400 x 400 Pixels</strong>",
180
+ "the file size should be greater than 100 Kb and or lesser than <strong>10 MB</strong>"
181
+ ]
182
+ }
183
+ }
184
+ end
165
185
 
166
186
  end
data/app/models/user.rb CHANGED
@@ -453,6 +453,26 @@ class User < Usman::ApplicationRecord
453
453
  self.dummy = true
454
454
  end
455
455
 
456
+ # Image Configuration
457
+ # -------------------
458
+ def image_configuration
459
+ {
460
+ "Image::ProfilePicture" => {
461
+ max_upload_limit: 1048576,
462
+ min_upload_limit: 1024,
463
+ resolutions: [400, 400],
464
+ form_upload_image_label: "Upload a new Image",
465
+ form_title: "Upload an Image (Profile)",
466
+ form_sub_title: "Please read the instructions below:",
467
+ form_instructions: [
468
+ "the filename should be in .jpg / .jpeg or .png format",
469
+ "the image resolutions should be <strong>400 x 400 Pixels</strong>",
470
+ "the file size should be greater than 100 Kb and or lesser than <strong>10 MB</strong>"
471
+ ]
472
+ }
473
+ }
474
+ end
475
+
456
476
  private
457
477
 
458
478
  def should_validate_password?
@@ -10,14 +10,14 @@ module Usman
10
10
  :registration, :device, :remote_ip
11
11
 
12
12
  def initialize(params)
13
+
13
14
  @dialing_prefix = params[:dialing_prefix]
14
15
  @mobile_number = params[:mobile_number]
15
16
 
16
- @country = nil
17
- @city = nil
18
17
  @country = Country.find_by_id(params[:country_id])
19
18
  @city = City.find_by_id(params[:city_id])
20
19
 
20
+ # FIXME
21
21
  # Edge case to catch city selected that of a different country
22
22
  @city = nil unless @city.country == @country if @city
23
23
 
@@ -52,13 +52,8 @@ module Usman
52
52
  end
53
53
 
54
54
  def check_if_device_is_already_registered
55
- @registration = Registration.where("LOWER(mobile_number) = LOWER('#{@mobile_number}')").first
56
- if @registration
57
- @registration.country = @country
58
- @registration.city = @city
59
- end
55
+ @registration = Registration.where("LOWER(mobile_number) = LOWER('#{@mobile_number}') AND LOWER(dialing_prefix) = LOWER('#{@dialing_prefix}')").first
60
56
  @device = Device.where("LOWER(uuid) = LOWER('#{@uuid}')").first if @registration
61
-
62
57
  @device.generate_otp if @device
63
58
  end
64
59
 
@@ -72,8 +67,11 @@ module Usman
72
67
  ActiveRecord::Base.transaction do
73
68
  # Create a new registration if it doesn't exist
74
69
  @registration = Registration.new unless @registration
70
+ @user = @registration.user
71
+
75
72
  @registration.country = @country
76
73
  @registration.city = @city
74
+
77
75
  @registration.dialing_prefix = @dialing_prefix
78
76
  @registration.mobile_number = @mobile_number
79
77
 
data/lib/usman/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Usman
2
- VERSION = '0.3.13'
2
+ VERSION = '0.3.14'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: usman
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.13
4
+ version: 0.3.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - kpvarma
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-08 00:00:00.000000000 Z
11
+ date: 2017-11-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -107,7 +107,7 @@ dependencies:
107
107
  version: '0.1'
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
- version: 0.1.20
110
+ version: 0.1.21
111
111
  type: :runtime
112
112
  prerelease: false
113
113
  version_requirements: !ruby/object:Gem::Requirement
@@ -117,7 +117,7 @@ dependencies:
117
117
  version: '0.1'
118
118
  - - ">="
119
119
  - !ruby/object:Gem::Version
120
- version: 0.1.20
120
+ version: 0.1.21
121
121
  - !ruby/object:Gem::Dependency
122
122
  name: pattana
123
123
  requirement: !ruby/object:Gem::Requirement
@@ -127,7 +127,7 @@ dependencies:
127
127
  version: '0.1'
128
128
  - - ">="
129
129
  - !ruby/object:Gem::Version
130
- version: 0.1.16
130
+ version: 0.1.17
131
131
  type: :runtime
132
132
  prerelease: false
133
133
  version_requirements: !ruby/object:Gem::Requirement
@@ -137,7 +137,7 @@ dependencies:
137
137
  version: '0.1'
138
138
  - - ">="
139
139
  - !ruby/object:Gem::Version
140
- version: 0.1.16
140
+ version: 0.1.17
141
141
  - !ruby/object:Gem::Dependency
142
142
  name: bcrypt
143
143
  requirement: !ruby/object:Gem::Requirement