Sha256: d085402334c8cecbc8673b283d38ccc750d65e722c9836dac0c659e22c4e80a1
Contents?: true
Size: 853 Bytes
Versions: 6
Compression:
Stored size: 853 Bytes
Contents
module Trumpet class User @@attributes = [:id, :name] attr_reader *@@attributes def self.create(options) attributes = Trumpet::Request.post('/users', :parameters => options) User.new(attributes) end def self.find(name) User.new(Trumpet::Request.get("/users/#{name}")) end def delete !!Trumpet::Request.delete("/users/#{@name}") end def channels Trumpet::Channel.all_by_user(@name) end def listeners Trumpet::Listener.all_by_user(@name) end def receivers Trumpet::Receiver.all_by_user(@name) end protected def initialize(attributes) @@attributes.each do |attr| self.instance_variable_set(:"@#{attr.to_s}", attributes[attr.to_s]) if attributes[attr.to_s] end end end end
Version data entries
6 entries across 6 versions & 1 rubygems