Sha256: b13eb057edc78c6523bc137317cfc250bfced565429f1ce784d8013ee58adbe6
Contents?: true
Size: 1.12 KB
Versions: 3
Compression:
Stored size: 1.12 KB
Contents
module ActiveCampaignCrm class Client # Organization Interface module Organization def organizations(params = {}) response = @connection.get('organizations', params) response['organizations'] end def organization(id) response = @connection.get("organizations/#{id}") response['organization'] end def create_organization(fields) response = @connection.post('organizations', organization_body(fields)) response['organization'] end def find_or_create_organization(name) organizations = organizations("filters[name]": name) return organizations[0] if organizations.any? create_organization(name: name) end def update_organization(id, fields) response = @connection.put("organizations/#{id}", organization_body(fields)) response['organization'] end def delete_organization(id) @connection.delete("organizations/#{id}") end def organization_body(fields) { 'organization': fields }.to_json end end end end
Version data entries
3 entries across 3 versions & 1 rubygems