Sha256: 88813906b2c4bc7e073e099dfaf08e27b814a06c9f08c2ff3c945147321f9774
Contents?: true
Size: 942 Bytes
Versions: 2
Compression:
Stored size: 942 Bytes
Contents
module Trumpet class Listener @@attributes = [ :receiver_id, :uri, :start, :end, :days, :created_at, :updated_at, ] attr_reader *@@attributes def self.create(options) Listener.new(Trumpet::Request.post('/listeners', :parameters => options)) end def self.find(id) Listener.new(Trumpet::Request.get("/listeners/#{id}")) end def self.delete !!Trumpet::Request.delete("/listeners/#{@id}") end def self.all_by_receiver_id(receiver_id) listeners = Trumpet::Request.get("/receivers/#{receiver_id}/listeners") listeners.map { |attributes| Listener.new(attributes) } 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
trumpet-trumpet-0.0.2 | lib/trumpet/listener.rb |
trumpet-trumpet-0.0.3 | lib/trumpet/listener.rb |