Sha256: 42bdcb8e1b850ac9b18345779a32a1e9116e38d2e41388617227ac9466a419da

Contents?: true

Size: 574 Bytes

Versions: 4

Compression:

Stored size: 574 Bytes

Contents

module Gnip
  module API
    def add(rules)
      options = ActiveSupport::JSON.encode( {:rules => rules} )
      puts options
      Gnip::Response.new self.class.post('/rules.json', :body => options )
    end

    def remove( rules )
      options = ActiveSupport::JSON.encode( {:rules => rules} )
      Gnip::Response.new self.class.delete('/rules.json', :body => options )
    end

    def list
      Gnip::Response.new self.class.get( '/rules.json' )
    end

    def delete_all!
      rules = self.list.rules
      sleep 3
      self.remove( rules )
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
gnip-rules-1.2.5 lib/gnip-rules/api.rb
gnip-rules-1.2.4 lib/gnip-rules/api.rb
gnip-rules-1.2.3 lib/gnip-rules/api.rb
gnip-rules-1.2.1 lib/gnip-rules/api.rb