Class: Cellular::SMS
- Inherits:
-
Object
- Object
- Cellular::SMS
- Defined in:
- lib/cellular/models/sms.rb
Instance Attribute Summary collapse
-
#country_code ⇒ Object
Returns the value of attribute country_code.
-
#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.
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/cellular/models/sms.rb', line 8 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 |
#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
21 22 23 24 |
# File 'lib/cellular/models/sms.rb', line 21 def deliver @delivery_status, = @backend.deliver @delivered = true end |
#deliver_async(delivery_options = {}) ⇒ Object Also known as: deliver_later
26 27 28 |
# File 'lib/cellular/models/sms.rb', line 26 def deliver_async( = {}) Cellular::Jobs::AsyncMessenger.set().perform_later() end |
#delivered? ⇒ Boolean
39 40 41 |
# File 'lib/cellular/models/sms.rb', line 39 def delivered? @delivered end |
#receive(options = {}) ⇒ Object
35 36 37 |
# File 'lib/cellular/models/sms.rb', line 35 def receive( = {}) raise NotImplementedError end |
#save(options = {}) ⇒ Object
31 32 33 |
# File 'lib/cellular/models/sms.rb', line 31 def save( = {}) raise NotImplementedError end |