Class: SoapAsync
- Inherits:
-
Object
- Object
- SoapAsync
- Defined in:
- lib/soapAsync.rb
Constant Summary collapse
- @@path =
"http://api.payamak-panel.com/post/%s.asmx?wsdl"
Instance Method Summary collapse
- #add_usance(to, from, text, isflash, scheduleStartDateTime, repeatAfterDays, scheduleEndDateTime) ⇒ Object
- #get_credit ⇒ Object
- #get_data ⇒ Object
- #get_inbox_count(isRead = false) ⇒ Object
- #get_messages(location, index, count, from = "") ⇒ Object
- #get_messages_by_date(location, index, count, dateFrom, dateTo, from = "") ⇒ Object
- #get_messages_receptions(msgId, fromRows) ⇒ Object
- #get_messages_str(location, index, count, from = "") ⇒ Object
- #get_multi_delivery(recId) ⇒ Object
- #get_price(irancellCount, mtnCount, from, text) ⇒ Object
- #get_schedule_status(scheduleId) ⇒ Object
- #get_send_with_speech(recId) ⇒ Object
- #get_users_messages_by_date(location, index, count, from, dateFrom, dateTo) ⇒ Object
-
#initialize(username, password) ⇒ SoapAsync
constructor
A new instance of SoapAsync.
- #is_delivered(recId) ⇒ Object
- #remove(msgIds) ⇒ Object
- #remove_schedule(scheduleId) ⇒ Object
- #send(to, from, text, isflash = false) ⇒ Object
- #send2(to, from, text, isflash = false, udh = "") ⇒ Object
- #send_by_base_number(text, to, bodyId) ⇒ Object
- #send_multiple_schedule(to, from, text, isflash, scheduleDateTime, period) ⇒ Object
- #send_schedule(to, from, text, isflash, scheduleDateTime, period) ⇒ Object
- #send_with_domain(to, from, text, isflash, domainName) ⇒ Object
- #send_with_speech(to, from, text, speech) ⇒ Object
- #send_with_speech_schdule_date(to, from, text, speech, scheduleDate) ⇒ Object
Constructor Details
#initialize(username, password) ⇒ SoapAsync
Returns a new instance of SoapAsync.
5 6 7 8 9 10 11 12 |
# File 'lib/soapAsync.rb', line 5 def initialize(username, password) @username = username @password = password @sendUrl = sprintf @@path,"send" @receiveUrl = sprintf @@path,"receive" @voiceUrl = sprintf @@path,"Voice" @scheduleUrl = sprintf @@path,"Schedule" end |
Instance Method Details
#add_usance(to, from, text, isflash, scheduleStartDateTime, repeatAfterDays, scheduleEndDateTime) ⇒ Object
307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 |
# File 'lib/soapAsync.rb', line 307 def add_usance(to, from, text, isflash, scheduleStartDateTime, repeatAfterDays, scheduleEndDateTime) client = Savon.client(wsdl: @scheduleUrl) data = { :to => to, :from => from, :text => text, :scheduleStartDateTime => scheduleStartDateTime, :repeatAfterDays => repeatAfterDays, :scheduleEndDateTime => scheduleEndDateTime, :isflash => isflash } response = nil t = Thread.new{response = client.call(:add_usance, message:data.merge(get_data))} t.join response.body end |
#get_credit ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/soapAsync.rb', line 19 def get_credit client = Savon.client(wsdl: @sendUrl) response = nil t = Thread.new{response = client.call(:get_credit, message:get_data)} t.join response.body end |
#get_data ⇒ Object
13 14 15 16 17 18 |
# File 'lib/soapAsync.rb', line 13 def get_data { :username => @username, :password => @password } end |
#get_inbox_count(isRead = false) ⇒ Object
200 201 202 203 204 205 206 207 208 209 |
# File 'lib/soapAsync.rb', line 200 def get_inbox_count(isRead=false) client = Savon.client(wsdl: @sendUrl) data = { :isRead => isRead } response = nil t = Thread.new{response = client.call(:get_inbox_count, message:data.merge(get_data))} t.join response.body end |
#get_messages(location, index, count, from = "") ⇒ Object
110 111 112 113 114 115 116 117 118 119 120 121 122 |
# File 'lib/soapAsync.rb', line 110 def (location, index, count, from="") client = Savon.client(wsdl: @sendUrl) data = { :location => location, :from => from, :index => index, :count => count } response = nil t = Thread.new{response = client.call(:get_messages, message:data.merge(get_data))} t.join response.body end |
#get_messages_by_date(location, index, count, dateFrom, dateTo, from = "") ⇒ Object
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
# File 'lib/soapAsync.rb', line 136 def ( location, index, count, dateFrom, dateTo, from="") client = Savon.client(wsdl: @receiveUrl) data = { :location => location, :from => from, :index => index, :count => count, :dateFrom => dateFrom, :dateTo => dateTo } response = nil t = Thread.new{response = client.call(:get_messages_by_date, message:data.merge(get_data))} t.join response.body end |
#get_messages_receptions(msgId, fromRows) ⇒ Object
151 152 153 154 155 156 157 158 159 160 161 |
# File 'lib/soapAsync.rb', line 151 def (msgId, fromRows) client = Savon.client(wsdl: @receiveUrl) data = { :msgId => msgId, :fromRows => fromRows } response = nil t = Thread.new{response = client.call(:get_messages_receptions, message:data.merge(get_data))} t.join response.body end |
#get_messages_str(location, index, count, from = "") ⇒ Object
123 124 125 126 127 128 129 130 131 132 133 134 135 |
# File 'lib/soapAsync.rb', line 123 def (location, index, count, from="") client = Savon.client(wsdl: @receiveUrl) data = { :location => location, :from => from, :index => index, :count => count } response = nil t = Thread.new{response = client.call(:get_message_str, message:data.merge(get_data))} t.join response.body end |
#get_multi_delivery(recId) ⇒ Object
247 248 249 250 251 252 253 254 255 256 |
# File 'lib/soapAsync.rb', line 247 def get_multi_delivery(recId) client = Savon.client(wsdl: @sendUrl) data = { :recId => recId } response = nil t = Thread.new{response = client.call(:get_multi_delivery2, message:data.merge(get_data))} t.join response.body end |
#get_price(irancellCount, mtnCount, from, text) ⇒ Object
187 188 189 190 191 192 193 194 195 196 197 198 199 |
# File 'lib/soapAsync.rb', line 187 def get_price(irancellCount, mtnCount, from, text) client = Savon.client(wsdl: @sendUrl) data = { :irancellCount => irancellCount, :mtnCount => mtnCount, :from => from, :text => text } response = nil t = Thread.new{response = client.call(:get_sms_price, message:data.merge(get_data))} t.join response.body end |
#get_schedule_status(scheduleId) ⇒ Object
287 288 289 290 291 292 293 294 295 296 |
# File 'lib/soapAsync.rb', line 287 def get_schedule_status(scheduleId) client = Savon.client(wsdl: @scheduleUrl) data = { :scheduleId => scheduleId } response = nil t = Thread.new{response = client.call(:get_schedule_status, message:data.merge(get_data))} t.join response.body end |
#get_send_with_speech(recId) ⇒ Object
237 238 239 240 241 242 243 244 245 246 |
# File 'lib/soapAsync.rb', line 237 def get_send_with_speech(recId) client = Savon.client(wsdl: @voiceUrl) data = { :recId => recId } response = nil t = Thread.new{response = client.call(:get_send_sms_with_speech_text_status, message:data.merge(get_data))} t.join response.body end |
#get_users_messages_by_date(location, index, count, from, dateFrom, dateTo) ⇒ Object
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 |
# File 'lib/soapAsync.rb', line 162 def (location, index, count, from,dateFrom, dateTo) client = Savon.client(wsdl: @receiveUrl) data = { :location => location, :from => from, :index => index, :count => count, :dateFrom => dateFrom, :dateTo => dateTo } response = nil t = Thread.new{response = client.call(:get_users_messages_by_date, message:data.merge(get_data))} t.join response.body end |
#is_delivered(recId) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/soapAsync.rb', line 26 def is_delivered recId client = Savon.client(wsdl: @sendUrl) response = nil if recId.kind_of?(Array) data = { :recIds => recId } t = Thread.new{response = client.call(:get_deliveries, message:data.merge(get_data))} t.join else data = { :recId => recId } t = Thread.new{response = client.call(:get_delivery, message:data.merge(get_data))} t.join end response.body end |
#remove(msgIds) ⇒ Object
177 178 179 180 181 182 183 184 185 186 |
# File 'lib/soapAsync.rb', line 177 def remove(msgIds) client = Savon.client(wsdl: @receiveUrl) data = { :msgIds => msgIds } response = nil t = Thread.new{response = client.call(:remove_messages2, message:data.merge(get_data))} t.join response.body end |
#remove_schedule(scheduleId) ⇒ Object
297 298 299 300 301 302 303 304 305 306 |
# File 'lib/soapAsync.rb', line 297 def remove_schedule(scheduleId) client = Savon.client(wsdl: @scheduleUrl) data = { :scheduleId => scheduleId } response = nil t = Thread.new{response = client.call(:remove_schedule, message:data.merge(get_data))} t.join response.body end |
#send(to, from, text, isflash = false) ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/soapAsync.rb', line 45 def send(to, from, text, isflash=false) client = Savon.client(wsdl: @sendUrl) response = nil data = { :to => to, :from => from, :text => text, :isflash => isflash } if to.kind_of?(Array) t = Thread.new{response = client.call(:send_simple_sms, message:data.merge(get_data))} t.join else t = Thread.new{response = client.call(:send_simple_sms2, message:data.merge(get_data))} t.join end response.body end |
#send2(to, from, text, isflash = false, udh = "") ⇒ Object
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/soapAsync.rb', line 64 def send2(to, from, text, isflash= false,udh="") client = Savon.client(wsdl: @sendUrl) to = to.kind_of?(Array) ? to : [to] data = { :to => to, :from => from, :text => text, :isflash => isflash, :udh => udh } response = nil t = Thread.new{response = client.call(:send_sms, message:data.merge(get_data))} t.join response.body end |
#send_by_base_number(text, to, bodyId) ⇒ Object
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/soapAsync.rb', line 93 def send_by_base_number(text, to, bodyId) client = Savon.client(wsdl: @sendUrl) response = nil data = { :text => text, :to => to, :bodyId => bodyId } if text.kind_of?(Array) t = Thread.new{response = client.call(:send_by_base_number, message:data.merge(get_data))} t.join else t = Thread.new{response = client.call(:send_by_base_number2, message:data.merge(get_data))} t.join end response.body end |
#send_multiple_schedule(to, from, text, isflash, scheduleDateTime, period) ⇒ Object
257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 |
# File 'lib/soapAsync.rb', line 257 def send_multiple_schedule(to, from, text, isflash, scheduleDateTime, period) client = Savon.client(wsdl: @scheduleUrl) data = { :to => to, :from => from, :text => text, :isflash => isflash, :scheduleDateTime => scheduleDateTime, :period => period } response = nil t = Thread.new{response = client.call(:add_multiple_schedule, message:data.merge(get_data))} t.join response.body end |
#send_schedule(to, from, text, isflash, scheduleDateTime, period) ⇒ Object
272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 |
# File 'lib/soapAsync.rb', line 272 def send_schedule(to, from, text, isflash, scheduleDateTime, period) client = Savon.client(wsdl: @scheduleUrl) data = { :to => to, :from => from, :text => text, :isflash => isflash, :scheduleDateTime => scheduleDateTime, :period => period } response = nil t = Thread.new{response = client.call(:add_schedule, message:data.merge(get_data))} t.join response.body end |
#send_with_domain(to, from, text, isflash, domainName) ⇒ Object
79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/soapAsync.rb', line 79 def send_with_domain(to, from, text, isflash, domainName) client = Savon.client(wsdl: @sendUrl) data = { :to => to, :from => from, :text => text, :isflash => isflash, :domainName => domainName } response = nil t = Thread.new{response = client.call(:send_with_domain, message:data.merge(get_data))} t.join response.body end |
#send_with_speech(to, from, text, speech) ⇒ Object
210 211 212 213 214 215 216 217 218 219 220 221 222 |
# File 'lib/soapAsync.rb', line 210 def send_with_speech(to, from, text, speech) client = Savon.client(wsdl: @voiceUrl) data = { :to => to, :from => from, :smsBody => text, :speechBody => speech } response = nil t = Thread.new{response = client.call(:send_sms_with_speech_text, message:data.merge(get_data))} t.join response.body end |
#send_with_speech_schdule_date(to, from, text, speech, scheduleDate) ⇒ Object
223 224 225 226 227 228 229 230 231 232 233 234 235 236 |
# File 'lib/soapAsync.rb', line 223 def send_with_speech_schdule_date(to, from, text, speech, scheduleDate) client = Savon.client(wsdl: @voiceUrl) data = { :to => to, :from => from, :smsBody => text, :speechBody => speech, :scheduleDate => scheduleDate } response = nil t = Thread.new{response = client.call(:send_sms_with_speech_text_by_schdule_date, message:data.merge(get_data))} t.join response.body end |