Sha256: 82c71b07e131aedb0e9759fa372971390f05d8b36c86db9867315c071cff163e

Contents?: true

Size: 920 Bytes

Versions: 6

Compression:

Stored size: 920 Bytes

Contents

module ActiveCampaignCrm
  class Client
    module Contacts
      def contacts(params = {})
        response = @connection.get('contacts', params)
        response['contacts']
      end

      def contact(id)
        response = @connection.get("contacts/#{id}")
        response['contact']
      end

      def create_contact(fields)
        response = @connection.post('contacts', contact_body(fields))
        response['contact']
      end

      def sync_contact(fields)
        response = @connection.post('contact/sync', contact_body(fields))
        response['contact']
      end

      def update_contact(id, fields)
        response = @connection.put("contacts/#{id}", contact_body(fields))
        response['contact']
      end

      def delete_contact(id)
        @connection.delete("contacts/#{id}")
      end

      def contact_body(fields)
        { 'contact': fields }.to_json
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
active_campaign_crm-0.2.1 lib/active_campaign_crm/client/contacts.rb
active_campaign_crm-0.2.0 lib/active_campaign_crm/client/contacts.rb
active_campaign_crm-0.1.4 lib/active_campaign_crm/client/contacts.rb
active_campaign_crm-0.1.3 lib/active_campaign_crm/client/contacts.rb
active_campaign_crm-0.1.2 lib/active_campaign_crm/client/contacts.rb
active_campaign_crm-0.1.1 lib/active_campaign_crm/client/contacts.rb