Class: PPE_API::User

Inherits:
Object
  • Object
show all
Includes:
HappyMapper
Defined in:
lib/ppe_api/user.rb

Instance Method Summary collapse

Instance Method Details

#completed_tasksObject



21
22
23
24
25
26
27
28
# File 'lib/ppe_api/user.rb', line 21

def completed_tasks  
  exports.inject(0) do |sum,ex| 
    if ex.task_status == DR::Config.import_state_map[:completed]
      sum+=1 
    end
    sum
  end    
end

#exportsObject



16
17
18
# File 'lib/ppe_api/user.rb', line 16

def exports
  Export.find_all_by_user_id(id)
end

#importsObject



30
31
32
# File 'lib/ppe_api/user.rb', line 30

def imports
  Import.find_all_by_user_id(id)
end

#to_xml(options = {}) ⇒ Object



34
35
36
# File 'lib/ppe_api/user.rb', line 34

def to_xml(options={})
  self.as_json.to_xml({:root => "user"}.merge(options))
end