Class: Sms
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Sms
- Defined in:
- lib/smster/sms.rb
Constant Summary collapse
- STATUSES =
Codes
{ created: 0, sent: 1, delivered: 2, failed: 3 }
Instance Attribute Summary collapse
-
#api_message_id ⇒ Object
Returns the value of attribute api_message_id.
-
#balance ⇒ Object
Returns the value of attribute balance.
-
#cost ⇒ Object
Returns the value of attribute cost.
-
#from ⇒ Object
Returns the value of attribute from.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#api_message_id ⇒ Object
Returns the value of attribute api_message_id.
4 5 6 |
# File 'lib/smster/sms.rb', line 4 def @api_message_id end |
#balance ⇒ Object
Returns the value of attribute balance.
4 5 6 |
# File 'lib/smster/sms.rb', line 4 def balance @balance end |
#cost ⇒ Object
Returns the value of attribute cost.
4 5 6 |
# File 'lib/smster/sms.rb', line 4 def cost @cost end |
#from ⇒ Object
Returns the value of attribute from.
4 5 6 |
# File 'lib/smster/sms.rb', line 4 def from @from end |
Class Method Details
.create(attrs = {}) ⇒ Object
Etc.
13 14 15 16 17 18 19 |
# File 'lib/smster/sms.rb', line 13 def self.create(attrs = {}) sms = new(attrs).send_sms sms.assing_code sms.save sms end |
Instance Method Details
#accept! ⇒ Object
25 26 27 |
# File 'lib/smster/sms.rb', line 25 def accept! update(status: STATUSES[:delivered]) end |
#assing_code ⇒ Object
29 30 31 |
# File 'lib/smster/sms.rb', line 29 def assing_code self.code = end |
#assing_status ⇒ Object
Callbacks
7 |
# File 'lib/smster/sms.rb', line 7 before_validation :assing_status |