Class: Usman::Contact
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Usman::Contact
- Defined in:
- app/models/usman/contact.rb
Instance Method Summary collapse
- #can_be_deleted? ⇒ Boolean
-
#can_be_edited? ⇒ Boolean
Permission Methods ——————.
-
#display_name ⇒ Object
-
Return full name == Examples >>> contact.display_name => “<NAME>”.
-
- #get_done_deal_user ⇒ Object
- #parse_phone_number(num) ⇒ Object
Instance Method Details
#can_be_deleted? ⇒ Boolean
47 48 49 |
# File 'app/models/usman/contact.rb', line 47 def can_be_deleted? false end |
#can_be_edited? ⇒ Boolean
Permission Methods
43 44 45 |
# File 'app/models/usman/contact.rb', line 43 def can_be_edited? false end |
#display_name ⇒ Object
-
Return full name
Examples
>>> contact.display_name
=> "<NAME>"
61 62 63 |
# File 'app/models/usman/contact.rb', line 61 def display_name "#{self.name}" end |
#get_done_deal_user ⇒ Object
69 70 71 72 73 74 |
# File 'app/models/usman/contact.rb', line 69 def get_done_deal_user return nil unless self.contact_number formatted_number = parse_phone_number(self.contact_number) reg = Registration.where("CONCAT_WS('', dialing_prefix, mobile_number) = ?", formatted_number).first return reg && reg.user ? reg.user : nil end |
#parse_phone_number(num) ⇒ Object
65 66 67 |
# File 'app/models/usman/contact.rb', line 65 def parse_phone_number(num) num.gsub(' ','').gsub('(','').gsub(')','').gsub('-','').strip end |