Class: UsersAsync
- Inherits:
-
Object
- Object
- UsersAsync
- Defined in:
- lib/usersAsync.rb
Instance Method Summary collapse
- #add(options) ⇒ Object
- #add_complete(options) ⇒ Object
- #add_payment(options) ⇒ Object
- #add_with_location(options) ⇒ Object
- #authenticate ⇒ Object
- #change_credit(amount, description, targetUsername, getTax) ⇒ Object
- #execute(method, data) ⇒ Object
- #forgot_password(mobileNumber, emailAddress, targetUsername) ⇒ Object
- #get ⇒ Object
- #get_base_price(targetUsername) ⇒ Object
- #get_cities(provinceId) ⇒ Object
- #get_credit(targetUsername) ⇒ Object
- #get_data ⇒ Object
- #get_details(targetUsername) ⇒ Object
- #get_expire_date ⇒ Object
- #get_numbers ⇒ Object
- #get_provinces ⇒ Object
- #get_transactions(targetUsername, creditType, dateFrom, dateTo, keyword) ⇒ Object
- #has_filter(text) ⇒ Object
-
#initialize(username, password) ⇒ UsersAsync
constructor
A new instance of UsersAsync.
- #remove(targetUsername) ⇒ Object
Constructor Details
#initialize(username, password) ⇒ UsersAsync
Returns a new instance of UsersAsync.
4 5 6 7 8 |
# File 'lib/usersAsync.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
24 25 26 |
# File 'lib/usersAsync.rb', line 24 def add() execute(:add_user,) end |
#add_complete(options) ⇒ Object
27 28 29 |
# File 'lib/usersAsync.rb', line 27 def add_complete() execute(:add_user_complete,) end |
#add_payment(options) ⇒ Object
21 22 23 |
# File 'lib/usersAsync.rb', line 21 def add_payment() execute(:add_payment,) end |
#add_with_location(options) ⇒ Object
30 31 32 |
# File 'lib/usersAsync.rb', line 30 def add_with_location() execute(:add_user_with_location,) end |
#authenticate ⇒ Object
33 34 35 |
# File 'lib/usersAsync.rb', line 33 def authenticate execute(:authenticate_user,{}) end |
#change_credit(amount, description, targetUsername, getTax) ⇒ Object
36 37 38 39 40 41 42 43 44 |
# File 'lib/usersAsync.rb', line 36 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 19 20 |
# File 'lib/usersAsync.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 |
#forgot_password(mobileNumber, emailAddress, targetUsername) ⇒ Object
45 46 47 48 49 50 51 |
# File 'lib/usersAsync.rb', line 45 def forgot_password(mobileNumber, emailAddress, targetUsername) execute(:forgot_password,{ :mobileNumber => mobileNumber, :emailAddress => emailAddress, :targetUsername => targetUsername }) end |
#get ⇒ Object
95 96 97 |
# File 'lib/usersAsync.rb', line 95 def get execute(:get_users,{}) end |
#get_base_price(targetUsername) ⇒ Object
52 53 54 55 56 |
# File 'lib/usersAsync.rb', line 52 def get_base_price(targetUsername) execute(:get_user_base_price,{ :targetUsername => targetUsername }) end |
#get_cities(provinceId) ⇒ Object
78 79 80 81 82 |
# File 'lib/usersAsync.rb', line 78 def get_cities(provinceId) execute(:get_cities,{ :provinceId => provinceId }) end |
#get_credit(targetUsername) ⇒ Object
62 63 64 65 66 |
# File 'lib/usersAsync.rb', line 62 def get_credit(targetUsername) execute(:get_user_credit,{ :targetUsername => targetUsername }) end |
#get_data ⇒ Object
9 10 11 12 13 14 |
# File 'lib/usersAsync.rb', line 9 def get_data { :username => @username, :password => @password } end |
#get_details(targetUsername) ⇒ Object
67 68 69 70 71 |
# File 'lib/usersAsync.rb', line 67 def get_details(targetUsername) execute(:get_user_details,{ :targetUsername => targetUsername }) end |
#get_expire_date ⇒ Object
83 84 85 |
# File 'lib/usersAsync.rb', line 83 def get_expire_date execute(:get_expire_date,{}) end |
#get_numbers ⇒ Object
72 73 74 |
# File 'lib/usersAsync.rb', line 72 def get_numbers execute(:get_user_numbers,{}) end |
#get_provinces ⇒ Object
75 76 77 |
# File 'lib/usersAsync.rb', line 75 def get_provinces execute(:get_provinces,{}) end |
#get_transactions(targetUsername, creditType, dateFrom, dateTo, keyword) ⇒ Object
86 87 88 89 90 91 92 93 94 |
# File 'lib/usersAsync.rb', line 86 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
98 99 100 101 102 |
# File 'lib/usersAsync.rb', line 98 def has_filter(text) execute(:has_filter,{ :text => text }) end |
#remove(targetUsername) ⇒ Object
57 58 59 60 61 |
# File 'lib/usersAsync.rb', line 57 def remove(targetUsername) execute(:remove_user,{ :targetUsername => targetUsername }) end |