class TaskMapper::Provider::Bcx::Project

Public Class Methods

find_all() click to toggle source
# 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 = {}) click to toggle source
# File lib/provider/project.rb, line 26
def find_by_attributes(attributes = {})
  search_by_attribute(self.find_all, attributes)
end
find_by_id(id) click to toggle source
# File lib/provider/project.rb, line 36
def find_by_id(id)
  project = api.project(id)
  self.new Hash[project]
end
new(*object) click to toggle source
Calls superclass method
# 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

Private Class Methods

api() click to toggle source
# File lib/provider/project.rb, line 42
def api
  TaskMapper::Provider::Bcx.api
end

Public Instance Methods

created_at() click to toggle source
# File lib/provider/project.rb, line 17
def created_at
  begin
    Time.parse(self[:created_at])
  rescue
    self[:created_at]
  end
end
updated_at() click to toggle source
# File lib/provider/project.rb, line 9
def updated_at
  begin
    Time.parse(self[:updated_at])
  rescue
    self[:updated_at]
  end
end