Class: Crm::Activity
- Inherits:
-
Core::BasicResource
- Object
- Core::BasicResource
- Crm::Activity
- Extended by:
- Core::Mixins::Findable::ClassMethods, Core::Mixins::Modifiable::ClassMethods, Core::Mixins::Searchable::ClassMethods
- Includes:
- Core::Mixins::ChangeLoggable, Core::Mixins::Findable, Core::Mixins::Inspectable, Core::Mixins::Modifiable, Core::Mixins::Searchable
- Defined in:
- lib/crm/activity.rb
Overview
A JustRelate WebCRM activity is a record of an action or a sequence of actions, for example a support case. It can be associated with an account or a contact.
Comments
Comments can be read be means of #comments. In order to add a comment, set the following write-only attributes on Activity.create or #update:
-
comment_notes
(String) - the comment text. -
comment_contact_id
(String) - the contact ID of the comment author (optional). -
comment_published
(Boolean) - whether the comment should be visible to the associated contact of this activity (item.contact_id
). Default:false
. -
comment_attachments
(Array<String, #read>) - the comment attachments (optional). Every array element may either be an attachment ID or an object that implements#read
(e.g. an open file). In the latter case, the content will be uploaded automatically. See Core::AttachmentStore for manually uploading attachments.
Defined Under Namespace
Classes: Comment
Instance Attribute Summary collapse
-
#comments ⇒ Array<Comment>
readonly
Returns the comments of this activity.
Class Method Summary collapse
-
.create(attributes = {}) ⇒ self
Creates a new activity using the given
params
. -
.filter_attributes(attributes) ⇒ Array<Comment>
Returns the comments of this activity.
Instance Method Summary collapse
-
#update(attributes = {}) ⇒ self
Updates the attributes of this activity.
Methods included from Core::Mixins::Findable::ClassMethods
Methods included from Core::Mixins::Modifiable::ClassMethods
Methods included from Core::Mixins::Searchable::ClassMethods
all, first, query, search_configurator, where, where_not
Methods included from Core::Mixins::Inspectable
Methods included from Core::Mixins::ChangeLoggable
Methods included from Core::Mixins::Modifiable
Methods inherited from Core::BasicResource
base_type, #eql?, #id, path, #path, #reload, resource_name, #type
Methods included from Core::Mixins::AttributeProvider
#[], #attributes, #initialize, #method_missing, #methods, #raw, #respond_to_missing?
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Crm::Core::Mixins::AttributeProvider
Instance Attribute Details
#comments ⇒ Array<Comment> (readonly)
Returns the comments of this activity.
118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/crm/activity.rb', line 118 def self.filter_attributes(attributes) = attributes.delete('comment_attachments') || attributes.delete(:comment_attachments) if attributes['comment_attachments'] = .map do || if .respond_to?(:read) Core::AttachmentStore.upload() else end end end attributes end |
Class Method Details
.create(attributes = {}) ⇒ self
Creates a new activity using the given params
. See Modifiable.create for details.
35 36 37 |
# File 'lib/crm/activity.rb', line 35 def self.create(attributes = {}) super(filter_attributes(attributes)) end |
.filter_attributes(attributes) ⇒ Array<Comment>
Returns the comments of this activity.
118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/crm/activity.rb', line 118 def self.filter_attributes(attributes) = attributes.delete('comment_attachments') || attributes.delete(:comment_attachments) if attributes['comment_attachments'] = .map do || if .respond_to?(:read) Core::AttachmentStore.upload() else end end end attributes end |
Instance Method Details
#update(attributes = {}) ⇒ self
Updates the attributes of this activity. See Modifiable#update for details.
43 44 45 |
# File 'lib/crm/activity.rb', line 43 def update(attributes = {}) super(self.class.filter_attributes(attributes)) end |