class Contacts

Public Class Methods

new(username, password) click to toggle source
# File lib/contacts.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/contacts.rb, line 26
def add(options)
    execute(:add_contact,options)
end
add_group(groupName, descriptions, showToChilds) click to toggle source
# File lib/contacts.rb, line 19
def add_group(groupName, descriptions, showToChilds)
    execute(:add_group,{
        :groupName => groupName,
        :Descriptions => descriptions,
        :showToChilds => showToChilds
    })
end
change(options) click to toggle source
# File lib/contacts.rb, line 45
def change(options)
    execute(:change_contact,options)
end
check_mobile_exist(mobileNumber) click to toggle source
# File lib/contacts.rb, line 29
def check_mobile_exist(mobileNumber)
    execute(:check_mobile_exist_in_contact,{
        :mobileNumber => mobileNumber
    })
end
execute(method,data) click to toggle source
# File lib/contacts.rb, line 15
def execute(method,data)
    response = @client.call(method, message:data.merge(get_data))
    response.body
end
get(groupId, keyword, from, count) click to toggle source
# File lib/contacts.rb, line 34
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/contacts.rb, line 9
def get_data
    {
        :username => @username,
        :password => @password
    }
end
get_events(contactId) click to toggle source
# File lib/contacts.rb, line 53
def get_events(contactId)
    execute(:get_contact_events,{
        :contactId => contactId
    })
end
get_groups() click to toggle source
# File lib/contacts.rb, line 42
def get_groups
    execute(:get_groups,{})
end
remove(mobileNumber) click to toggle source
# File lib/contacts.rb, line 48
def remove(mobileNumber)
    execute(:remove_contact,{
        :mobileNumber => mobileNumber
    })
end