Power IQ Client

Power IQ Rest API client for Power IQ 3.1. For a complete list of resources, routes, and methods available see the online Power IQ documentation (www.raritan.com/support/power-iq).

Installation

% gem install poweriq_client

Console

The Power IQ client comes with a interactive console. To run the console:

% poweriq_client

Console Options

Usage: poweriq_client [options]
  -l, --less-typing                Put resource objects in global namespace
                                   (ie PowerIQ::Resource::Outlet becomes Outlet)
  -c, --check-compatibility        Check client compatibility with server
  -u, --user [USER]                User name for authentication
  -p, --password [PASSWORD]        Password for authentication
  -s, --server [HOST]              Host name or IP of Power IQ

Console Configuration

Create a file named .poweriq_client in your home directory. The contents of the file should look similiar to below, adjusted to your Power IQ server:

default:
  host: vm163
  user: admin
  password: raritan

If you do not use a configuration file, or through the command line options above, you’ll need to provide the configuration manually:

% poweriq_client
>> PowerIQ::Configuration.configure("user"=>"foo","password"=>"bar","host"=>"vm150")

Console Examples

Retrieve all outlets:

>> outlets_resource = PowerIQ::Resource::Outlet.new
https://vm163/api/v2/outlets
>> outlets_resource.get

Retrieve one outlet:

>> outlet_resource = PowerIQ::Resource::Outlet.new('/381')
https://vm163/api/v2/outlets/381
>> outlet = outlet_resource.get

Update an outlet:

>> outlet_resource = PowerIQ::Resource::Outlet.new('/381')
https://vm163/api/v2/outlets/381
>> outlet = outlet_resource.get
>> outlet['outlet']['outlet_name'] = "New Name"
>> outlet_resource.put outlet.to_json

Development

The Power IQ rest client uses the rest-client gem, with some modifications to make it easier to query Power IQ resources. For now you’ll need to view the source code for more details, however the usage is essentially the same as you see in the interactive console examples above.

Contributing to Power IQ Client

  • Check out the latest master to make sure the feature hasn’t been implemented or the bug hasn’t been fixed yet

  • Check out the issue tracker to make sure someone already hasn’t requested it and/or contributed it

  • Fork the project

  • Start a feature/bugfix branch

  • Commit and push until you are happy with your contribution

  • Make sure to add tests for it. This is important so I don’t break it in a future version unintentionally.

  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Copyright © 2011 Raritan, INC. See LICENSE.txt for further details.