Class: Cellular::SMS
- Inherits:
-
Object
- Object
- Cellular::SMS
- Defined in:
- lib/cellular/models/sms.rb
Instance Attribute Summary collapse
-
#country ⇒ Object
Returns the value of attribute country.
-
#message ⇒ Object
Returns the value of attribute message.
-
#price ⇒ Object
Returns the value of attribute price.
-
#recipient ⇒ Object
Returns the value of attribute recipient.
-
#sender ⇒ Object
Returns the value of attribute sender.
Instance Method Summary collapse
- #deliver ⇒ Object
- #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.
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/cellular/models/sms.rb', line 6 def initialize( = {}) @backend = Cellular.config.backend @recipient = [:recipient] @sender = [:sender] || Cellular.config.sender @message = [:message] @price = [:price] || Cellular.config.price @country = [:country] || Cellular.config.country_code @delivered = false end |
Instance Attribute Details
#country ⇒ Object
Returns the value of attribute country.
4 5 6 |
# File 'lib/cellular/models/sms.rb', line 4 def country @country end |
#message ⇒ Object
Returns the value of attribute message.
4 5 6 |
# File 'lib/cellular/models/sms.rb', line 4 def @message end |
#price ⇒ Object
Returns the value of attribute price.
4 5 6 |
# File 'lib/cellular/models/sms.rb', line 4 def price @price end |
#recipient ⇒ Object
Returns the value of attribute recipient.
4 5 6 |
# File 'lib/cellular/models/sms.rb', line 4 def recipient @recipient end |
#sender ⇒ Object
Returns the value of attribute sender.
4 5 6 |
# File 'lib/cellular/models/sms.rb', line 4 def sender @sender end |
Instance Method Details
#deliver ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/cellular/models/sms.rb', line 18 def deliver @delivery_status, @delivery_message = @backend.deliver( recipient: @recipient, sender: @sender, price: @price, country: @country, message: @message ) @delivered = true end |
#delivered? ⇒ Boolean
38 39 40 |
# File 'lib/cellular/models/sms.rb', line 38 def delivered? @delivered end |
#receive(options = {}) ⇒ Object
34 35 36 |
# File 'lib/cellular/models/sms.rb', line 34 def receive( = {}) raise NotImplementedError end |
#save(options = {}) ⇒ Object
30 31 32 |
# File 'lib/cellular/models/sms.rb', line 30 def save( = {}) raise NotImplementedError end |