Module: Cashboard::Behaviors::Toggleable

Included in:
Estimate, Project
Defined in:
lib/cashboard/behaviors/toggleable.rb

Overview

Standard interface to toggle the status of something between Active and Closed inside Cashboard.

Instance Method Summary collapse

Instance Method Details

#toggle_statusObject

Toggles status of the project between active/closed and sets appropriate variable.



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/cashboard/behaviors/toggleable.rb', line 6

def toggle_status
  options = self.class.merge_options()
  options.merge!({:body => self.to_xml})
  response = self.class.put(self.links[:toggle_status], options)
  begin 
    self.class.check_status_code(response)
  rescue
    return false
  end
  self.is_active = !self.is_active
  return true
end