usman 0.3.30 → 0.3.31

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: a33182444e966fc4ebcedd4ce61d7100e9f9e584
4
- data.tar.gz: aa1144b0de94877bddc97d7bbca5d4ca7af40ac9
3
+ metadata.gz: c4bfa2386a2c298ad494119700262a59a726b30c
4
+ data.tar.gz: 5011650c91f8b6b7600e1e2494897ced93f95d71
5
5
  SHA512:
6
- metadata.gz: 690e29b09a15ae51d0eb06926adbbee07edc67d2b1ba1eb8772ddd6e592f0a2344fade13713265cbd246797b191ed298f2539d3665c9c295563ca457c9c873af
7
- data.tar.gz: f9d14b81a77015d3585164a46234923813f94b858cd04a9a3188a61a769582c9a2c2f7bfeee82c776a4f073b58f0c529712863311baf17534288a867875b9b3d
6
+ metadata.gz: 9b302ac4f88d06ad59feb0fdd97530ef6637e0d04e1a0a66c37555e9863101627a0333e591ac298edb7efe10dab64ea14f8fb90d20bf4ebcf857ae81a26bc255
7
+ data.tar.gz: d73b401cee55ca12f7ef6afd93d6d1b44500138c2011f28cbdabfe705e2ea28e862589a5a9ea81a55998774134b3297e67a95dbd373b2359b09055f50869db57
@@ -15,12 +15,13 @@ module Usman
15
15
  else
16
16
  contacts = []
17
17
  params[:contacts].each do |cnt|
18
- contact = Usman::Contact.new
18
+ formatted_number = cnt["contact_number"].gsub(' ','').gsub('(','').gsub(')','').gsub('-','').strip
19
+ contact = Usman::Contact.where("contact_number = ?", formatted_number).first || Usman::Contact.where("email = ?", cnt["email"]).first || Usman::Contact.new
19
20
 
20
- contact.name = cnt["name"]
21
- contact.account_type = cnt["account_type"]
22
- contact.email = cnt["email"]
23
- contact.contact_number = cnt["contact_number"]
21
+ contact.name = cnt["name"] unless cnt["name"].blank?
22
+ contact.account_type = cnt["account_type"] unless cnt["account_type"].blank?
23
+ contact.email = cnt["email"] unless cnt["email"].blank?
24
+ contact.contact_number = cnt["contact_number"] unless cnt["contact_number"].blank?
24
25
 
25
26
  contact.owner = @current_user
26
27
  contact.done_deal_user = contact.get_done_deal_user
data/lib/usman/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Usman
2
- VERSION = '0.3.30'
2
+ VERSION = '0.3.31'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: usman
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.30
4
+ version: 0.3.31
5
5
  platform: ruby
6
6
  authors:
7
7
  - kpvarma