Class: Ticket
- Inherits:
-
Object
- Object
- Ticket
- Defined in:
- lib/ticket.rb
Instance Method Summary collapse
- #add(title, content, aws = true) ⇒ Object
- #execute(method, data) ⇒ Object
- #get_data ⇒ Object
- #get_received(ticketOwner, ticketType, keyword) ⇒ Object
- #get_received_count(ticketType) ⇒ Object
- #get_sent(ticketOwner, ticketType, keyword) ⇒ Object
- #get_sent_count(ticketType) ⇒ Object
-
#initialize(username, password) ⇒ Ticket
constructor
A new instance of Ticket.
- #response(ticketId, type, content, alertWithSms = true) ⇒ Object
Constructor Details
#initialize(username, password) ⇒ Ticket
Returns a new instance of Ticket.
4 5 6 7 8 |
# File 'lib/ticket.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 |
Instance Method Details
#add(title, content, aws = true) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/ticket.rb', line 19 def add(title, content, aws=true) execute(:add_ticket,{ :title => title, :content => content, :alertWithSms => alertWithSms }) end |
#execute(method, data) ⇒ Object
15 16 17 18 |
# File 'lib/ticket.rb', line 15 def execute(method,data) response = @client.call(method, message:data.merge(get_data)) response.body end |
#get_data ⇒ Object
9 10 11 12 13 14 |
# File 'lib/ticket.rb', line 9 def get_data { :username => @username, :password => @password } end |
#get_received(ticketOwner, ticketType, keyword) ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/ticket.rb', line 26 def get_received(ticketOwner, ticketType, keyword) execute(:get_received_tickets,{ :ticketOwner => ticketOwner, :ticketType => ticketType, :keyword => keyword }) end |
#get_received_count(ticketType) ⇒ Object
33 34 35 36 37 |
# File 'lib/ticket.rb', line 33 def get_received_count(ticketType) execute(:get_received_tickets_count,{ :ticketType => ticketType }) end |
#get_sent(ticketOwner, ticketType, keyword) ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/ticket.rb', line 38 def get_sent(ticketOwner, ticketType, keyword) execute(:get_sent_tickets,{ :ticketOwner => ticketOwner, :ticketType => ticketType, :keyword => keyword }) end |
#get_sent_count(ticketType) ⇒ Object
45 46 47 48 49 |
# File 'lib/ticket.rb', line 45 def get_sent_count(ticketType) execute(:get_sent_tickets_count,{ :ticketType => ticketType }) end |
#response(ticketId, type, content, alertWithSms = true) ⇒ Object
50 51 52 53 54 55 56 57 |
# File 'lib/ticket.rb', line 50 def response(ticketId, type, content, alertWithSms=true) execute(:response_ticket,{ :ticketId => ticketId, :content => content, :alertWithSms => alertWithSms, :type => type }) end |