Module: CapsuleCRM::History
- Included in:
- Party
- Defined in:
- lib/capsulecrm/history.rb
Instance Method Summary collapse
- #add_history(note) ⇒ Object (also: #add_note)
-
#history ⇒ Object
Load history if not loaded.
-
#history! ⇒ Object
Reload history.
Instance Method Details
#add_history(note) ⇒ Object Also known as: add_note
20 21 22 23 24 25 26 27 28 |
# File 'lib/capsulecrm/history.rb', line 20 def add_history(note) if note path = [self.class.get_path, self.id, 'history'].join '/' self.class.create(Hash[{:note => note}], {:root => 'historyItem', :path => path}) # TODO : Should be optimized so it doesn't reload history each time @history = nil end end |
#history ⇒ Object
Load history if not loaded
9 10 11 12 13 14 15 16 17 |
# File 'lib/capsulecrm/history.rb', line 9 def history return @history if @history path = self.class.get_path path = [path, id, 'history'].join '/' last_response = self.class.get(path) data = last_response['history'].try(:[], 'historyItem') @history = CapsuleCRM::HistoryItem.init_many(self, data) end |
#history! ⇒ Object
Reload history
3 4 5 6 |
# File 'lib/capsulecrm/history.rb', line 3 def history! @history = nil history end |