Class: Users

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

Instance Method Summary collapse

Constructor Details

#initialize(username, password) ⇒ Users



4
5
6
7
8
# File 'lib/users.rb', line 4

def initialize(username, password)
    @username = username
    @password = password
    @client = Savon.client(wsdl: "http://api.payamak-panel.com/post/users.asmx?wsdl")
end

Instance Method Details

#add(options) ⇒ Object



22
23
24
# File 'lib/users.rb', line 22

def add(options)
    execute(:add_user,options)
end

#add_complete(options) ⇒ Object



25
26
27
# File 'lib/users.rb', line 25

def add_complete(options)
    execute(:add_user_complete,options)
end

#add_payment(options) ⇒ Object



19
20
21
# File 'lib/users.rb', line 19

def add_payment(options)
    execute(:add_payment,options)
end

#add_with_location(options) ⇒ Object



28
29
30
# File 'lib/users.rb', line 28

def add_with_location(options)
    execute(:add_user_with_location,options)
end

#authenticateObject



31
32
33
# File 'lib/users.rb', line 31

def authenticate
    execute(:authenticate_user,{})
end

#change_credit(amount, description, targetUsername, getTax) ⇒ Object



34
35
36
37
38
39
40
41
42
# File 'lib/users.rb', line 34

def change_credit(amount, description, targetUsername, getTax)
    execute(:change_user_credit,{
        :amount => amount,
        :description => description,
        :targetUsername => targetUsername,
        :GetTax => getTax

    })
end

#execute(method, data) ⇒ Object



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

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

#forgot_password(mobileNumber, emailAddress, targetUsername) ⇒ Object



43
44
45
46
47
48
49
# File 'lib/users.rb', line 43

def forgot_password(mobileNumber, emailAddress, targetUsername)
    execute(:forgot_password,{
        :mobileNumber => mobileNumber,
        :emailAddress => emailAddress,
        :targetUsername => targetUsername
    })
end

#getObject



93
94
95
# File 'lib/users.rb', line 93

def get
    execute(:get_users,{})
end

#get_base_price(targetUsername) ⇒ Object



50
51
52
53
54
# File 'lib/users.rb', line 50

def get_base_price(targetUsername)
    execute(:get_user_base_price,{
        :targetUsername => targetUsername
    })
end

#get_cities(provinceId) ⇒ Object



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

def get_cities(provinceId)
    execute(:get_cities,{
        :provinceId => provinceId
    })
end

#get_credit(targetUsername) ⇒ Object



60
61
62
63
64
# File 'lib/users.rb', line 60

def get_credit(targetUsername)
    execute(:get_user_credit,{
        :targetUsername => targetUsername
    })
end

#get_dataObject



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

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

#get_details(targetUsername) ⇒ Object



65
66
67
68
69
# File 'lib/users.rb', line 65

def get_details(targetUsername)
    execute(:get_user_details,{
        :targetUsername => targetUsername
    })
end

#get_expire_dateObject



81
82
83
# File 'lib/users.rb', line 81

def get_expire_date
    execute(:get_expire_date,{})
end

#get_numbersObject



70
71
72
# File 'lib/users.rb', line 70

def get_numbers
    execute(:get_user_numbers,{})
end

#get_provincesObject



73
74
75
# File 'lib/users.rb', line 73

def get_provinces
    execute(:get_provinces,{})
end

#get_transactions(targetUsername, creditType, dateFrom, dateTo, keyword) ⇒ Object



84
85
86
87
88
89
90
91
92
# File 'lib/users.rb', line 84

def get_transactions(targetUsername, creditType, dateFrom, dateTo, keyword)
    execute(:get_user_transactions,{
        :creditType => creditType,
        :dateFrom => dateFrom,
        :targetUsername => targetUsername,
        :dateTo => dateTo,
        :keyword => keyword
    })
end

#has_filter(text) ⇒ Object



96
97
98
99
100
# File 'lib/users.rb', line 96

def has_filter(text)
    execute(:has_filter,{
        :text => text
    })
end

#remove(targetUsername) ⇒ Object



55
56
57
58
59
# File 'lib/users.rb', line 55

def remove(targetUsername)
    execute(:remove_user,{
        :targetUsername => targetUsername
    })
end