Skip to content

Latest commit

 

History

History
112 lines (84 loc) · 2.85 KB

README.md

File metadata and controls

112 lines (84 loc) · 2.85 KB

Shaman

A Ruby client for interacting with the shaman service.

Installation

Add this line to your application's Gemfile:

gem 'shaman'

And then execute:

$ bundle

Or install it yourself as:

$ gem install shaman

Usage

Client

Instantiate a client, providing the IP of the host and the security token:

client = Shaman::Client.new('127.0.0.1', 'secret')

Domain Records

List all of the registered dns records:

client.records

Fetch information about a particular record:

client.record('nanobox.io')

Add a new domain record:

client.add_record({
    domain: 'nanobox.io',     # Domain name to resolve
    records: [
      ttl: 60,                # Seconds a client should cache for
      class: 'IN',            # Record class
      type: 'A',              # Record type (A, CNAME, MX, etc)
      address: '127.0.0.1'    # Address domain resolves to
    ]
})

Update a registered domain record:

client.update_record('nanobox.io', {
  domain: 'nanobox.io',     # Domain name to resolve
  records: [
    ttl: 60,                # Seconds a client should cache for
    class: 'IN',            # Record class
    type: 'A',              # Record type (A, CNAME, MX, etc)
    address: '127.0.0.1'    # Address domain resolves to
  ]
})

Remove a registered domain:

client.remove_record('nanobox.io')

Reset all records:

client.reset_records([
  {
    domain: 'nanobox.io',     # Domain name to resolve
    records: [
      ttl: 60,                # Seconds a client should cache for
      class: 'IN',            # Record class
      type: 'A',              # Record type (A, CNAME, MX, etc)
      address: '127.0.0.1'    # Address domain resolves to
    ]
  },
  {
    domain: 'gonano.io',     # Domain name to resolve
    records: [
      ttl: 60,                # Seconds a client should cache for
      class: 'IN',            # Record class
      type: 'A',              # Record type (A, CNAME, MX, etc)
      address: '127.0.0.1'    # Address domain resolves to
    ]
  }
])

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/nanopack/shaman.

License

The gem is available as open source under the terms of the MIT License.