class ActiveCampaign::ContactTag

@example ContactTags

contact = ActiveCampaign::Contact.find(1)
tag = ActiveCampaign::Tag.find(1)

ActiveCampaing::ContactTag.create contact: contact, tag: tag

Public Instance Methods

create() click to toggle source
Calls superclass method
# File lib/active_campaign/models/contact_tag.rb, line 15
def create
  self.tag = extract_id_from_tag(tag)
  self.contact = extract_id_from_contact(contact)

  super
end

Private Instance Methods

extract_id_from_contact(contact) click to toggle source
# File lib/active_campaign/models/contact_tag.rb, line 32
def extract_id_from_contact(contact)
  case contact
  when ::ActiveCampaign::Contact then contact.id
  else
    contact
  end
end
extract_id_from_tag(tag) click to toggle source
# File lib/active_campaign/models/contact_tag.rb, line 24
def extract_id_from_tag(tag)
  case tag
  when ::ActiveCampaign::Tag then tag.id
  else
    tag
  end
end