Class: ContactsMerge
- Inherits:
-
LogicalModel
- Object
- LogicalModel
- ContactsMerge
- Defined in:
- app/models/contacts_merge.rb
Instance Method Summary collapse
- #json_root ⇒ Object
-
#last_create_message_hash ⇒ Hash
Returns a Hash with the message corresponding to last create result.
Instance Method Details
#json_root ⇒ Object
19 20 21 |
# File 'app/models/contacts_merge.rb', line 19 def json_root 'merge' end |
#last_create_message_hash ⇒ Hash
Returns a Hash with the message corresponding to last create result
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'app/models/contacts_merge.rb', line 28 def case self.last_response_code when 400 if self.errors.keys.include?(:similarity_of_contacts) {alert: I18n.t('contacts_merge.not_similar')} else {alert: self.errors.} end when 401 {alert: I18n.t('contacts_merge.not_allowed', more: "[<a href='http://www.padma-support.com.ar/blog/n%C4%81o-tenho-permiss%C5%8Des-para-fundir-contatos' target='_blank'>?</a>]").html_safe} when 201 {notice: I18n.t('contacts_merge.merged')} when 202 case self.state when 'pending_confirmation' {notice: I18n.t('contacts_merge.pending_confirmation_of_admin')} else {notice: I18n.t('contacts_merge.started')} end else {alert: I18n.t('contacts.communication_failure')} end end |