Module: IfreeSms::Smsing::InstanceMethods
- Defined in:
- lib/ifree_sms/smsing.rb
Instance Method Summary collapse
- #encoded_sms_text ⇒ Object
- #encoded_sms_text=(value) ⇒ Object
- #request ⇒ Object
- #request=(req) ⇒ Object
- #response_to_ifree ⇒ Object
- #send_answer(text) ⇒ Object
- #test? ⇒ Boolean
- #test_to_ifree ⇒ Object
- #to_ifree ⇒ Object
Instance Method Details
#encoded_sms_text ⇒ Object
47 48 49 |
# File 'lib/ifree_sms/smsing.rb', line 47 def encoded_sms_text @encoded_sms_text end |
#encoded_sms_text=(value) ⇒ Object
51 52 53 54 |
# File 'lib/ifree_sms/smsing.rb', line 51 def encoded_sms_text=(value) self.sms_text = Base64.decode64(value) unless value.blank? @encoded_sms_text = value end |
#request ⇒ Object
31 32 33 |
# File 'lib/ifree_sms/smsing.rb', line 31 def request @request end |
#request=(req) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/ifree_sms/smsing.rb', line 35 def request=(req) self.sms_id = req.params["smsId"].to_i self.phone = req.params["phone"].to_i self.service_number = req.params["serviceNumber"].to_i self.encoded_sms_text = req.params["smsText"] self.now = parse_date(req.params["now"]) self.md5key = req.params["md5key"] self.test = req.params["test"] @request = req end |
#response_to_ifree ⇒ Object
68 69 70 71 72 73 74 |
# File 'lib/ifree_sms/smsing.rb', line 68 def response_to_ifree unless self.new_record? [self.to_ifree, 200] else [self.errors.to_xml, 422] end end |
#send_answer(text) ⇒ Object
80 81 82 |
# File 'lib/ifree_sms/smsing.rb', line 80 def send_answer(text) IfreeSms.send_sms(self.phone, text, self.sms_id) end |
#test? ⇒ Boolean
76 77 78 |
# File 'lib/ifree_sms/smsing.rb', line 76 def test? !self.test.blank? end |
#test_to_ifree ⇒ Object
64 65 66 |
# File 'lib/ifree_sms/smsing.rb', line 64 def test_to_ifree "<Response><SmsText>#{self.test}</SmsText></Response>" end |
#to_ifree ⇒ Object
56 57 58 59 60 61 62 |
# File 'lib/ifree_sms/smsing.rb', line 56 def to_ifree if self.answer_text.blank? "<Response noresponse='true'/>" else "<Response><SmsText>#{self.answer_text}</SmsText></Response>" end end |