Sha256: ecf363385ee456c47e3de11c084cb1a38c60664dbf754e45788ac1ae177d0e79
Contents?: true
Size: 810 Bytes
Versions: 1
Compression:
Stored size: 810 Bytes
Contents
# frozen_string_literal: true module ActiveCampaign # # @example ContactTags # # contact = ActiveCampaign::Contact.find(email: "contact-email@mail.com") # tag = ActiveCampaign::Tag.find_by(tag: "tag-name") # # ActiveCampaing::ContactTag.create contact: contact, tag: tag # class ContactTag < Model define_attributes :contact, :tag def create self.tag = extract_id_from_tag(tag) self.contact = extract_id_from_contact(contact) super end private def extract_id_from_tag(tag) case tag when ::ActiveCampaign::Tag then tag.id else tag end end def extract_id_from_contact(contact) case contact when ::ActiveCampaign::Contact then contact.id else contact end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ractive_campaign-0.1.1 | lib/active_campaign/models/contact_tag.rb |