Class: SmsGate::Sms
- Inherits:
-
Struct
- Object
- Struct
- SmsGate::Sms
- Defined in:
- lib/sms_gate/sms.rb
Instance Attribute Summary collapse
-
#from ⇒ Object
Returns the value of attribute from.
-
#model_id ⇒ Object
Returns the value of attribute model_id.
-
#text ⇒ Object
Returns the value of attribute text.
-
#to ⇒ Object
Returns the value of attribute to.
Instance Method Summary collapse
- #deliver ⇒ Object
- #deliver_later ⇒ Object
-
#initialize(params) ⇒ Sms
constructor
A new instance of Sms.
- #to_s ⇒ Object
Constructor Details
#initialize(params) ⇒ Sms
Returns a new instance of Sms.
4 5 6 7 8 9 |
# File 'lib/sms_gate/sms.rb', line 4 def initialize(params) self.from = params[:from] || ::SmsGate::Base.from self.to = params[:to] self.text = params[:text] self.model_id = params[:model_id] end |
Instance Attribute Details
#from ⇒ Object
Returns the value of attribute from
2 3 4 |
# File 'lib/sms_gate/sms.rb', line 2 def from @from end |
#model_id ⇒ Object
Returns the value of attribute model_id
2 3 4 |
# File 'lib/sms_gate/sms.rb', line 2 def model_id @model_id end |
#text ⇒ Object
Returns the value of attribute text
2 3 4 |
# File 'lib/sms_gate/sms.rb', line 2 def text @text end |
#to ⇒ Object
Returns the value of attribute to
2 3 4 |
# File 'lib/sms_gate/sms.rb', line 2 def to @to end |
Instance Method Details
#deliver ⇒ Object
11 12 13 |
# File 'lib/sms_gate/sms.rb', line 11 def deliver ::SmsGate::Base.deliver(to: self.to, from: self.from, text: self.text) end |
#deliver_later ⇒ Object
15 16 17 |
# File 'lib/sms_gate/sms.rb', line 15 def deliver_later Resque.enqueue(::SmsGate::Jobs::SmsJob, to: self.to, from: self.from, text: self.text, model_id: self.model_id) end |
#to_s ⇒ Object
19 20 21 |
# File 'lib/sms_gate/sms.rb', line 19 def to_s "SMS: from:#{self.from}, to:#{self.to}, text:#{self.text}, model_id:#{self.model_id}" end |