Class: Contacts
- Inherits:
-
Object
- Object
- Contacts
- Defined in:
- lib/contacts.rb
Instance Method Summary collapse
- #add(options) ⇒ Object
- #add_group(groupName, descriptions, showToChilds) ⇒ Object
- #change(options) ⇒ Object
- #check_mobile_exist(mobileNumber) ⇒ Object
- #execute(method, data) ⇒ Object
- #get(groupId, keyword, from, count) ⇒ Object
- #get_data ⇒ Object
- #get_events(contactId) ⇒ Object
- #get_groups ⇒ Object
-
#initialize(username, password) ⇒ Contacts
constructor
A new instance of Contacts.
- #remove(mobileNumber) ⇒ Object
Constructor Details
#initialize(username, password) ⇒ Contacts
4 5 6 7 8 |
# 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 |
Instance Method Details
#add(options) ⇒ Object
26 27 28 |
# File 'lib/contacts.rb', line 26 def add() execute(:add_contact,) end |
#add_group(groupName, descriptions, showToChilds) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/contacts.rb', line 19 def add_group(groupName, descriptions, showToChilds) execute(:add_group,{ :groupName => groupName, :Descriptions => descriptions, :showToChilds => showToChilds }) end |
#change(options) ⇒ Object
45 46 47 |
# File 'lib/contacts.rb', line 45 def change() execute(:change_contact,) end |
#check_mobile_exist(mobileNumber) ⇒ Object
29 30 31 32 33 |
# File 'lib/contacts.rb', line 29 def check_mobile_exist(mobileNumber) execute(:check_mobile_exist_in_contact,{ :mobileNumber => mobileNumber }) end |
#execute(method, data) ⇒ Object
15 16 17 18 |
# 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) ⇒ Object
34 35 36 37 38 39 40 41 |
# 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 ⇒ Object
9 10 11 12 13 14 |
# File 'lib/contacts.rb', line 9 def get_data { :username => @username, :password => @password } end |
#get_events(contactId) ⇒ Object
53 54 55 56 57 |
# File 'lib/contacts.rb', line 53 def get_events(contactId) execute(:get_contact_events,{ :contactId => contactId }) end |
#get_groups ⇒ Object
42 43 44 |
# File 'lib/contacts.rb', line 42 def get_groups execute(:get_groups,{}) end |
#remove(mobileNumber) ⇒ Object
48 49 50 51 52 |
# File 'lib/contacts.rb', line 48 def remove(mobileNumber) execute(:remove_contact,{ :mobileNumber => mobileNumber }) end |