Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lab2023/ttmesaj
https://github.com/lab2023/ttmesaj
Last synced: 4 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/lab2023/ttmesaj
- Owner: lab2023
- License: mit
- Created: 2012-05-08T09:03:57.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2012-06-06T09:39:32.000Z (over 12 years ago)
- Last Synced: 2024-11-25T15:14:39.504Z (2 months ago)
- Language: Ruby
- Size: 125 KB
- Stars: 2
- Watchers: 14
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
ttmesaj
=======Uygulama [http://www.ttmesaj.com/](http://www.ttmesaj.com/) servisini kullanarak kısa mesaj göndermektedir. Gönderilen kısa mesajları numara, mesaj ve statü (ttmesajdan dönen cevap) olarak db' ye kaydetmektedir.
```ruby
class Message < ActiveRecord::Base
attr_accessible :body, :numbervalidates :number, :body, :presence => true
GSM_REGEX = /^5\d{9}$/
validates :number, :format => {:with => GSM_REGEX}
#before_create :send_message, :if => lambda{ Rails.env.production?}
before_create :send_messagedef send_message
client = Savon::Client.new("http://ws.ttmesaj.com/service1.asmx?WSDL")
response = client.request :web, :send_single_sms, body: {
"username" => "kullanici adi",
"password" => "sifre",
"numbers" => "0#{self.number}",
"message" => "#{self.body}",
"origin" => "origin",
"sd" => "",
"ed" => "" }if response.success?
res = response.to_hash
if res
self.status = res[:send_single_sms_response][:send_single_sms_result]
end
end
end
end
```## Sorularınız İçin
[[email protected]](mailto:[email protected]) adresine mail gönderebilirsiniz.