Class: Trumpet::Channel
Class Method Summary collapse
- .all(options = {}) ⇒ Object
- .all_by_user(name, options = {}) ⇒ Object
- .create(options) ⇒ Object
- .find(name, options = {}) ⇒ Object
Instance Method Summary collapse
- #broadcast(message, options = {}) ⇒ Object
- #delete(options = {}) ⇒ Object
- #messages(options = {}) ⇒ Object
Methods inherited from Resource
Class Method Details
.all(options = {}) ⇒ Object
12 13 14 |
# File 'lib/trumpet/channel.rb', line 12 def self.all(={}) Trumpet::Request.get('/channels', ).map { |attributes| Channel.new(attributes) } end |
.all_by_user(name, options = {}) ⇒ Object
16 17 18 19 |
# File 'lib/trumpet/channel.rb', line 16 def self.all_by_user(name, ={}) channels = Trumpet::Request.get("/users/#{name}/channels", ) channels.map { |attributes| Channel.new(attributes) } end |
Instance Method Details
#broadcast(message, options = {}) ⇒ Object
26 27 28 29 |
# File 'lib/trumpet/channel.rb', line 26 def broadcast(, ={}) [:credentials] ||= @credentials !!Trumpet::Request.post("/channels/#{@name}/messages", :parameters => .to_h, :parse_response => false, :credentials => [:credentials]) end |