Sha256: 0dc0e0715a9ec6ebeb8b6c055dc2aa01d6fe500d27726047e123c80024d1fa06
Contents?: true
Size: 698 Bytes
Versions: 2
Compression:
Stored size: 698 Bytes
Contents
module Datacentred module Model class User < OpenStruct def initialize(params) params.delete("links") params["created_at"] = Time.parse params["created_at"] params["updated_at"] = Time.parse params["updated_at"] super(params) end def self.all Request::Users.list.map { |user| new(user) } end def self.find(id) new Request::Users.show(id) end def self.create(params) new Request::Users.create(params) end def self.update(id, params) new Request::Users.update(id, params) end def self.delete(id) Request::Users.destroy(id) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
datacentred-0.1.1pre | lib/datacentred/model/user.rb |
datacentred-0.1.0pre | lib/datacentred/model/user.rb |