module ActiveCampaignCrm::Client::Organization
Organization
Interface
Public Instance Methods
create_organization(fields)
click to toggle source
# File lib/active_campaign_crm/client/organizations.rb, line 15 def create_organization(fields) response = @connection.post('organizations', organization_body(fields)) response['organization'] end
delete_organization(id)
click to toggle source
# File lib/active_campaign_crm/client/organizations.rb, line 33 def delete_organization(id) @connection.delete("organizations/#{id}") end
find_or_create_organization(name)
click to toggle source
# File lib/active_campaign_crm/client/organizations.rb, line 20 def find_or_create_organization(name) organizations = organizations("filters[name]": name) return organizations[0] if organizations.any? create_organization(name: name) end
organization(id)
click to toggle source
# File lib/active_campaign_crm/client/organizations.rb, line 10 def organization(id) response = @connection.get("organizations/#{id}") response['organization'] end
organization_body(fields)
click to toggle source
# File lib/active_campaign_crm/client/organizations.rb, line 37 def organization_body(fields) { 'organization': fields }.to_json end
organizations(params = {})
click to toggle source
# File lib/active_campaign_crm/client/organizations.rb, line 5 def organizations(params = {}) response = @connection.get('organizations', params) response['organizations'] end
update_organization(id, fields)
click to toggle source
# File lib/active_campaign_crm/client/organizations.rb, line 27 def update_organization(id, fields) response = @connection.put("organizations/#{id}", organization_body(fields)) response['organization'] end