Class: Cellular::SMS
- Inherits:
-
Object
- Object
- Cellular::SMS
- Defined in:
- lib/cellular/models/sms.rb
Overview
Represents an SMS
Instance Attribute Summary collapse
-
#country_code ⇒ Object
Returns the value of attribute country_code.
-
#delivery_message ⇒ Object
Returns the value of attribute delivery_message.
-
#delivery_status ⇒ Object
Returns the value of attribute delivery_status.
-
#message ⇒ Object
Returns the value of attribute message.
-
#price ⇒ Object
Returns the value of attribute price.
-
#recipient ⇒ Object
Returns the value of attribute recipient.
-
#recipients ⇒ Object
Returns the value of attribute recipients.
-
#sender ⇒ Object
Returns the value of attribute sender.
Instance Method Summary collapse
- #deliver ⇒ Object
- #deliver_async(delivery_options = {}) ⇒ Object (also: #deliver_later)
- #delivered? ⇒ Boolean
-
#initialize(options = {}) ⇒ SMS
constructor
A new instance of SMS.
- #receive(_options = {}) ⇒ Object
- #save(_options = {}) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ SMS
Returns a new instance of SMS.
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/cellular/models/sms.rb', line 9 def initialize( = {}) @backend = Cellular.config.backend @recipients = [:recipients] @recipient = [:recipient] @sender = [:sender] || Cellular.config.sender = [:message] @price = [:price] || Cellular.config.price @country_code = [:country_code] || Cellular.config.country_code @delivered = false end |
Instance Attribute Details
#country_code ⇒ Object
Returns the value of attribute country_code.
6 7 8 |
# File 'lib/cellular/models/sms.rb', line 6 def country_code @country_code end |
#delivery_message ⇒ Object
Returns the value of attribute delivery_message.
7 8 9 |
# File 'lib/cellular/models/sms.rb', line 7 def end |
#delivery_status ⇒ Object
Returns the value of attribute delivery_status.
7 8 9 |
# File 'lib/cellular/models/sms.rb', line 7 def delivery_status @delivery_status end |
#message ⇒ Object
Returns the value of attribute message.
6 7 8 |
# File 'lib/cellular/models/sms.rb', line 6 def end |
#price ⇒ Object
Returns the value of attribute price.
6 7 8 |
# File 'lib/cellular/models/sms.rb', line 6 def price @price end |
#recipient ⇒ Object
Returns the value of attribute recipient.
6 7 8 |
# File 'lib/cellular/models/sms.rb', line 6 def recipient @recipient end |
#recipients ⇒ Object
Returns the value of attribute recipients.
7 8 9 |
# File 'lib/cellular/models/sms.rb', line 7 def recipients @recipients end |
#sender ⇒ Object
Returns the value of attribute sender.
6 7 8 |
# File 'lib/cellular/models/sms.rb', line 6 def sender @sender end |
Instance Method Details
#deliver ⇒ Object
22 23 24 25 |
# File 'lib/cellular/models/sms.rb', line 22 def deliver @delivery_status, = @backend.deliver @delivered = true end |
#deliver_async(delivery_options = {}) ⇒ Object Also known as: deliver_later
27 28 29 30 |
# File 'lib/cellular/models/sms.rb', line 27 def deliver_async( = {}) Cellular::Jobs::AsyncMessenger.set() .perform_later() end |
#delivered? ⇒ Boolean
42 43 44 |
# File 'lib/cellular/models/sms.rb', line 42 def delivered? @delivered end |
#receive(_options = {}) ⇒ Object
38 39 40 |
# File 'lib/cellular/models/sms.rb', line 38 def receive( = {}) raise NotImplementedError end |
#save(_options = {}) ⇒ Object
34 35 36 |
# File 'lib/cellular/models/sms.rb', line 34 def save( = {}) raise NotImplementedError end |