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