Class: DoNotCall
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- DoNotCall
- Includes:
- Models::Auditable
- Defined in:
- app/models/do_not_call.rb
Overview
== Schema Information
Table name: do_not_calls
Database name: primary
id :integer not null, primary key
country_code :integer
do_not_call :boolean default(TRUE)
do_not_fax :boolean default(TRUE)
do_not_text :boolean default(TRUE)
extension :integer
notes :text
number :string(20)
created_at :datetime
updated_at :datetime
creator_id :integer
updater_id :integer
Constant Summary collapse
- FORBIDDEN =
"listed as a do not call record and cannot be added back to the database without first getting customer authorization, check marketing dashboard > do not call list for details."
Constants included from Models::Auditable
Models::Auditable::ALWAYS_IGNORED
Instance Attribute Summary collapse
-
#hunt_report ⇒ Object
Returns the value of attribute hunt_report.
- #number ⇒ Object readonly
Has many collapse
Class Method Summary collapse
-
.cleanup_for_phone(phone) ⇒ Object
Remove DoNotCall entry for a phone number after customer places an order This allows sales/support to call the customer about their order.
Instance Method Summary collapse
Methods included from Models::Auditable
#all_skipped_columns, #audit_reference_data, #creator, #should_not_save_version, #stamp_record, #updater
Methods inherited from ApplicationRecord
ransackable_associations, ransackable_attributes, ransackable_scopes, ransortable_attributes, #to_relation
Methods included from Models::EventPublishable
Instance Attribute Details
#hunt_report ⇒ Object
Returns the value of attribute hunt_report.
29 30 31 |
# File 'app/models/do_not_call.rb', line 29 def hunt_report @hunt_report end |
#number ⇒ Object (readonly)
25 |
# File 'app/models/do_not_call.rb', line 25 validates :number, presence: true, phone_format: true, uniqueness: true |
Class Method Details
.cleanup_for_phone(phone) ⇒ Object
Remove DoNotCall entry for a phone number after customer places an order
This allows sales/support to call the customer about their order
35 36 37 38 39 40 |
# File 'app/models/do_not_call.rb', line 35 def self.cleanup_for_phone(phone) return if phone.blank? formatted_phone = PhoneNumber.parse_and_format(phone) where(number: formatted_phone).delete_all end |
Instance Method Details
#contact_points ⇒ ActiveRecord::Relation<ContactPoint>
27 |
# File 'app/models/do_not_call.rb', line 27 has_many :contact_points, foreign_key: :detail, primary_key: :number |
#phone_number ⇒ Object
42 43 44 |
# File 'app/models/do_not_call.rb', line 42 def phone_number PhoneNumber.parse_and_format(number, display_format: :crm) end |
#to_s ⇒ Object
46 47 48 |
# File 'app/models/do_not_call.rb', line 46 def to_s phone_number end |