Class: Branch

Inherits:
Object
  • Object
show all
Defined in:
lib/branch.rb

Instance Method Summary collapse

Constructor Details

#initialize(username, password) ⇒ Branch

Returns a new instance of Branch.



4
5
6
7
8
# File 'lib/branch.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

Instance Method Details

#add(branchName, owner) ⇒ Object



29
30
31
32
33
34
# File 'lib/branch.rb', line 29

def add(branchName, owner)
    execute(:add_branch,{
        :branchName => branchName,
        :owner => owner
    })
end

#add_number(mobileNumbers, branchId) ⇒ Object



35
36
37
38
39
40
# File 'lib/branch.rb', line 35

def add_number(mobileNumbers, branchId)
    execute(:add_number,{
        :mobileNumbers => mobileNumbers,
        :branchId => branchId
    })
end

#execute(method, data) ⇒ Object



15
16
17
18
# File 'lib/branch.rb', line 15

def execute(method,data)
    response = @client.call(method, message:data.merge(get_data))
    response.body
end

#get(owner) ⇒ Object



19
20
21
22
23
# File 'lib/branch.rb', line 19

def get(owner)
    execute(:get_branchs,{
        :owner => owner
    })
end

#get_bulk_count(branch, rangeFrom, rangeTo) ⇒ Object



69
70
71
72
73
74
75
# File 'lib/branch.rb', line 69

def get_bulk_count(branch, rangeFrom, rangeTo)
    execute(:get_bulk_count,{
        :branch => branch,
        :rangeFrom => rangeFrom,
        :rangeTo => rangeTo
    })
end

#get_bulk_receptions(bulkId, fromRows) ⇒ Object



76
77
78
79
80
81
# File 'lib/branch.rb', line 76

def get_bulk_receptions(bulkId, fromRows)
    execute(:get_bulk_receptions,{
        :bulkId => bulkId,
        :fromRows => fromRows
    })
end

#get_bulk_status(bulkId) ⇒ Object



82
83
84
85
86
# File 'lib/branch.rb', line 82

def get_bulk_status(bulkId)
    execute(:get_bulk_status,{
        :bulkId => bulkId
    })
end

#get_dataObject



9
10
11
12
13
14
# File 'lib/branch.rb', line 9

def get_data
    {
        :username => @username,
        :password => @password
    }
end

#get_today_sentObject



87
88
89
# File 'lib/branch.rb', line 87

def get_today_sent
    execute(:get_today_sent,{})
end

#get_total_sentObject



90
91
92
# File 'lib/branch.rb', line 90

def get_total_sent
    execute(:get_total_sent,{})
end

#remove(branchId) ⇒ Object



24
25
26
27
28
# File 'lib/branch.rb', line 24

def remove(branchId)
    execute(:remove_branch,{
        :branchId => branchId
    })
end

#remove_bulk(bulkId) ⇒ Object



93
94
95
96
97
# File 'lib/branch.rb', line 93

def remove_bulk(bulkId)
    execute(:remove_bulk,{
        :bulkId => bulkId
    })
end

#send_bulk(from, title, message, branch, dateToSend, requestCount, bulkType, rowFrom, rangeFrom, rangeTo) ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/branch.rb', line 41

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) ⇒ Object



55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/branch.rb', line 55

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) ⇒ Object



98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/branch.rb', line 98

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) ⇒ Object



112
113
114
115
116
# File 'lib/branch.rb', line 112

def update_bulk_delivery(bulkId)
    execute(:update_bulk_delivery,{
        :bulkId => bulkId
    })
end