Class: Textris::Message
- Inherits:
-
Object
- Object
- Textris::Message
- Defined in:
- lib/textris/message.rb
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#from_name ⇒ Object
readonly
Returns the value of attribute from_name.
-
#from_phone ⇒ Object
readonly
Returns the value of attribute from_phone.
-
#media_urls ⇒ Object
readonly
Returns the value of attribute media_urls.
-
#texter(options = {}) ⇒ Object
readonly
Returns the value of attribute texter.
-
#to ⇒ Object
readonly
Returns the value of attribute to.
Instance Method Summary collapse
- #deliver ⇒ Object
- #from ⇒ Object
-
#initialize(options = {}) ⇒ Message
constructor
A new instance of Message.
Constructor Details
#initialize(options = {}) ⇒ Message
Returns a new instance of Message.
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/textris/message.rb', line 6 def initialize( = {}) initialize_content() () initialize_recipients() @texter = [:texter] @action = [:action] @args = [:args] @media_urls = [:media_urls] end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
3 4 5 |
# File 'lib/textris/message.rb', line 3 def action @action end |
#args ⇒ Object (readonly)
Returns the value of attribute args.
3 4 5 |
# File 'lib/textris/message.rb', line 3 def args @args end |
#content ⇒ Object (readonly)
Returns the value of attribute content.
3 4 5 |
# File 'lib/textris/message.rb', line 3 def content @content end |
#from_name ⇒ Object (readonly)
Returns the value of attribute from_name.
3 4 5 |
# File 'lib/textris/message.rb', line 3 def from_name @from_name end |
#from_phone ⇒ Object (readonly)
Returns the value of attribute from_phone.
3 4 5 |
# File 'lib/textris/message.rb', line 3 def from_phone @from_phone end |
#media_urls ⇒ Object (readonly)
Returns the value of attribute media_urls.
3 4 5 |
# File 'lib/textris/message.rb', line 3 def media_urls @media_urls end |
#texter(options = {}) ⇒ Object (readonly)
Returns the value of attribute texter.
3 4 5 |
# File 'lib/textris/message.rb', line 3 def texter @texter end |
#to ⇒ Object (readonly)
Returns the value of attribute to.
3 4 5 |
# File 'lib/textris/message.rb', line 3 def to @to end |
Instance Method Details
#deliver ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/textris/message.rb', line 17 def deliver deliveries = ::Textris::Delivery.get deliveries.each do |delivery| delivery.new(self).deliver_to_all end self end |
#from ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/textris/message.rb', line 34 def from if @from_phone.present? if @from_name.present? if PhoneFormatter.is_alphameric?(@from_phone) @from_phone else if PhoneFormatter.is_a_short_code?(@from_phone) "#{@from_name} <#{@from_phone}>" else "#{@from_name} <#{Phony.format(@from_phone)}>" end end else Phony.format(@from_phone) end elsif @from_name.present? @from_name end end |