class TicketAsync
Public Class Methods
new(username, password)
click to toggle source
# File lib/ticketAsync.rb, line 4 def initialize(username, password) @username = username @password = password @client = Savon.client(wsdl: "http://api.payamak-panel.com/post/Tickets.asmx?wsdl") end
Public Instance Methods
add(title, content, aws=true)
click to toggle source
# File lib/ticketAsync.rb, line 21 def add(title, content, aws=true) execute(:add_ticket,{ :title => title, :content => content, :alertWithSms => alertWithSms }) end
execute(method,data)
click to toggle source
# File lib/ticketAsync.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_data()
click to toggle source
# File lib/ticketAsync.rb, line 9 def get_data { :username => @username, :password => @password } end
get_received(ticketOwner, ticketType, keyword)
click to toggle source
# File lib/ticketAsync.rb, line 28 def get_received(ticketOwner, ticketType, keyword) execute(:get_received_tickets,{ :ticketOwner => ticketOwner, :ticketType => ticketType, :keyword => keyword }) end
get_received_count(ticketType)
click to toggle source
# File lib/ticketAsync.rb, line 35 def get_received_count(ticketType) execute(:get_received_tickets_count,{ :ticketType => ticketType }) end
get_sent(ticketOwner, ticketType, keyword)
click to toggle source
# File lib/ticketAsync.rb, line 40 def get_sent(ticketOwner, ticketType, keyword) execute(:get_sent_tickets,{ :ticketOwner => ticketOwner, :ticketType => ticketType, :keyword => keyword }) end
get_sent_count(ticketType)
click to toggle source
# File lib/ticketAsync.rb, line 47 def get_sent_count(ticketType) execute(:get_sent_tickets_count,{ :ticketType => ticketType }) end
response(ticketId, type, content, alertWithSms=true)
click to toggle source
# File lib/ticketAsync.rb, line 52 def response(ticketId, type, content, alertWithSms=true) execute(:response_ticket,{ :ticketId => ticketId, :content => content, :alertWithSms => alertWithSms, :type => type }) end