Module: IContact::Api::Contacts
- Included in:
- IContact::Api
- Defined in:
- lib/icontact/api/contacts.rb
Instance Method Summary collapse
- #create_contact(data) ⇒ Object
- #create_contacts(data) ⇒ Object
- #delete_contact(id) ⇒ Object
- #find_contacts(data) ⇒ Object
- #get_contact(id) ⇒ Object
- #get_contacts(limit = 10000) ⇒ Object
- #update_contact(id, data) ⇒ Object
- #update_contact!(id, data) ⇒ Object
- #update_contacts(data) ⇒ Object
Instance Method Details
#create_contact(data) ⇒ Object
16 17 18 19 |
# File 'lib/icontact/api/contacts.rb', line 16 def create_contact(data) response = post(contacts_path, wrap(data)) resource(response, 'contacts', true) end |
#create_contacts(data) ⇒ Object
21 22 23 24 |
# File 'lib/icontact/api/contacts.rb', line 21 def create_contacts(data) response = post(contacts_path, data) resource(response, 'contacts') end |
#delete_contact(id) ⇒ Object
43 44 45 46 47 |
# File 'lib/icontact/api/contacts.rb', line 43 def delete_contact(id) ensure_valid_id(id) response = delete(contacts_path + id) resource(response, 'status') end |
#find_contacts(data) ⇒ Object
49 50 51 52 53 54 |
# File 'lib/icontact/api/contacts.rb', line 49 def find_contacts(data) ensure_valid_data(data) data.merge!(limit: 10000) unless data.has_key?(:limit) response = get(contacts_path + query(data)) resource(response, 'contacts') end |
#get_contact(id) ⇒ Object
5 6 7 8 9 |
# File 'lib/icontact/api/contacts.rb', line 5 def get_contact(id) ensure_valid_id(id) response = get(contacts_path + id) resource(response, 'contact') end |
#get_contacts(limit = 10000) ⇒ Object
11 12 13 14 |
# File 'lib/icontact/api/contacts.rb', line 11 def get_contacts(limit = 10000) response = get(contacts_path + query(limit: limit)) resource(response, 'contacts') end |
#update_contact(id, data) ⇒ Object
26 27 28 29 30 |
# File 'lib/icontact/api/contacts.rb', line 26 def update_contact(id, data) ensure_valid_id(id) response = post(contacts_path + id, data) resource(response, 'contact') end |
#update_contact!(id, data) ⇒ Object
32 33 34 35 36 |
# File 'lib/icontact/api/contacts.rb', line 32 def update_contact!(id, data) ensure_valid_id(id) response = put(contacts_path + id, data) resource(response, 'contact') end |
#update_contacts(data) ⇒ Object
38 39 40 41 |
# File 'lib/icontact/api/contacts.rb', line 38 def update_contacts(data) response = post(contacts_path, data) resource(response, 'contacts') end |