This package has been deprecated

Author message:

RIP HP Cloud

hew

0.0.7 • Public • Published

Hew

Hew provides a Node.js API for HP Cloud.

API Documentation

Hew API Documentation is at: http://natesilva.github.io/hew/docs/#!/api

Github

The Hew Github repository is at: https://github.com/natesilva/hew

Coverage

Currently Hew supports a subset of the HP Cloud API:

  • Authentication Tokens
  • Messaging
  • DNS
  • Object Storage
  • CDN (partial)
  • Identity (partial)

Installation

npm install hew

Quick start

Example showing use of the Messaging module:

var Hew = require('hew');

var yourRegion = Hew.AuthToken.DEFAULT_REGION;
var yourAccessKey = '…';
var yourSecretKey = '…';
var yourTenantName = '…';
var qname = 'my-test-message-queue';

// obtain an authentication token
var token = new Hew.AuthToken(yourRegion, yourAccessKey, yourSecretKey,
  yourTenantName);

// create the Messaging controller
var messaging = new Hew.Messaging(token);

// create a test queue
messaging.createQueue(qname, function(err) {
  if (err) { return console.error(err); }
  console.log('test queue created');

  // send a message
  var message = { location: 'Palo Alto', temperature: 22, units: 'C' };
  messaging.send(qname, message, function(err, messageId) {
    if (err) { return console.error(err); }
    console.log('message was posted, with ID', messageId);

    // receive a message
    messaging.receive(qname, function(err, message) {
      if (err) { return console.error(err); }
      console.log('message received:', message.body);
      // prints: { location: 'Palo Alto', temperature: 22, units: 'C' }

      // delete the test queue
      messaging.deleteQueue(qname, function(err) {
        if (err) { return console.error(err); }
        console.log('test queue deleted');
      });
    });
  });
});

Running unit tests

Warning: Do not run unit tests against your production HP Cloud account. Testing will create, update and delete resources in your account, including very large files for testing object storage.

To run unit tests:

  1. Check out the Hew git repo.
  2. Create tests/config.json (an example is provided).
  3. Add the following key to tests/config.json:
    • "i-created-this-account-for-testing-only": true
  4. From the the top of the repo, run npm install.
  5. From the the top of the repo, run npm test.

Readme

Keywords

none

Package Sidebar

Install

npm i hew

Weekly Downloads

0

Version

0.0.7

License

BSD

Last publish

Collaborators

  • univ