Module: MnoEnterprise::Concerns::Models::IntercomUser
- Extended by:
- ActiveSupport::Concern
- Included in:
- User
- Defined in:
- lib/mno_enterprise/concerns/models/intercom_user.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
-
#intercom_data(update_last_request_at = true) ⇒ Object
Return Intercom user data hash.
-
#intercom_user_hash ⇒ Object
Instance methods ================================================================== Return intercom user hash This is used in secure mode.
Instance Method Details
#intercom_data(update_last_request_at = true) ⇒ Object
Return Intercom user data hash
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/mno_enterprise/concerns/models/intercom_user.rb', line 30 def intercom_data(update_last_request_at = true) data = { user_id: self.id, name: [self.name, self.surname].join(' '), email: self.email, created_at: self.created_at.to_i, last_seen_ip: self.last_sign_in_ip, custom_attributes: { first_name: self.name, surname: self.surname, confirmed_at: self.confirmed_at, admin_role: self.admin_role }, update_last_request_at: update_last_request_at } data[:custom_attributes][:phone]= self.phone if self.phone data[:custom_attributes][:external_id]= self.external_id if self.external_id data end |
#intercom_user_hash ⇒ Object
Instance methods
Return intercom user hash This is used in secure mode
25 26 27 |
# File 'lib/mno_enterprise/concerns/models/intercom_user.rb', line 25 def intercom_user_hash OpenSSL::HMAC.hexdigest('sha256', MnoEnterprise.intercom_api_secret, (self.id || self.email).to_s) if MnoEnterprise.intercom_api_secret end |