Sha256: b138b6341185da275a0d9a119a6095290a9882c91b96415c07112c683d48d79c

Contents?: true

Size: 634 Bytes

Versions: 3

Compression:

Stored size: 634 Bytes

Contents

module Mautic
  class Contact < Model

    alias_attribute :first_name, :firstname
    alias_attribute :last_name, :lastname
    def self.in(connection)
      Proxy.new(connection, endpoint, default_params: { search: '!is:anonymous' })
    end

    def name
      "#{firstname} #{lastname}"
    end

    def assign_attributes(source = nil)
      super
      self.attributes = {
        tags: (source['tags'] || []).collect { |t| Mautic::Tag.new(@connection, t) }.sort_by(&:name)
      } if source
    end

    def events
      @proxy_events ||= Proxy.new(connection, "contacts/#{id}/events", klass: "Mautic::Event")
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mautic-2.3.4 app/models/mautic/contact.rb
mautic-2.3.3 app/models/mautic/contact.rb
mautic-2.3.1 app/models/mautic/contact.rb