Sha256: e3d4591358b5f6840a910fe7fcada87092aeb2b2df978f0916177e351606c477

Contents?: true

Size: 752 Bytes

Versions: 5

Compression:

Stored size: 752 Bytes

Contents

module Trumpet
  class Receiver < Trumpet::Resource
    
    def self.create(options)
      Receiver.new(Trumpet::Request.post("/receivers", options))
    end
    
    def self.find(id, options={})
      Receiver.new(Trumpet::Request.get("/receivers/#{id}", options))
    end
    
    def delete(options={})
      options[:credentials] ||= @credentials
      options[:parse_response] = false
      !!Trumpet::Request.delete("/receivers/#{@id}", options)
    end
    
    def messages(options={})
      options[:credentials] ||= @credentials
      messages = Trumpet::Request.get("/receivers/#{@id}/messages", options)
      messages.map { |attributes| Message.new(attributes) }
    end
    
    def listen
      #TODO: impliment this
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
trumpet-trumpet-0.1.0 lib/trumpet/receiver.rb
trumpet-trumpet-0.1.1 lib/trumpet/receiver.rb
trumpet-trumpet-0.1.2 lib/trumpet/receiver.rb
trumpet-trumpet-0.1.3 lib/trumpet/receiver.rb
trumpet-trumpet-0.1.4 lib/trumpet/receiver.rb