Skip to content
Ruby library for working with the Gnip Rules API
Find file
Failed to load latest commit information.
lib Version bump.
spec Remove an expectation that is resulting in a SystemStackError in Ruby…
.coveralls.yml Update README badges and try to get Coveralls working.
.gitignore Adding code coverage with coveralls
.pryrc Ready for GitHub
.ruby-gemset .rvmrc -> .ruby-version
.ruby-version Develop on latest Ruby release.
.travis.yml Add Ruby 2.1 and 2.2 to Travis test config. Adding code coverage with coveralls
Gemfile Update dependencies
LICENSE Ready for GitHub Remove version specifier from example Gemfile code in README.
Rakefile Allow running tests through rake
gnip-rule.gemspec Relax version constraints to only check major versions.


This gem simplifies the effort to add/delete/list rules using the Gnip Rules API. It handles HTTP request/response and helps your rules conform to Gnip's restrictions.


gem install gnip-rule or add the following to your Gemfile:

gem 'gnip-rule'


require 'gnip-rule'


# Add as a String, Rule, or Array of either
rules.add('bar', 'tag')
rules.add(['foo', 'bar', 'baz'], 'tag')
rules.add('value', 'tag'))
rules.add(['foo', 'bar'),'baz', 'tag2')])

# Same with delete
rules.delete('baz', 'tag')
rules.delete(['foo', 'bar'])
rules.delete('value', 'tag'))

# Get all rules
rules_list = rules.list()
rules_list.each { |rule| rule.valid? }
jsonified = { |rule| rule.as_json `}
rules_tagged_foo = { |rule| rule.tag == 'foo' }


See .travis.yml for Ruby versions used in testing.


Build Status Code Climate Coverage Status

When submitting pull requests, please do the following to make it easier to incorporate your changes:

  • Include unit and/or functional specs that validate changes you're making.
  • Rebase your changes onto the HEAD of my fork if you can do so cleanly.
  • If submitting additional functionality, provide an example of how to use it.
  • Please keep code style consistent with surrounding code.


You can run all tests by simply running bundle exec rake test from your favorite shell.


Licenced under the MIT License

@eriwen and @singlebrook wrote this software. It is provided free of charge. If you find it helpful, please endorse @eriwen on coderwall: endorse and check out Singlebrook.

Something went wrong with that request. Please try again.