Class: Fakecrm::Activity
- Inherits:
-
Object
show all
- Includes:
- DataMapper::Resource, Kinds
- Defined in:
- lib/fakecrm/resource/activity.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Kinds
included, #one_of_a_kind?
Class Method Details
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
# File 'lib/fakecrm/resource/activity.rb', line 59
def self.( params )
if params["comment_notes"]
if params["comment_contact_id"]
contact = Contact.get!( params["comment_contact_id"].to_i )
else
contact = Contact.search(:params => {:login => 'root'}).first
end
= {
:contact_id => contact.id,
:updated_by => 'root',
:notes => params["comment_notes"].to_s,
:published => !!params["comment_published"],
:updated_at => Time.now
}
params["comments"] = (Activity.get!(params["id"].to_i). || []) rescue []
params["comments"] <<
end
params.delete("comment_notes")
params.delete("comment_contact_id")
params.delete("comment_published")
return params
rescue ::DataMapper::ObjectNotFoundError
status 404
end
|
Instance Method Details
#check_state ⇒ Object
43
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/fakecrm/resource/activity.rb', line 43
def check_state
custom_type = self.custom_type
if !custom_type.nil? && !custom_type.states.nil? && !custom_type.states.empty?
if self.state.nil? || !custom_type.states.include?(self.state)
return [false, 'ist kein gültiger Wert']
end
end
return true
end
|
#custom_type ⇒ Object
39
40
41
|
# File 'lib/fakecrm/resource/activity.rb', line 39
def custom_type
CustomType.get!(self.kind) unless self.kind.nil?
end
|