Project

bluecat

0.0
No commit activity in last 3 years
No release in over 3 years
Use this gem to interact with the Bluecat Address Management SOAP API
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.14
~> 10.0
~> 3.0

Runtime

~> 2.11
~> 0.19
 Project Readme

Bluecat

This gem wraps certain operations with the Bluecat Address Management API via savon. I use this specifically to integrate with Foreman so there is a lot that this gem cannot do, yet. That said, I am open to pull requests to add more features.

Installation

Add this line to your application's Gemfile:

gem 'bluecat'

And then execute:

$ bundle

Or install it yourself as:

$ gem install bluecat

Usage

require 'bluecat'
require 'pp'

client = Bluecat::Client.new(wsdl: 'https://hostname/Services/API?wsdl')
client.login('api-username', 'api-password')

# This is the object ID of where to start
# your search.
container_id = 1

pp client.ip4_networks(container_id).to_a

client.logout

It is a "best practice" (according to Bluecat's documentation) to logout at the end of a session. When I use this in other projects, I might expose it like so:

class SomeUseCase
  # All access to API happens through this method
  def bluecat
    username = HammerCLI::Settings.get(:bluecat, :username)
    password = HammerCLI::Settings.get(:bluecat, :password)

    client = Bluecat::Client.new(wsdl: HammerCLI::Settings.get(:bluecat, :wsdl))
    client.login(username, password)

    yield client

    client.logout
  end
  
  def execute
    bluecat do |client|
      # Do things with the client
      client.ip4_networks(@container_id).take(10)
    end 
  end
end

In this way, the client will log in and out for every operation. This may not be best for your use-case.

Contributing

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

License

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