class BranchAsync

Public Class Methods

new(username, password) click to toggle source
# File lib/branchAsync.rb, line 4
def initialize(username, password)
    @username = username
    @password = password
    @client = Savon.client(wsdl: "http://api.payamak-panel.com/post/Actions.asmx?wsdl")
end

Public Instance Methods

add(branchName, owner) click to toggle source
# File lib/branchAsync.rb, line 31
def add(branchName, owner)
    execute(:add_branch,{
        :branchName => branchName,
        :owner => owner
    })
end
add_number(mobileNumbers, branchId) click to toggle source
# File lib/branchAsync.rb, line 37
def add_number(mobileNumbers, branchId)
    execute(:add_number,{
        :mobileNumbers => mobileNumbers,
        :branchId => branchId
    })
end
execute(method,data) click to toggle source
# File lib/branchAsync.rb, line 15
def execute(method,data)
    response = nil
    t = Thread.new{response = @client.call(method, message:data.merge(get_data))}
    t.join
    response.body
end
get(owner) click to toggle source
# File lib/branchAsync.rb, line 21
def get(owner)
    execute(:get_branchs,{
        :owner => owner
    })
end
get_bulk_count(branch, rangeFrom, rangeTo) click to toggle source
# File lib/branchAsync.rb, line 71
def get_bulk_count(branch, rangeFrom, rangeTo)
    execute(:get_bulk_count,{
        :branch => branch,
        :rangeFrom => rangeFrom,
        :rangeTo => rangeTo
    })
end
get_bulk_receptions(bulkId, fromRows) click to toggle source
# File lib/branchAsync.rb, line 78
def get_bulk_receptions(bulkId, fromRows)
    execute(:get_bulk_receptions,{
        :bulkId => bulkId,
        :fromRows => fromRows
    })
end
get_bulk_status(bulkId) click to toggle source
# File lib/branchAsync.rb, line 84
def get_bulk_status(bulkId)
    execute(:get_bulk_status,{
        :bulkId => bulkId
    })
end
get_data() click to toggle source
# File lib/branchAsync.rb, line 9
def get_data
    {
        :username => @username,
        :password => @password
    }
end
get_today_sent() click to toggle source
# File lib/branchAsync.rb, line 89
def get_today_sent
    execute(:get_today_sent,{})
end
get_total_sent() click to toggle source
# File lib/branchAsync.rb, line 92
def get_total_sent
    execute(:get_total_sent,{})
end
remove(branchId) click to toggle source
# File lib/branchAsync.rb, line 26
def remove(branchId)
    execute(:remove_branch,{
        :branchId => branchId
    })
end
remove_bulk(bulkId) click to toggle source
# File lib/branchAsync.rb, line 95
def remove_bulk(bulkId)
    execute(:remove_bulk,{
        :bulkId => bulkId
    })
end
send_bulk(from, title, message, branch, dateToSend, requestCount, bulkType, rowFrom, rangeFrom, rangeTo) click to toggle source
# File lib/branchAsync.rb, line 43
def send_bulk(from, title, message, branch, dateToSend, requestCount, bulkType, rowFrom, rangeFrom, rangeTo)
    execute(:add_bulk,{
        :from => from,
        :title => title,
        :message => message,
        :branch => branch,
        :DateToSend => dateToSend,
        :requestCount => requestCount,
        :bulkType => bulkType,
        :rowFrom => rowFrom,
        :rangeFrom => rangeFrom,
        :rangeTo => rangeTo
    })
end
send_bulk2(from, title, message, branch, dateToSend, requestCount, bulkType, rowFrom, rangeFrom, rangeTo) click to toggle source
# File lib/branchAsync.rb, line 57
def send_bulk2(from, title, message, branch, dateToSend, requestCount, bulkType, rowFrom, rangeFrom, rangeTo)
    execute(:add_bulk2,{
        :from => from,
        :title => title,
        :message => message,
        :branch => branch,
        :DateToSend => dateToSend,
        :requestCount => requestCount,
        :bulkType => bulkType,
        :rowFrom => rowFrom,
        :rangeFrom => rangeFrom,
        :rangeTo => rangeTo
    })
end
send_multiple_sms(to, from, text, isflash, udh) click to toggle source
# File lib/branchAsync.rb, line 100
def send_multiple_sms(to, from, text, isflash, udh)
    data = {
        :to => to,
        :from => from,
        :text => text,
        :isflash => isflash,
        :udh => udh
    }
    if from.kind_of?(Array)
        execute(:send_multiple_sms2,data)
    else
        execute(:send_multiple_sms,data)
    end
end
update_bulk_delivery(bulkId) click to toggle source
# File lib/branchAsync.rb, line 114
def update_bulk_delivery(bulkId)
    execute(:update_bulk_delivery,{
        :bulkId => bulkId
    })
end