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