Sha256: 23ecbb47058fff51ca040c4ed62b6ca811bd8501b25aa9773b44c073a7491283
Contents?: true
Size: 1.04 KB
Versions: 2
Compression:
Stored size: 1.04 KB
Contents
module Datacentred module Model class Project < OpenStruct def initialize(params) params.delete("links") if params params["created_at"] = Time.parse params["created_at"] params["updated_at"] = Time.parse params["updated_at"] super(params) end def self.all Request::Projects.list.map{ |project| new(project) } end def self.find(id) new Request::Projects.show(id) end def self.create(params) new Request::Projects.create(params) end def self.update(id, params) new Request::Projects.update(id, params) end def self.remove(id) Request::Projects.destroy(id) end def self.users(id) Request::Projects.list_users(id).map{ |user| new(user) } end def self.add_user(project_id, user_id) Request::Projects.add_user(project_id, user_id) end def self.remove_user(project_id, user_id) Request::Projects.remove_user(project_id, user_id) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
datacentred-0.1.1pre | lib/datacentred/model/project.rb |
datacentred-0.1.0pre | lib/datacentred/model/project.rb |