Module: ActiveCampaignCrm::Client::Contacts
- Included in:
- ActiveCampaignCrm::Client
- Defined in:
- lib/active_campaign_crm/client/contacts.rb
Instance Method Summary collapse
- #contact(id) ⇒ Object
- #contact_body(fields) ⇒ Object
- #contacts(params = {}) ⇒ Object
- #create_contact(fields) ⇒ Object
- #delete_contact(id) ⇒ Object
- #sync_contact(fields) ⇒ Object
- #update_contact(id, fields) ⇒ Object
Instance Method Details
#contact(id) ⇒ Object
9 10 11 12 |
# File 'lib/active_campaign_crm/client/contacts.rb', line 9 def contact(id) response = @connection.get("contacts/#{id}") response['contact'] end |
#contact_body(fields) ⇒ Object
33 34 35 |
# File 'lib/active_campaign_crm/client/contacts.rb', line 33 def contact_body(fields) { 'contact': fields }.to_json end |
#contacts(params = {}) ⇒ Object
4 5 6 7 |
# File 'lib/active_campaign_crm/client/contacts.rb', line 4 def contacts(params = {}) response = @connection.get('contacts', params) response['contacts'] end |
#create_contact(fields) ⇒ Object
14 15 16 17 |
# File 'lib/active_campaign_crm/client/contacts.rb', line 14 def create_contact(fields) response = @connection.post('contacts', contact_body(fields)) response['contact'] end |
#delete_contact(id) ⇒ Object
29 30 31 |
# File 'lib/active_campaign_crm/client/contacts.rb', line 29 def delete_contact(id) @connection.delete("contacts/#{id}") end |
#sync_contact(fields) ⇒ Object
19 20 21 22 |
# File 'lib/active_campaign_crm/client/contacts.rb', line 19 def sync_contact(fields) response = @connection.post('contact/sync', contact_body(fields)) response['contact'] end |
#update_contact(id, fields) ⇒ Object
24 25 26 27 |
# File 'lib/active_campaign_crm/client/contacts.rb', line 24 def update_contact(id, fields) response = @connection.put("contacts/#{id}", contact_body(fields)) response['contact'] end |