Class: Mautic::Contact
- Inherits:
-
Model
- Object
- OpenStruct
- Model
- Mautic::Contact
show all
- Defined in:
- app/models/mautic/contact.rb
Instance Attribute Summary
Attributes inherited from Model
#connection
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Model
#attributes, #attributes=, #changes, #create, #destroy, endpoint, #initialize, #mautic_id, #save, #update
Constructor Details
This class inherits a constructor from Mautic::Model
Class Method Details
.in(connection) ⇒ Object
6
7
8
|
# File 'app/models/mautic/contact.rb', line 6
def self.in(connection)
Proxy.new(connection, endpoint, default_params: { search: '!is:anonymous' })
end
|
Instance Method Details
#assign_attributes(source = nil) ⇒ Object
14
15
16
17
18
19
|
# File 'app/models/mautic/contact.rb', line 14
def assign_attributes(source = nil)
super
self.attributes = {
tags: (source['tags'] || []).collect { |t| Mautic::Tag.new(@connection, t) }.sort_by(&:name)
} if source
end
|
#events ⇒ Object
21
22
23
|
# File 'app/models/mautic/contact.rb', line 21
def events
@proxy_events ||= Proxy.new(connection, "contacts/#{id}/events", klass: "Mautic::Event")
end
|
#name ⇒ Object
10
11
12
|
# File 'app/models/mautic/contact.rb', line 10
def name
"#{firstname} #{lastname}"
end
|