Sha256: 21da366b8fd8f607f526edc711ffcfade8780f04796a81f060ba13ef8fdba639

Contents?: true

Size: 658 Bytes

Versions: 5

Compression:

Stored size: 658 Bytes

Contents

module Trumpet
  class Transmitter < Trumpet::Resource
    
    def self.create(options)
      Transmitter.new(Trumpet::Request.post('/transmitters', options))
    end
    
    def self.find(id, options={})
      Transmitter.new(Trumpet::Request.get("/transmitters/#{id}", options))
    end
    
    def delete(options={})
      Trumpet::Request.delete("/transmitters/#{@id}", options)
    end
    
    def broadcast(message, options={})
      options[:credentials] ||= @credentials
      options[:parameters] = message.to_h
      options[:parse_response] = false
      !!Trumpet::Request.post("/transmitters/#{@id}/messages", options)
    end
    
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

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