Class: TaskMapper::Provider::Bcx::Project

Inherits:
TaskMapper::Provider::Base::Project
  • Object
show all
Defined in:
lib/provider/project.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*object) ⇒ Project

Returns a new instance of Project.



4
5
6
7
# File 'lib/provider/project.rb', line 4

def initialize(*object)
  object = object.first if object.is_a?(Array)
  super object if object.is_a?(Hash)
end

Class Method Details

.find_allObject



30
31
32
33
34
# File 'lib/provider/project.rb', line 30

def find_all
  projects = api.projects
  projects = projects.select { |project| project.is_a?(Hash) }
  projects.collect { |project| self.new project }
end

.find_by_attributes(attributes = {}) ⇒ Object



26
27
28
# File 'lib/provider/project.rb', line 26

def find_by_attributes(attributes = {})
  search_by_attribute(self.find_all, attributes)
end

.find_by_id(id) ⇒ Object



36
37
38
39
# File 'lib/provider/project.rb', line 36

def find_by_id(id)
  project = api.project(id)
  self.new Hash[project]
end

Instance Method Details

#created_atObject



17
18
19
20
21
22
23
# File 'lib/provider/project.rb', line 17

def created_at
  begin
    Time.parse(self[:created_at])
  rescue
    self[:created_at]
  end
end

#updated_atObject



9
10
11
12
13
14
15
# File 'lib/provider/project.rb', line 9

def updated_at
  begin
    Time.parse(self[:updated_at])
  rescue
    self[:updated_at]
  end
end