Module: SmsOnRails::ModelSupport::Outbound::InstanceMethods

Defined in:
lib/sms_on_rails/model_support/outbound.rb

Overview

ClassMethods

Instance Method Summary collapse

Instance Method Details

#actual_messageObject



101
102
103
# File 'lib/sms_on_rails/model_support/outbound.rb', line 101

def actual_message
  read_attribute(:actual_message) || draft_message
end

#actual_message=(msg) ⇒ Object

only save the actual message if it differs from the draft message



106
107
108
# File 'lib/sms_on_rails/model_support/outbound.rb', line 106

def actual_message=(msg)
  write_attribute(:actual_message, msg) unless substituted_draft_message == draft_message
end

#assign_existing_phoneObject



95
# File 'lib/sms_on_rails/model_support/outbound.rb', line 95

def assign_existing_phone; assign_phone_number(self.phone_number); end

#assign_phone_number(phone) ⇒ Object



91
92
93
# File 'lib/sms_on_rails/model_support/outbound.rb', line 91

def assign_phone_number(phone)
  self.phone_number = SmsOnRails::PhoneNumber.find_and_create_by_number(phone)
end

#draft_messageObject

The actual (not substituted draft message Substituted message can be obtained with substituted_draft_message



99
# File 'lib/sms_on_rails/model_support/outbound.rb', line 99

def draft_message; draft.complete_message if draft; end

#phone_number_digitsObject



80
81
82
# File 'lib/sms_on_rails/model_support/outbound.rb', line 80

def phone_number_digits
  self['phone_number_digits']||(phone_number ? phone_number.number : nil)
end

#phone_number_digits=(digits) ⇒ Object



84
85
86
87
88
89
# File 'lib/sms_on_rails/model_support/outbound.rb', line 84

def phone_number_digits=(digits)
  self.phone_number ||= SmsOnRails::PhoneNumber.new
  self.phone_number.number = digits
  assign_existing_phone
  self.phone_number.number
end

#sender_nameObject

Todo



111
# File 'lib/sms_on_rails/model_support/outbound.rb', line 111

def sender_name; ''; end