class ContactsAsync
Public Class Methods
new(username, password)
click to toggle source
# File lib/contactsAsync.rb, line 4 def initialize(username, password) @username = username @password = password @client = Savon.client(wsdl: "http://api.payamak-panel.com/post/contacts.asmx?wsdl") end
Public Instance Methods
add(options)
click to toggle source
# File lib/contactsAsync.rb, line 28 def add(options) execute(:add_contact,options) end
add_group(groupName, descriptions, showToChilds)
click to toggle source
# File lib/contactsAsync.rb, line 21 def add_group(groupName, descriptions, showToChilds) execute(:add_group,{ :groupName => groupName, :Descriptions => descriptions, :showToChilds => showToChilds }) end
change(options)
click to toggle source
# File lib/contactsAsync.rb, line 47 def change(options) execute(:change_contact,options) end
check_mobile_exist(mobileNumber)
click to toggle source
# File lib/contactsAsync.rb, line 31 def check_mobile_exist(mobileNumber) execute(:check_mobile_exist_in_contact,{ :mobileNumber => mobileNumber }) end
execute(method,data)
click to toggle source
# File lib/contactsAsync.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(groupId, keyword, from, count)
click to toggle source
# File lib/contactsAsync.rb, line 36 def get(groupId, keyword, from, count) execute(:get_contacts,{ :groupId => groupId, :keyword => keyword, :from => from, :count => count, }) end
get_data()
click to toggle source
# File lib/contactsAsync.rb, line 9 def get_data { :username => @username, :password => @password } end
get_events(contactId)
click to toggle source
# File lib/contactsAsync.rb, line 55 def get_events(contactId) execute(:get_contact_events,{ :contactId => contactId }) end
get_groups()
click to toggle source
# File lib/contactsAsync.rb, line 44 def get_groups execute(:get_groups,{}) end
remove(mobileNumber)
click to toggle source
# File lib/contactsAsync.rb, line 50 def remove(mobileNumber) execute(:remove_contact,{ :mobileNumber => mobileNumber }) end