{"_id":"totem","_rev":"65-58348c92c9efb3550dcb22a02f1258c5","name":"totem","description":"A library to easily manipulate avatar data in HAPI.","dist-tags":{"latest":"5.2.0"},"versions":{"0.0.8":{"name":"totem","version":"0.0.8","author":{"name":"Robert Dallas Gray","email":"robert.dallas.gray@huzutech.com"},"description":"A library to easily manipulate avatar data in HAPI.","keywords":["hapi","avatars"],"dependencies":{"hapilib":"0.5.x"},"devDependencies":{"browserify":"2.12.x"},"repository":{"type":"git","url":"https://github.com/HuzuTech/HAPI.App.Avatars.git"},"scripts":{"prepublish":"cake build"},"readme":"hapi.app.avatars\n================\n\nThis is a small library built on top of [HAPILib](https://github.com/HuzuTech/hapilibjs), intended to be used as part of [HAPI.App](https://github.com/HuzuTech/HAPI.App).\n\nThe functionality is very limited at present. It allows you to very easily access all assets available to a user, organised in a data structure intended to enable easy app development.\n\nThe library uses [jQuery Deferred](http://api.jquery.com/category/deferred-object/) to handle asynchronous tasks, all of which return a `promise`.\n\nTo get assets available to a user:\n```javascript\nvar hav = new HapiAvatars;\nhav.user.assets({ representation: \"standard\" })\n    .then(function(assets) { doSomethingWithAssets(assets); });\n```\n\nThe data structure returned is of the form:\n```javascript\n{\n   pack_name:\n   {\n       category_name:\n       [\n           {\n               Id: \"1\",\n               Label: \"asset_label\",\n               Title: \"Asset Title\",\n               Metadata: {},\n               DateCreated: \"2013-01-14T17:11:11.777\",\n               GoodId: \"1\",\n               CategoryId: \"1\",\n               Thumbnail: \"http://thumbnail.com/thumbnail\",\n               Layers: [...]\n           },\n           {\n               Id: \"2\",\n               Label: \"asset_label\",\n               Title: \"Asset Title\",\n               Metadata: {},\n               DateCreated: \"2013-01-14T17:11:11.777\",\n               GoodId: \"1\",\n               CategoryId: \"1\",\n               Thumbnail: \"http://thumbnail.com/thumbnail\",\n               Layers: [...]\n           }, ...\n       ],\n       category_name:\n       [\n           {\n               ...\n           }\n       ]\n   }\n}\n```\n","readmeFilename":"README.md","_id":"totem@0.0.8","dist":{"shasum":"635dc27f715f91c5b00387701b64f3f8116a3503","tarball":"https://registry.npmjs.org/totem/-/totem-0.0.8.tgz","integrity":"sha512-MudCtZ746mAREVImz9jIZ7CV//WpRznxFqWGGRv0gPU5PrCnWTAXJ+ZFuhDng/KLdkgxWebvhBpRiFApo1K97Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCHzzQhgtP4vSadp9L+wM+QOmtk8ToZJak0pF3fC43G3ECIQC19eod5+JTb3uiAE4M0svp1UkfLl9oO1wSj49VrQ5u/Q=="}]},"_from":".","_npmVersion":"1.2.11","_npmUser":{"name":"huzutechtools","email":"github@huzutech.com"},"maintainers":[{"name":"huzutechtools","email":"github@huzutech.com"}],"directories":{}},"0.1.0":{"name":"totem","version":"0.1.0","author":{"name":"Robert Dallas Gray","email":"robert.dallas.gray@huzutech.com"},"description":"A library to easily manipulate avatar data in HAPI.","keywords":["hapi","avatars"],"dependencies":{"hapilib":"0.5.x"},"devDependencies":{"karma":"0.8.x","browserify":"2.12.x"},"repository":{"type":"git","url":"https://github.com/HuzuTech/Totem.git"},"scripts":{"prepublish":"cake build","test":"./node_modules/.bin/karma start --single-run --browsers PhantomJS"},"readme":"#Totem\n\nThis is a small library built on top of\n[HAPILib](https://github.com/HuzuTech/hapilibjs), intended to be used\nas part of [HAPI.App](https://github.com/HuzuTech/HAPI.App).\n\nIt allows you to simply and quickly perform the necessary procedures\nto load, save, alter and view avatars, in the context of a logged-in\nuser.\n\nThe library uses\n[jQuery Deferred](http://api.jquery.com/category/deferred-object/) to\nhandle asynchronous tasks, all of which return a `promise`.\n\n##Testing\n\nClone the Totem repo, then cd into its root and install dependencies:\n\n```npm install```\n\nYou'll need to have [Karma](https://github.com/karma-runner/karma)\ninstalled, the simplest method being:\n\n```npm install -g karma```\n\nThen you must start the karma server:\n\n```karma start```\n\nOnce it's started, run\n\n```cake test```\n\n##Setup\n\nTo begin using Totem, create a new `Totem` object:\n\n```coffeescript\ntotem = new Totem\n```\n\nNote that this isn't necessary if you are using\n[HAPI.App](https://github.com/HuzuTech/HAPI.App), which will create a\n`Totem` object for you.\n\n##Inventories\n\nTo get an inventory of assets for a logged-in user:\n\n```coffeescript\ntotem.inventory().then (inventory) ->\n    console.log inventory.get representation: \"standard\"\n```\n\nOnce you have an `inventory` object to work with, further calls to it are\nmostly synchronous.\n\n###Representations\n\nThe `representation: \"standard\"` option argument to `inventory.get` is the Label of a HAPI\nrepresentation. You must always supply a representation, but you\nmay set a default one to avoid having to do so repeatedly.\n\nYou can set a default representation globally:\n\n```coffeescript\ntotem.representation \"standard\"\n```\n\nOr only in the context of an inventory:\n\n```coffeescript\ninventory.representation \"standard\"\n```\n\n###Scoping\n\nBy default, `Inventory.get` will return categorised arrays of assets with no\nreference to which goods they might belong to:\n\n```coffeescript\ncategory1:\n    [Assets ...]\ncategory2:\n    [Assets ...]\n```\n\nYou can get only assets belonging to a given good like so:\n\n```coffeescript\ninventory.get representation: \"standard\", good: \"default\"\n```\n\nAgain, you can set a default good in the context of an inventory:\n\n```coffeescript\ninventory.good \"default\"\n```\n\nYou can scope assets by category:\n\n```coffeescript\ninventory.get representation: \"standard\", category: \"category1\"\n```\n\nThis will return an array of assets in the given category.\n\nAssets are always returned in the context of the given representation,\nso each asset in a returned array will look like this:\n\n```coffeescript\nId: 1\nLabel: \"skinny_arm\"\nCategoryId: 1\nGoodId: 1\nDateCreated: \"2012-10-17T19:20:36.97\"\nLayers: [...]\nMetadata: \"\"\nThumbnail: \"\"\n```\n\n##Categories and Goods\n\nRetrieve a complete array of categories:\n\n```coffeescript\ntotem.categories().then (categories) ->\n    console.log categories\n```\n\nAnd a complete array of goods in the system:\n\n```coffeescript\ntotem.goods().then (goods) ->\n    console.log goods\n```\n\nOr just those available to the logged-in user:\n\n```coffeescript\ntotem.user().goods().then (goods) ->\n    console.log goods\n```\n\nCategories are always supplied in an array sorted correctly by the\n`SortOrder` property.\n\n##Avatars\n\nTo create a new avatar:\n\n```coffeescript\navatar = totem.avatar Label: \"new-avatar\"\n```\n\nOptionally, you can pass a hash of attributes to this method, which\nwill be applied to the created avatar (the most relevant of which will\nprobably be the `Label` attribute).\n\nTo get a set of avatars already created by the user:\n\n```coffeescript\ntotem.avatars(\"standard\").then (avatars) ->\n    console.log avatars\n```\n\nThe argument to `totem.avatars` is the name of a representation, which\nis optional only if you have set a global default representation.\n\n###Equipping avatars\n\nOnce you have an avatar, you can equip it with a random set of assets:\n\n```coffeescript\ntotem.randomise(avatar, representation: \"standard\").then ->\n    console.log \"Done!\"\n```\n\nOr with an asset from the inventory:\n\n```coffeescript\nassets = inventory.get representation: \"standard\", category: \"arm\"\navatar.equip \"arm\", assets[0]\n```\n\nOr with a defined set of assets (an 'ensemble'):\n\n```coffeescript\nensemble =\n    arm:\n        [Asset]\n    leg:\n        [Asset]\n    head:\n        [Asset]\n\navatar.build ensemble\n```\n\n###Colours\n\nChange colours for all categories in an avatar's ensemble:\n\n```coffeescript\navatar.colour1 \"#ff0000\"\n```\n\nOr for a specific category:\n\n```coffeescript\navatar.colour2 \"#00ff00\", \"arm\"\n```\n\nYou can use colour palettes when randomising an avatar, in which case\nthe given colours will be randomly selected and applied to the\nindividual assets:\n\n```coffeescript\npalette1 = [\"#ff0000\", \"#00ff00\"]\npalette2 = [\"#0000ff\", \"#ffff00\"]\ntotem.randomise avatar, representation: \"standard\", palette: [palette1, palette2]\n```\n\nPalettes are set locally by default (so each asset will take a\ndifferent pair of random colours), but you can choose to colourise\nglobally (so two random colours are chosen and applied to all assets\nin the avatar's ensemble):\n\n```coffeescript\noptions =\n    representation: \"standard\"\n    palette: [palette1, palette2]\n    globalPalette: true\ntotem.randomise avatar, options \n```\n\nYou can set a default palette, which will then be used for all\ncalls to `totem.randomise`:\n\n```coffeescript\ntotem.palette palette1, palette2\ntotem.randomise avatar, representation: \"standard\"\n```\n\nAnd you can set a default for whether palettes should be used\nglobally:\n\n```coffeescript:\ntotem.globalPalette true\ntotem.randomise avatar, representation: \"standard\"\n```\n\n###Saving and displaying avatars\n\nWhen you've made changes to an avatar, you can save it:\n\n```coffeescript\navatar.save().then ->\n    console.log \"Done!\"\n```\n\nOr delete one you've already saved:\n\n```coffeescript\navatar.delete().then ->\n    console.log \"Deleted!\"\n```\n\nAnd at any time, you can display it on a given `canvas` element:\n\n```coffeescript\ncanvas = $(\"#myCanvas\").get(0)\ntotem.drawOn avatar, canvas\n```\n\nDrawing an avatar on a canvas 'binds' it to that canvas; changing\nassets or colours on the avatar will automatically redraw it on the\ncanvas. You can override this behaviour by calling the `totem.drawOn`\nmethod with the `autoDraw` options set to `false`:\n\n```coffeescript\ntotem.drawOn avatar, canvas, autoDraw: false\n```\n\nTo get a rendered image for a given representation:\n\n```coffeescript\navatar.imageUrl \"standard\"\n```\n","readmeFilename":"README.md","_id":"totem@0.1.0","dist":{"shasum":"6a03912f855c7e0f08ec10e2e8536f351fbd1906","tarball":"https://registry.npmjs.org/totem/-/totem-0.1.0.tgz","integrity":"sha512-xlax682+cdO1bNiith4mvsRKmJdEMSxuFGnkwqFBFhw9FAsyL7Ptxm8kYGaqOlm7RUUXCCCVcypIKewjlUlmHg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDfIfIBCaMEVnRTvXJOnbGQGjIAhOlRHR8kdBDcZJR32QIgayPCgAKtQldlLAjmdLuSYLuuzOdJAVeHwqXD5msJflY="}]},"_from":".","_npmVersion":"1.2.11","_npmUser":{"name":"huzutechtools","email":"github@huzutech.com"},"maintainers":[{"name":"huzutechtools","email":"github@huzutech.com"}],"directories":{}},"0.2.0":{"name":"totem","version":"0.2.0","author":{"name":"Robert Dallas Gray","email":"robert.dallas.gray@huzutech.com"},"description":"A library to easily manipulate avatar data in HAPI.","keywords":["hapi","avatars"],"dependencies":{"hapilib":"0.5.x"},"devDependencies":{"karma":"0.8.x","browserify":"2.12.x","coffee-script":"1.6.x"},"repository":{"type":"git","url":"https://github.com/HuzuTech/Totem.git"},"scripts":{"prepublish":"cake build","pretest":"./node_modules/.bin/coffee -c -o lib/ src/","test":"./node_modules/.bin/karma start --single-run --browsers PhantomJS"},"readme":"#Totem\n\nThis is a small library built on top of\n[HAPILib](https://github.com/HuzuTech/hapilibjs), intended to be used\nas part of [HAPI.App](https://github.com/HuzuTech/HAPI.App).\n\nIt allows you to simply and quickly perform the necessary procedures\nto load, save, alter and view avatars, in the context of a logged-in\nuser.\n\nThe library uses\n[jQuery Deferred](http://api.jquery.com/category/deferred-object/) to\nhandle asynchronous tasks, all of which return a `promise`.\n\n##Testing\n\nClone the Totem repo, then cd into its root and install dependencies:\n\n```npm install```\n\nYou'll need to have [Karma](https://github.com/karma-runner/karma)\ninstalled, the simplest method being:\n\n```npm install -g karma```\n\nThen you must start the karma server:\n\n```karma start```\n\nOnce it's started, run\n\n```cake test```\n\n##Setup\n\nTo begin using Totem, create a new `Totem` object:\n\n```coffeescript\ntotem = new Totem\n```\n\nNote that this isn't necessary if you are using\n[HAPI.App](https://github.com/HuzuTech/HAPI.App), which will create a\n`Totem` object for you.\n\n##Inventories\n\nTo get an inventory of assets for a logged-in user:\n\n```coffeescript\ntotem.inventory().then (inventory) ->\n    console.log inventory.get representation: \"standard\"\n```\n\nOnce you have an `inventory` object to work with, further calls to it are\nmostly synchronous.\n\n###Representations\n\nThe `representation: \"standard\"` option argument to `inventory.get` is the Label of a HAPI\nrepresentation. You must always supply a representation, but you\nmay set a default one to avoid having to do so repeatedly.\n\nYou can set a default representation globally:\n\n```coffeescript\ntotem.representation \"standard\"\n```\n\nOr only in the context of an inventory:\n\n```coffeescript\ninventory.representation \"standard\"\n```\n\n###Scoping\n\nBy default, `Inventory.get` will return categorised arrays of assets with no\nreference to which goods they might belong to:\n\n```coffeescript\ncategory1:\n    [Assets ...]\ncategory2:\n    [Assets ...]\n```\n\nYou can get only assets belonging to a given good like so:\n\n```coffeescript\ninventory.get representation: \"standard\", good: \"default\"\n```\n\nAgain, you can set a default good in the context of an inventory:\n\n```coffeescript\ninventory.good \"default\"\n```\n\nYou can scope assets by category:\n\n```coffeescript\ninventory.get representation: \"standard\", category: \"category1\"\n```\n\nThis will return an array of assets in the given category.\n\nAssets are always returned in the context of the given representation,\nso each asset in a returned array will look like this:\n\n```coffeescript\nId: 1\nLabel: \"skinny_arm\"\nCategoryId: 1\nGoodId: 1\nDateCreated: \"2012-10-17T19:20:36.97\"\nLayers: [...]\nMetadata: \"\"\nThumbnail: \"\"\n```\n\n##Categories and Goods\n\nRetrieve a complete array of categories:\n\n```coffeescript\ntotem.categories().then (categories) ->\n    console.log categories\n```\n\nAnd a complete array of goods in the system:\n\n```coffeescript\ntotem.goods().then (goods) ->\n    console.log goods\n```\n\nOr just those available to the logged-in user:\n\n```coffeescript\ntotem.user().goods().then (goods) ->\n    console.log goods\n```\n\nCategories are always supplied in an array sorted correctly by the\n`SortOrder` property.\n\n##Avatars\n\nTo create a new avatar:\n\n```coffeescript\navatar = totem.avatar Label: \"new-avatar\"\n```\n\nOptionally, you can pass a hash of attributes to this method, which\nwill be applied to the created avatar (the most relevant of which will\nprobably be the `Label` attribute).\n\nTo get a set of avatars already created by the user:\n\n```coffeescript\ntotem.avatars(\"standard\").then (avatars) ->\n    console.log avatars\n```\n\nThe argument to `totem.avatars` is the name of a representation, which\nis optional only if you have set a global default representation.\n\n###Equipping avatars\n\nOnce you have an avatar, you can equip it with a random set of assets:\n\n```coffeescript\ntotem.randomise(avatar, representation: \"standard\").then ->\n    console.log \"Done!\"\n```\n\nOr with an asset from the inventory:\n\n```coffeescript\nassets = inventory.get representation: \"standard\", category: \"arm\"\navatar.equip \"arm\", assets[0]\n```\n\nOr with a defined set of assets (an 'ensemble'):\n\n```coffeescript\nensemble =\n    arm:\n        [Asset]\n    leg:\n        [Asset]\n    head:\n        [Asset]\n\navatar.build ensemble\n```\n\n###Colours\n\nChange colours for all categories in an avatar's ensemble:\n\n```coffeescript\navatar.colour1 \"#ff0000\"\n```\n\nOr for a specific category:\n\n```coffeescript\navatar.colour2 \"#00ff00\", \"arm\"\n```\n\nYou can use colour palettes when randomising an avatar, in which case\nthe given colours will be randomly selected and applied to the\nindividual assets:\n\n```coffeescript\npalette1 = [\"#ff0000\", \"#00ff00\"]\npalette2 = [\"#0000ff\", \"#ffff00\"]\ntotem.randomise avatar, representation: \"standard\", palette: [palette1, palette2]\n```\n\nPalettes are set locally by default (so each asset will take a\ndifferent pair of random colours), but you can choose to colourise\nglobally (so two random colours are chosen and applied to all assets\nin the avatar's ensemble):\n\n```coffeescript\noptions =\n    representation: \"standard\"\n    palette: [palette1, palette2]\n    globalPalette: true\ntotem.randomise avatar, options\n```\n\nYou can set a default palette, which will then be used for all\ncalls to `totem.randomise`:\n\n```coffeescript\ntotem.palette palette1, palette2\ntotem.randomise avatar, representation: \"standard\"\n```\n\nAnd you can set a default for whether palettes should be used\nglobally:\n\n```coffeescript:\ntotem.globalPalette true\ntotem.randomise avatar, representation: \"standard\"\n```\n\n###Saving and displaying avatars\n\nWhen you've made changes to an avatar, you can save it:\n\n```coffeescript\navatar.save().then ->\n    console.log \"Done!\"\n```\n\nOr delete one you've already saved:\n\n```coffeescript\navatar.delete().then ->\n    console.log \"Deleted!\"\n```\n\nAnd at any time, you can display it on a given `canvas` element:\n\n```coffeescript\ncanvas = $(\"#myCanvas\").get(0)\ntotem.drawOn avatar, canvas\n```\n\nDrawing an avatar on a canvas 'binds' it to that canvas; changing\nassets or colours on the avatar will automatically redraw it on the\ncanvas. You can override this behaviour by calling the `totem.drawOn`\nmethod with the `autoDraw` options set to `false`:\n\n```coffeescript\ntotem.drawOn avatar, canvas, autoDraw: false\n```\n\nTo get a rendered image for a given representation:\n\n```coffeescript\navatar.imageUrl \"standard\"\n```\n\n###Events\n\nOn an `equip`, `build` or `colour[x]` call to an avatar, Totem will send the\n`avatarChange` event, which can be bound to like so:\n\n```coffeescript\n$(totem).on \"avatarChange\", (event, data) ->\n    doSomethingWith data\n```\n\nData is an object which will always have the property `avatar`,\ncontaining the avatar which sent the event, and `event`, which is a\nstring representing the event type (`build`, `equip`, `colour1` or\n`colour2`. If the event was prompted by an `equip` or a local colour\nchange, there will also be a `category` property giving the category\nthat the `equip` was called on.\n","readmeFilename":"README.md","_id":"totem@0.2.0","dist":{"shasum":"b7ce91bce7098c5c41a867748d74c5751167113b","tarball":"https://registry.npmjs.org/totem/-/totem-0.2.0.tgz","integrity":"sha512-AxVfR5oWzytAqUovuZWEEABQx58zIW0z8Dix3xjpP5Sm6xgV2lQasn50noGM876PqJjzo/OMKtZU6ysyq/4ogA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDSxIUxjfcwYBxJY/htkh0Jd3lMmmLutmt2WRIZKYduegIgZDaNnN0XicZVAg9EzkpjBgFwl6LCLjCHf9N7a5p+jMY="}]},"_from":".","_npmVersion":"1.2.11","_npmUser":{"name":"huzutechtools","email":"github@huzutech.com"},"maintainers":[{"name":"huzutechtools","email":"github@huzutech.com"}],"directories":{}},"1.0.0":{"name":"totem","version":"1.0.0","author":{"name":"Robert Dallas Gray","email":"robert.dallas.gray@huzutech.com"},"description":"A library to easily manipulate avatar data in HAPI.","keywords":["hapi","avatars"],"dependencies":{"hapilib":"0.5.x"},"devDependencies":{"karma":"0.8.x","browserify":"2.12.x","coffee-script":"1.6.x","codo":"1.6.x"},"repository":{"type":"git","url":"https://github.com/HuzuTech/Totem.git"},"scripts":{"prepublish":"cake build","pretest":"./node_modules/.bin/coffee -c -o lib/ src/","test":"./node_modules/.bin/karma start --single-run --browsers PhantomJS"},"readme":"#Totem\n\nThis is a library built on top of\n[HAPILib](https://github.com/HuzuTech/hapilibjs), intended to be used\nas part of [HAPI.App](https://github.com/HuzuTech/HAPI.App).\n\nIt allows you to simply and quickly perform the necessary procedures\nto load, save, alter and view avatars, in the context of a logged-in\nuser.\n\nThe library uses\n[jQuery Deferred](http://api.jquery.com/category/deferred-object/) to\nhandle asynchronous tasks, all of which return a `promise`.\n\nFor full documentation, see the [API docs](http://huzutech.github.io/totem).\n\n##Testing\n\nClone the Totem repo, then cd into its root and install dependencies:\n\n```npm install```\n\nWhen done, run\n\n```npm test```\n\n##Setup\n\nTo begin using Totem, create a new `Totem` object:\n\n```coffeescript\ntotem = new Totem endPoint: \"https://my.hapi.instance-hapi\", clientId: 2001\n```\n\nNote that this isn't necessary if you are using\n[HAPI.App](https://github.com/HuzuTech/HAPI.App), which will create a\n`Totem` object for you.\n\n##Quick Start\n\nTo get an inventory of assets for a logged-in user:\n\n```coffeescript\ntotem.inventory().then (inventory) ->\n    console.log inventory.get representation: \"standard\"\n```\n\nOnce you have an `inventory` object to work with, further calls to it are\nmostly synchronous.\n\n###Representations\n\nThe `representation: \"standard\"` option argument to `inventory.get` is the Label of a HAPI\nrepresentation. You must always supply a representation, but you\nmay set a default one to avoid having to do so repeatedly.\n\nYou can set a default representation globally:\n\n```coffeescript\ntotem.representation \"standard\"\n```\n\nOr only in the context of an inventory:\n\n```coffeescript\ninventory.representation \"standard\"\n```\n\n###Scoping\n\nBy default, `Inventory.get` will return categorised arrays of assets with no\nreference to which goods they might belong to:\n\n```coffeescript\ncategory1:\n    [Assets ...]\ncategory2:\n    [Assets ...]\n```\n\nYou can get only assets belonging to a given good like so:\n\n```coffeescript\ninventory.get representation: \"standard\", good: \"default\"\n```\n\nAgain, you can set a default good in the context of an inventory:\n\n```coffeescript\ninventory.good \"default\"\n```\n\nYou can scope assets by category:\n\n```coffeescript\ninventory.get representation: \"standard\", category: \"category1\"\n```\n\nThis will return an array of assets in the given category.\n\nAssets are always returned in the context of the given representation,\nso each asset in a returned array will look like this:\n\n```coffeescript\nId: 1\nLabel: \"skinny_arm\"\nCategoryId: 1\nGoodId: 1\nDateCreated: \"2012-10-17T19:20:36.97\"\nLayers: [...]\nMetadata: \"\"\nThumbnail: \"\"\n```\n\n##Categories and Goods\n\nRetrieve a complete array of categories:\n\n```coffeescript\ntotem.categories().then (categories) ->\n    console.log categories\n```\n\nAnd a complete array of goods in the system:\n\n```coffeescript\ntotem.goods().then (goods) ->\n    console.log goods\n```\n\nOr just those available to the logged-in user:\n\n```coffeescript\ntotem.user().goods().then (goods) ->\n    console.log goods\n```\n\nCategories are always supplied in an array sorted correctly by the\n`SortOrder` property.\n\n##Avatars\n\nTo create a new avatar:\n\n```coffeescript\navatar = totem.avatar Label: \"new-avatar\"\n```\n\nOptionally, you can pass a hash of attributes to this method, which\nwill be applied to the created avatar (the most relevant of which will\nprobably be the `Label` attribute).\n\nTo get a set of avatars already created by the user:\n\n```coffeescript\ntotem.avatars(\"standard\").then (avatars) ->\n    console.log avatars\n```\n\nThe argument to `totem.avatars` is the name of a representation, which\nis optional only if you have set a global default representation.\n\n###Equipping avatars\n\nOnce you have an avatar, you can equip it with a random set of assets:\n\n```coffeescript\ntotem.randomise(avatar, representation: \"standard\").then ->\n    console.log \"Done!\"\n```\n\nOr with an asset from the inventory:\n\n```coffeescript\nassets = inventory.get representation: \"standard\", category: \"arm\"\navatar.equip \"arm\", assets[0]\n```\n\nOr with a defined set of assets (an 'ensemble'):\n\n```coffeescript\nensemble =\n    arm:\n        [Asset]\n    leg:\n        [Asset]\n    head:\n        [Asset]\n\navatar.build ensemble\n```\n\n###Saving and displaying avatars\n\nWhen you've made changes to an avatar, you can save it:\n\n```coffeescript\navatar.save().then ->\n    console.log \"Done!\"\n```\n\nAnd at any time, you can display it on a given `canvas` element:\n\n```coffeescript\ncanvas = $(\"#myCanvas\").get(0)\ntotem.drawOn avatar, canvas\n```\n\nDrawing an avatar on a canvas 'binds' it to that canvas; changing\nassets or colours on the avatar will automatically redraw it on the\ncanvas.\n\n###Events\n\nOn an `equip`, `build` or `colour[x]` call to an avatar, Totem will send the\n`avatarChange` event, which can be bound to like so:\n\n```coffeescript\n$(totem).on \"avatarChange\", (event, data) ->\n    doSomethingWith data\n```\n\nData is an object which will always have the property `avatar`,\ncontaining the avatar which sent the event, and `event`, which is a\nstring representing the event type (`build`, `equip`, `colour1` or\n`colour2`. If the event was prompted by an `equip` or a local colour\nchange, there will also be a `category` property giving the category\nthat the `equip` was called on.\n","readmeFilename":"README.md","_id":"totem@1.0.0","dist":{"shasum":"faba892bdceb220022dbd4cabf302d8e02839ec3","tarball":"https://registry.npmjs.org/totem/-/totem-1.0.0.tgz","integrity":"sha512-qFf7kx40szup3J+j5K6ZRYVmgjKns4zbOaLe8Dw+W86KrKVYsq7Bts3ezxUCdM4hOtjluiLJ8XOd4Uij37avHg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCmzoMpSFUA7MHrrZgnwkPUjV6Prjmk3vo/wsO1UoG6ggIhAONKxIJkEezxsJDFVlXHjLN2davanjKq3GojHu29Au/Q"}]},"_from":".","_npmVersion":"1.2.11","_npmUser":{"name":"huzutechtools","email":"github@huzutech.com"},"maintainers":[{"name":"huzutechtools","email":"github@huzutech.com"}],"directories":{}},"1.0.2":{"name":"totem","version":"1.0.2","author":{"name":"Robert Dallas Gray","email":"robert.dallas.gray@huzutech.com"},"description":"A library to easily manipulate avatar data in HAPI.","keywords":["hapi","avatars"],"dependencies":{"hapilib":"0.5.x"},"devDependencies":{"karma":"0.8.x","browserify":"2.12.x","coffee-script":"1.6.x","codo":"1.6.x"},"repository":{"type":"git","url":"https://github.com/HuzuTech/Totem.git"},"scripts":{"prepublish":"cake build","pretest":"./node_modules/.bin/coffee -c -o lib/ src/","test":"./node_modules/.bin/karma start --single-run --browsers PhantomJS"},"readme":"#Totem\n\nThis is a library built on top of\n[HAPILib](https://github.com/HuzuTech/hapilibjs), intended to be used\nas part of [HAPI.App](https://github.com/HuzuTech/HAPI.App).\n\nIt allows you to simply and quickly perform the necessary procedures\nto load, save, alter and view avatars, in the context of a logged-in\nuser.\n\nThe library uses\n[jQuery Deferred](http://api.jquery.com/category/deferred-object/) to\nhandle asynchronous tasks, all of which return a `promise`.\n\nFor full documentation, see the [API docs](http://huzutech.github.io/Totem).\n\n##Testing\n\nClone the Totem repo, then cd into its root and install dependencies:\n\n```npm install```\n\nWhen done, run\n\n```npm test```\n\n##Setup\n\nTo begin using Totem, create a new `Totem` object:\n\n```coffeescript\ntotem = new Totem endPoint: \"https://my.hapi.instance-hapi\", clientId: 2001\n```\n\nNote that this isn't necessary if you are using\n[HAPI.App](https://github.com/HuzuTech/HAPI.App), which will create a\n`Totem` object for you.\n\n##Quick Start\n\nTo get an inventory of assets for a logged-in user:\n\n```coffeescript\ntotem.inventory().then (inventory) ->\n    console.log inventory.get representation: \"standard\"\n```\n\nOnce you have an `inventory` object to work with, further calls to it are\nmostly synchronous.\n\n###Representations\n\nThe `representation: \"standard\"` option argument to `inventory.get` is the Label of a HAPI\nrepresentation. You must always supply a representation, but you\nmay set a default one to avoid having to do so repeatedly.\n\nYou can set a default representation globally:\n\n```coffeescript\ntotem.representation \"standard\"\n```\n\nOr only in the context of an inventory:\n\n```coffeescript\ninventory.representation \"standard\"\n```\n\n###Scoping\n\nBy default, `Inventory.get` will return categorised arrays of assets with no\nreference to which goods they might belong to:\n\n```coffeescript\ncategory1:\n    [Assets ...]\ncategory2:\n    [Assets ...]\n```\n\nYou can get only assets belonging to a given good like so:\n\n```coffeescript\ninventory.get representation: \"standard\", good: \"default\"\n```\n\nAgain, you can set a default good in the context of an inventory:\n\n```coffeescript\ninventory.good \"default\"\n```\n\nYou can scope assets by category:\n\n```coffeescript\ninventory.get representation: \"standard\", category: \"category1\"\n```\n\nThis will return an array of assets in the given category.\n\nAssets are always returned in the context of the given representation,\nso each asset in a returned array will look like this:\n\n```coffeescript\nId: 1\nLabel: \"skinny_arm\"\nCategoryId: 1\nGoodId: 1\nDateCreated: \"2012-10-17T19:20:36.97\"\nLayers: [...]\nMetadata: \"\"\nThumbnail: \"\"\n```\n\n##Categories and Goods\n\nRetrieve a complete array of categories:\n\n```coffeescript\ntotem.categories().then (categories) ->\n    console.log categories\n```\n\nAnd a complete array of goods in the system:\n\n```coffeescript\ntotem.goods().then (goods) ->\n    console.log goods\n```\n\nOr just those available to the logged-in user:\n\n```coffeescript\ntotem.user().goods().then (goods) ->\n    console.log goods\n```\n\nCategories are always supplied in an array sorted correctly by the\n`SortOrder` property.\n\n##Avatars\n\nTo create a new avatar:\n\n```coffeescript\navatar = totem.avatar Label: \"new-avatar\"\n```\n\nOptionally, you can pass a hash of attributes to this method, which\nwill be applied to the created avatar (the most relevant of which will\nprobably be the `Label` attribute).\n\nTo get a set of avatars already created by the user:\n\n```coffeescript\ntotem.avatars(\"standard\").then (avatars) ->\n    console.log avatars\n```\n\nThe argument to `totem.avatars` is the name of a representation, which\nis optional only if you have set a global default representation.\n\n###Equipping avatars\n\nOnce you have an avatar, you can equip it with a random set of assets:\n\n```coffeescript\ntotem.randomise(avatar, representation: \"standard\").then ->\n    console.log \"Done!\"\n```\n\nOr with an asset from the inventory:\n\n```coffeescript\nassets = inventory.get representation: \"standard\", category: \"arm\"\navatar.equip \"arm\", assets[0]\n```\n\nOr with a defined set of assets (an 'ensemble'):\n\n```coffeescript\nensemble =\n    arm:\n        [Asset]\n    leg:\n        [Asset]\n    head:\n        [Asset]\n\navatar.build ensemble\n```\n\n###Saving and displaying avatars\n\nWhen you've made changes to an avatar, you can save it:\n\n```coffeescript\navatar.save().then ->\n    console.log \"Done!\"\n```\n\nAnd at any time, you can display it on a given `canvas` element:\n\n```coffeescript\ncanvas = $(\"#myCanvas\").get(0)\ntotem.drawOn avatar, canvas\n```\n\nDrawing an avatar on a canvas 'binds' it to that canvas; changing\nassets or colours on the avatar will automatically redraw it on the\ncanvas.\n\n###Events\n\nOn an `equip`, `build` or `colour[x]` call to an avatar, Totem will send the\n`avatarChange` event, which can be bound to like so:\n\n```coffeescript\n$(totem).on \"avatarChange\", (event, data) ->\n    doSomethingWith data\n```\n\nData is an object which will always have the property `avatar`,\ncontaining the avatar which sent the event, and `event`, which is a\nstring representing the event type (`build`, `equip`, `colour1` or\n`colour2`. If the event was prompted by an `equip` or a local colour\nchange, there will also be a `category` property giving the category\nthat the `equip` was called on.\n","readmeFilename":"README.md","_id":"totem@1.0.2","dist":{"shasum":"da2b21ac110dfc6722da4c90c91a36d1faf244a3","tarball":"https://registry.npmjs.org/totem/-/totem-1.0.2.tgz","integrity":"sha512-Xq6x1PIMdM227kwfMm9f8kPY6pv1sRe2G9s7WSEYSJAz/ApHbeCaKYj5LHE1HdjZEhSBL0mVEr3jVni2G65u7w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGEQAlrMwuqjqErdS8VU2jvCBunv6R8/KUnML+nz9y/dAiEA1WmKpLE6yg8gyYL8lLjz5zG4om0PLglBoKxQWF8USU4="}]},"_from":".","_npmVersion":"1.2.11","_npmUser":{"name":"huzutechtools","email":"github@huzutech.com"},"maintainers":[{"name":"huzutechtools","email":"github@huzutech.com"}],"directories":{}},"2.0.0":{"name":"totem","version":"2.0.0","author":{"name":"Robert Dallas Gray","email":"robert.dallas.gray@huzutech.com"},"description":"A library to easily manipulate avatar data in HAPI.","keywords":["hapi","avatars"],"dependencies":{"hapilib":"0.5.x"},"devDependencies":{"karma":"0.8.x","browserify":"2.12.x","coffee-script":"1.6.x","codo":"1.6.x"},"repository":{"type":"git","url":"https://github.com/HuzuTech/Totem.git"},"scripts":{"prepublish":"cake build","pretest":"./node_modules/.bin/coffee -c -o lib/ src/","test":"./node_modules/.bin/karma start --single-run --browsers PhantomJS"},"readme":"#Totem\n\nThis is a library built on top of\n[HAPILib](https://github.com/HuzuTech/hapilibjs), intended to be used\nas part of [HAPI.App](https://github.com/HuzuTech/HAPI.App).\n\nIt allows you to simply and quickly perform the necessary procedures\nto load, save, alter and view avatars, in the context of a logged-in\nuser.\n\nThe library uses\n[jQuery Deferred](http://api.jquery.com/category/deferred-object/) to\nhandle asynchronous tasks, all of which return a `promise`.\n\nFor full documentation, see the [API docs](http://huzutech.github.io/Totem).\n\n##Testing\n\nClone the Totem repo, then cd into its root and install dependencies:\n\n```npm install```\n\nWhen done, run\n\n```npm test```\n\n##Setup\n\nTo begin using Totem, create a new `Totem` object:\n\n```coffeescript\ntotem = new Totem endPoint: \"https://my.hapi.instance-hapi\", clientId: 2001\n```\n\nNote that this isn't necessary if you are using\n[HAPI.App](https://github.com/HuzuTech/HAPI.App), which will create a\n`Totem` object for you.\n\n##Quick Start\n\nTo get an inventory of assets for a logged-in user:\n\n```coffeescript\ntotem.inventory().then (inventory) ->\n    console.log inventory.get representation: \"standard\"\n```\n\nOnce you have an `inventory` object to work with, further calls to it are\nmostly synchronous.\n\n###Representations\n\nThe `representation: \"standard\"` option argument to `inventory.get` is the Label of a HAPI\nrepresentation. You must always supply a representation, but you\nmay set a default one to avoid having to do so repeatedly.\n\nYou can set a default representation globally:\n\n```coffeescript\ntotem.representation \"standard\"\n```\n\nOr only in the context of an inventory:\n\n```coffeescript\ninventory.representation \"standard\"\n```\n\n###Scoping\n\nBy default, `Inventory.get` will return categorised arrays of assets with no\nreference to which goods they might belong to:\n\n```coffeescript\ncategory1:\n    [Assets ...]\ncategory2:\n    [Assets ...]\n```\n\nYou can get only assets belonging to a given good like so:\n\n```coffeescript\ninventory.get representation: \"standard\", good: \"default\"\n```\n\nAgain, you can set a default good in the context of an inventory:\n\n```coffeescript\ninventory.good \"default\"\n```\n\nYou can scope assets by category:\n\n```coffeescript\ninventory.get representation: \"standard\", category: \"category1\"\n```\n\nThis will return an array of assets in the given category.\n\nAssets are always returned in the context of the given representation,\nso each asset in a returned array will look like this:\n\n```coffeescript\nId: 1\nLabel: \"skinny_arm\"\nCategoryId: 1\nGoodId: 1\nDateCreated: \"2012-10-17T19:20:36.97\"\nLayers: [...]\nMetadata: \"\"\nThumbnail: \"\"\n```\n\n##Categories and Goods\n\nRetrieve a complete array of categories:\n\n```coffeescript\ntotem.categories().then (categories) ->\n    console.log categories\n```\n\nAnd a complete array of goods in the system:\n\n```coffeescript\ntotem.goods().then (goods) ->\n    console.log goods\n```\n\nOr just those available to the logged-in user:\n\n```coffeescript\ntotem.user().goods().then (goods) ->\n    console.log goods\n```\n\nCategories are always supplied in an array sorted correctly by the\n`SortOrder` property.\n\n##Avatars\n\nTo create a new avatar:\n\n```coffeescript\navatar = totem.avatar Label: \"new-avatar\"\n```\n\nOptionally, you can pass a hash of attributes to this method, which\nwill be applied to the created avatar (the most relevant of which will\nprobably be the `Label` attribute).\n\nTo get a set of avatars already created by the user:\n\n```coffeescript\ntotem.avatars(\"standard\").then (avatars) ->\n    console.log avatars\n```\n\nThe argument to `totem.avatars` is the name of a representation, which\nis optional only if you have set a global default representation.\n\n###Equipping avatars\n\nOnce you have an avatar, you can equip it with a random set of assets:\n\n```coffeescript\ntotem.randomise(avatar, representation: \"standard\").then ->\n    console.log \"Done!\"\n```\n\nOr with an asset from the inventory:\n\n```coffeescript\nassets = inventory.get representation: \"standard\", category: \"arm\"\navatar.equip \"arm\", assets[0]\n```\n\nOr with a defined set of assets (an 'ensemble'):\n\n```coffeescript\nensemble =\n    arm:\n        [Asset]\n    leg:\n        [Asset]\n    head:\n        [Asset]\n\navatar.build ensemble\n```\n\n###Saving and displaying avatars\n\nWhen you've made changes to an avatar, you can save it:\n\n```coffeescript\navatar.save().then ->\n    console.log \"Done!\"\n```\n\nAnd at any time, you can display it on a given `canvas` element:\n\n```coffeescript\ncanvas = $(\"#myCanvas\").get(0)\ntotem.drawOn avatar, canvas\n```\n\nDrawing an avatar on a canvas 'binds' it to that canvas; changing\nassets or colours on the avatar will automatically redraw it on the\ncanvas.\n\n###Events\n\nOn an `equip`, `build` or `colour[x]` call to an avatar, Totem will send the\n`avatarChange` event, which can be bound to like so:\n\n```coffeescript\n$(totem).on \"avatarChange\", (event, data) ->\n    doSomethingWith data\n```\n\nData is an object which will always have the property `avatar`,\ncontaining the avatar which sent the event, and `event`, which is a\nstring representing the event type (`build`, `equip`, `colour1` or\n`colour2`. If the event was prompted by an `equip` or a local colour\nchange, there will also be a `category` property giving the category\nthat the `equip` was called on.\n","readmeFilename":"README.md","_id":"totem@2.0.0","dist":{"shasum":"f19751c9dfbb6b09901e77ca475631ff7fab9b2b","tarball":"https://registry.npmjs.org/totem/-/totem-2.0.0.tgz","integrity":"sha512-fEVkUoJuEkygJpS+dGkcG26aLT4rPxKg1Q7bFDhNKtDTWSCRaMFvUCw7tWRC19w9ob0eXXoJREx0C6A/q24sKA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCaEhWy4JquTE60OnnOYrO+V/MkdUZ4f6tvs2++TqWs4QIgA9GYY1SbZ4esahj5UP2+VlRLRJTUcnTb1pcP4Ndd2Tk="}]},"_from":".","_npmVersion":"1.2.11","_npmUser":{"name":"huzutechtools","email":"github@huzutech.com"},"maintainers":[{"name":"huzutechtools","email":"github@huzutech.com"}],"directories":{}},"2.0.2":{"name":"totem","version":"2.0.2","author":{"name":"Robert Dallas Gray","email":"robert.dallas.gray@huzutech.com"},"description":"A library to easily manipulate avatar data in HAPI.","keywords":["hapi","avatars"],"dependencies":{"hapilib":"0.5.x"},"devDependencies":{"karma":"0.8.x","browserify":"2.12.x","coffee-script":"1.6.x","codo":"1.6.x"},"repository":{"type":"git","url":"https://github.com/HuzuTech/Totem.git"},"scripts":{"prepublish":"cake build","pretest":"./node_modules/.bin/coffee -c -o lib/ src/","test":"./node_modules/.bin/karma start --single-run --browsers PhantomJS"},"readme":"#Totem\n\nThis is a library built on top of\n[HAPILib](https://github.com/HuzuTech/hapilibjs), intended to be used\nas part of [HAPI.App](https://github.com/HuzuTech/HAPI.App).\n\nIt allows you to simply and quickly perform the necessary procedures\nto load, save, alter and view avatars, in the context of a logged-in\nuser.\n\nThe library uses\n[jQuery Deferred](http://api.jquery.com/category/deferred-object/) to\nhandle asynchronous tasks, all of which return a `promise`.\n\nFor full documentation, see the [API docs](http://huzutech.github.io/Totem).\n\n##Testing\n\nClone the Totem repo, then cd into its root and install dependencies:\n\n```npm install```\n\nWhen done, run\n\n```npm test```\n\n##Setup\n\nTo begin using Totem, create a new `Totem` object:\n\n```coffeescript\ntotem = new Totem endPoint: \"https://my.hapi.instance-hapi\", clientId: 2001\n```\n\nNote that this isn't necessary if you are using\n[HAPI.App](https://github.com/HuzuTech/HAPI.App), which will create a\n`Totem` object for you.\n\n##Quick Start\n\nTo get an inventory of assets for a logged-in user:\n\n```coffeescript\ntotem.inventory().then (inventory) ->\n    console.log inventory.get representation: \"standard\"\n```\n\nOnce you have an `inventory` object to work with, further calls to it are\nmostly synchronous.\n\n###Representations\n\nThe `representation: \"standard\"` option argument to `inventory.get` is the Label of a HAPI\nrepresentation. You must always supply a representation, but you\nmay set a default one to avoid having to do so repeatedly.\n\nYou can set a default representation globally:\n\n```coffeescript\ntotem.representation \"standard\"\n```\n\nOr only in the context of an inventory:\n\n```coffeescript\ninventory.representation \"standard\"\n```\n\n###Scoping\n\nBy default, `Inventory.get` will return categorised arrays of assets with no\nreference to which goods they might belong to:\n\n```coffeescript\ncategory1:\n    [Assets ...]\ncategory2:\n    [Assets ...]\n```\n\nYou can get only assets belonging to a given good like so:\n\n```coffeescript\ninventory.get representation: \"standard\", good: \"default\"\n```\n\nAgain, you can set a default good in the context of an inventory:\n\n```coffeescript\ninventory.good \"default\"\n```\n\nYou can scope assets by category:\n\n```coffeescript\ninventory.get representation: \"standard\", category: \"category1\"\n```\n\nThis will return an array of assets in the given category.\n\nAssets are always returned in the context of the given representation,\nso each asset in a returned array will look like this:\n\n```coffeescript\nId: 1\nLabel: \"skinny_arm\"\nCategoryId: 1\nGoodId: 1\nDateCreated: \"2012-10-17T19:20:36.97\"\nLayers: [...]\nMetadata: \"\"\nThumbnail: \"\"\n```\n\n##Categories and Goods\n\nRetrieve a complete array of categories:\n\n```coffeescript\ntotem.categories().then (categories) ->\n    console.log categories\n```\n\nAnd a complete array of goods in the system:\n\n```coffeescript\ntotem.goods().then (goods) ->\n    console.log goods\n```\n\nOr just those available to the logged-in user:\n\n```coffeescript\ntotem.user().goods().then (goods) ->\n    console.log goods\n```\n\nCategories are always supplied in an array sorted correctly by the\n`SortOrder` property.\n\n##Avatars\n\nTo create a new avatar:\n\n```coffeescript\navatar = totem.avatar Label: \"new-avatar\"\n```\n\nOptionally, you can pass a hash of attributes to this method, which\nwill be applied to the created avatar (the most relevant of which will\nprobably be the `Label` attribute).\n\nTo get a set of avatars already created by the user:\n\n```coffeescript\ntotem.avatars(\"standard\").then (avatars) ->\n    console.log avatars\n```\n\nThe argument to `totem.avatars` is the name of a representation, which\nis optional only if you have set a global default representation.\n\n###Equipping avatars\n\nOnce you have an avatar, you can equip it with a random set of assets:\n\n```coffeescript\ntotem.randomise(avatar, representation: \"standard\").then ->\n    console.log \"Done!\"\n```\n\nOr with an asset from the inventory:\n\n```coffeescript\nassets = inventory.get representation: \"standard\", category: \"arm\"\navatar.equip \"arm\", assets[0]\n```\n\nOr with a defined set of assets (an 'ensemble'):\n\n```coffeescript\nensemble =\n    arm:\n        [Asset]\n    leg:\n        [Asset]\n    head:\n        [Asset]\n\navatar.build ensemble\n```\n\n###Saving and displaying avatars\n\nWhen you've made changes to an avatar, you can save it:\n\n```coffeescript\navatar.save().then ->\n    console.log \"Done!\"\n```\n\nAnd at any time, you can display it on a given `canvas` element:\n\n```coffeescript\ncanvas = $(\"#myCanvas\").get(0)\ntotem.drawOn avatar, canvas\n```\n\nDrawing an avatar on a canvas 'binds' it to that canvas; changing\nassets or colours on the avatar will automatically redraw it on the\ncanvas.\n\n###Events\n\nOn an `equip`, `build` or `colour[x]` call to an avatar, Totem will send the\n`avatarChange` event, which can be bound to like so:\n\n```coffeescript\n$(totem).on \"avatarChange\", (event, data) ->\n    doSomethingWith data\n```\n\nData is an object which will always have the property `avatar`,\ncontaining the avatar which sent the event, and `event`, which is a\nstring representing the event type (`build`, `equip`, `colour1` or\n`colour2`. If the event was prompted by an `equip` or a local colour\nchange, there will also be a `category` property giving the category\nthat the `equip` was called on.\n","readmeFilename":"README.md","_id":"totem@2.0.2","dist":{"shasum":"07599b0609cb09656a90c5125ca8189af66626cc","tarball":"https://registry.npmjs.org/totem/-/totem-2.0.2.tgz","integrity":"sha512-BKFCn036reNavs4RVlz9u7l0186fCNSjrv8NOrta9v9j9LlyHiWN/qzRq17BBdwm5Q5TrtZaub0rPcqV+Cw+/Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFYdlLHstEUYAAkVmsQl+V9Q1+i6eqPqc541zDcm3+heAiAzrtqI3jq7gRn2/RTXf7/3dxs4aXBxa0GnyzEo1GUnWg=="}]},"_from":".","_npmVersion":"1.2.11","_npmUser":{"name":"huzutechtools","email":"github@huzutech.com"},"maintainers":[{"name":"huzutechtools","email":"github@huzutech.com"}],"directories":{}},"2.0.5":{"name":"totem","version":"2.0.5","author":{"name":"Robert Dallas Gray","email":"robert.dallas.gray@huzutech.com"},"description":"A library to easily manipulate avatar data in HAPI.","keywords":["hapi","avatars"],"dependencies":{"hapilib":"0.5.x"},"devDependencies":{"karma":"0.8.x","browserify":"2.12.x","coffee-script":"1.6.x","codo":"1.6.x"},"repository":{"type":"git","url":"https://github.com/HuzuTech/Totem.git"},"scripts":{"prepublish":"cake build","pretest":"./node_modules/.bin/coffee -c -o lib/ src/","test":"./node_modules/.bin/karma start --single-run --browsers PhantomJS"},"readme":"#Totem\n\nThis is a library built on top of\n[HAPILib](https://github.com/HuzuTech/hapilibjs), intended to be used\nas part of [HAPI.App](https://github.com/HuzuTech/HAPI.App).\n\nIt allows you to simply and quickly perform the necessary procedures\nto load, save, alter and view avatars, in the context of a logged-in\nuser.\n\nThe library uses\n[jQuery Deferred](http://api.jquery.com/category/deferred-object/) to\nhandle asynchronous tasks, all of which return a `promise`.\n\nFor full documentation, see the [API docs](http://huzutech.github.io/Totem).\n\n##Testing\n\nClone the Totem repo, then cd into its root and install dependencies:\n\n```npm install```\n\nWhen done, run\n\n```npm test```\n\n##Setup\n\nTo begin using Totem, create a new `Totem` object:\n\n```coffeescript\ntotem = new Totem endPoint: \"https://my.hapi.instance-hapi\", clientId: 2001\n```\n\nNote that this isn't necessary if you are using\n[HAPI.App](https://github.com/HuzuTech/HAPI.App), which will create a\n`Totem` object for you.\n\n##Quick Start\n\nTo get an inventory of assets for a logged-in user:\n\n```coffeescript\ntotem.inventory().then (inventory) ->\n    console.log inventory.get representation: \"standard\"\n```\n\nOnce you have an `inventory` object to work with, further calls to it are\nmostly synchronous.\n\n###Representations\n\nThe `representation: \"standard\"` option argument to `inventory.get` is the Label of a HAPI\nrepresentation. You must always supply a representation, but you\nmay set a default one to avoid having to do so repeatedly.\n\nYou can set a default representation globally:\n\n```coffeescript\ntotem.representation \"standard\"\n```\n\nOr only in the context of an inventory:\n\n```coffeescript\ninventory.representation \"standard\"\n```\n\n###Scoping\n\nBy default, `Inventory.get` will return categorised arrays of assets with no\nreference to which goods they might belong to:\n\n```coffeescript\ncategory1:\n    [Assets ...]\ncategory2:\n    [Assets ...]\n```\n\nYou can get only assets belonging to a given good like so:\n\n```coffeescript\ninventory.get representation: \"standard\", good: \"default\"\n```\n\nAgain, you can set a default good in the context of an inventory:\n\n```coffeescript\ninventory.good \"default\"\n```\n\nYou can scope assets by category:\n\n```coffeescript\ninventory.get representation: \"standard\", category: \"category1\"\n```\n\nThis will return an array of assets in the given category.\n\nAssets are always returned in the context of the given representation,\nso each asset in a returned array will look like this:\n\n```coffeescript\nId: 1\nLabel: \"skinny_arm\"\nCategoryId: 1\nGoodId: 1\nDateCreated: \"2012-10-17T19:20:36.97\"\nLayers: [...]\nMetadata: \"\"\nThumbnail: \"\"\n```\n\n##Categories and Goods\n\nRetrieve a complete array of categories:\n\n```coffeescript\ntotem.categories().then (categories) ->\n    console.log categories\n```\n\nAnd a complete array of goods in the system:\n\n```coffeescript\ntotem.goods().then (goods) ->\n    console.log goods\n```\n\nOr just those available to the logged-in user:\n\n```coffeescript\ntotem.user().goods().then (goods) ->\n    console.log goods\n```\n\nCategories are always supplied in an array sorted correctly by the\n`SortOrder` property.\n\n##Avatars\n\nTo create a new avatar:\n\n```coffeescript\navatar = totem.avatar Label: \"new-avatar\"\n```\n\nOptionally, you can pass a hash of attributes to this method, which\nwill be applied to the created avatar (the most relevant of which will\nprobably be the `Label` attribute).\n\nTo get a set of avatars already created by the user:\n\n```coffeescript\ntotem.avatars(\"standard\").then (avatars) ->\n    console.log avatars\n```\n\nThe argument to `totem.avatars` is the name of a representation, which\nis optional only if you have set a global default representation.\n\n###Equipping avatars\n\nOnce you have an avatar, you can equip it with a random set of assets:\n\n```coffeescript\ntotem.randomise(avatar, representation: \"standard\").then ->\n    console.log \"Done!\"\n```\n\nOr with an asset from the inventory:\n\n```coffeescript\nassets = inventory.get representation: \"standard\", category: \"arm\"\navatar.equip \"arm\", assets[0]\n```\n\nOr with a defined set of assets (an 'ensemble'):\n\n```coffeescript\nensemble =\n    arm:\n        [Asset]\n    leg:\n        [Asset]\n    head:\n        [Asset]\n\navatar.build ensemble\n```\n\n###Saving and displaying avatars\n\nWhen you've made changes to an avatar, you can save it:\n\n```coffeescript\navatar.save().then ->\n    console.log \"Done!\"\n```\n\nAnd at any time, you can display it on a given `canvas` element:\n\n```coffeescript\ncanvas = $(\"#myCanvas\").get(0)\ntotem.drawOn avatar, canvas\n```\n\nDrawing an avatar on a canvas 'binds' it to that canvas; changing\nassets or colours on the avatar will automatically redraw it on the\ncanvas.\n\n###Events\n\nOn an `equip`, `build` or `colour[x]` call to an avatar, Totem will send the\n`avatarChange` event, which can be bound to like so:\n\n```coffeescript\n$(totem).on \"avatarChange\", (event, data) ->\n    doSomethingWith data\n```\n\nData is an object which will always have the property `avatar`,\ncontaining the avatar which sent the event, and `event`, which is a\nstring representing the event type (`build`, `equip`, `colour1` or\n`colour2`. If the event was prompted by an `equip` or a local colour\nchange, there will also be a `category` property giving the category\nthat the `equip` was called on.\n","readmeFilename":"README.md","_id":"totem@2.0.5","dist":{"shasum":"e80e2efcc0a6e1cdba5d9c3c30030efd8420e8ae","tarball":"https://registry.npmjs.org/totem/-/totem-2.0.5.tgz","integrity":"sha512-J/n3tv8OCYyj7Gfhd+6wDFvCDx8V8Jg+WQ9lPxxFroljuU2xVtSJasGe84uYWBE927rfTHB4bxcbsBkc22DE+w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCZwC73CffgapMJriotMYN93qGbt59cyg7swxS25JuPSQIgT71BGQ8xLKFTGxFmR2wfCeampGSnC0UtOGGjhHlENqI="}]},"_from":".","_npmVersion":"1.2.11","_npmUser":{"name":"huzutechtools","email":"github@huzutech.com"},"maintainers":[{"name":"huzutechtools","email":"github@huzutech.com"}],"directories":{}},"3.0.0":{"name":"totem","version":"3.0.0","author":{"name":"Robert Dallas Gray","email":"robert.dallas.gray@huzutech.com"},"description":"A library to easily manipulate avatar data in HAPI.","keywords":["hapi","avatars"],"dependencies":{"hapilib":"0.5.x"},"devDependencies":{"karma":"0.8.x","browserify":"2.12.x","coffee-script":"1.6.x","codo":"1.6.x"},"repository":{"type":"git","url":"https://github.com/HuzuTech/Totem.git"},"scripts":{"prepublish":"cake build","pretest":"./node_modules/.bin/coffee -c -o lib/ src/","test":"./node_modules/.bin/karma start --single-run --browsers PhantomJS"},"readme":"#Totem\n\nThis is a library built on top of\n[HAPILib](https://github.com/HuzuTech/hapilibjs), intended to be used\nas part of [HAPI.App](https://github.com/HuzuTech/HAPI.App).\n\nIt allows you to simply and quickly perform the necessary procedures\nto load, save, alter and view avatars, in the context of a logged-in\nuser.\n\nThe library uses\n[jQuery Deferred](http://api.jquery.com/category/deferred-object/) to\nhandle asynchronous tasks, all of which return a `promise`.\n\nFor full documentation, see the [API docs](http://huzutech.github.io/Totem).\n\n##Testing\n\nClone the Totem repo, then cd into its root and install dependencies:\n\n```npm install```\n\nWhen done, run\n\n```npm test```\n\n##Setup\n\nTo begin using Totem, create a new `Totem` object:\n\n```coffeescript\ntotem = new Totem endPoint: \"https://my.hapi.instance-hapi\", clientId: 2001\n```\n\nNote that this isn't necessary if you are using\n[HAPI.App](https://github.com/HuzuTech/HAPI.App), which will create a\n`Totem` object for you.\n\n##Quick Start\n\nTo get an inventory of assets for a logged-in user:\n\n```coffeescript\ntotem.inventory().then (inventory) ->\n    console.log inventory.get representation: \"standard\"\n```\n\nOnce you have an `inventory` object to work with, further calls to it are\nmostly synchronous.\n\n###Representations\n\nThe `representation: \"standard\"` option argument to `inventory.get` is the Label of a HAPI\nrepresentation. You must always supply a representation, but you\nmay set a default one to avoid having to do so repeatedly.\n\nYou can set a default representation globally:\n\n```coffeescript\ntotem.representation \"standard\"\n```\n\nOr only in the context of an inventory:\n\n```coffeescript\ninventory.representation \"standard\"\n```\n\n###Scoping\n\nBy default, `Inventory.get` will return categorised arrays of assets with no\nreference to which goods they might belong to:\n\n```coffeescript\ncategory1:\n    [Assets ...]\ncategory2:\n    [Assets ...]\n```\n\nYou can get only assets belonging to a given good like so:\n\n```coffeescript\ninventory.get representation: \"standard\", good: \"default\"\n```\n\nAgain, you can set a default good in the context of an inventory:\n\n```coffeescript\ninventory.good \"default\"\n```\n\nYou can scope assets by category:\n\n```coffeescript\ninventory.get representation: \"standard\", category: \"category1\"\n```\n\nThis will return an array of assets in the given category.\n\nAssets are always returned in the context of the given representation,\nso each asset in a returned array will look like this:\n\n```coffeescript\nId: 1\nLabel: \"skinny_arm\"\nCategoryId: 1\nGoodId: 1\nDateCreated: \"2012-10-17T19:20:36.97\"\nLayers: [...]\nMetadata: \"\"\nThumbnail: \"\"\n```\n\n##Categories and Goods\n\nRetrieve a complete array of categories:\n\n```coffeescript\ntotem.categories().then (categories) ->\n    console.log categories\n```\n\nAnd a complete array of goods in the system:\n\n```coffeescript\ntotem.goods().then (goods) ->\n    console.log goods\n```\n\nOr just those available to the logged-in user:\n\n```coffeescript\ntotem.user().goods().then (goods) ->\n    console.log goods\n```\n\nCategories are always supplied in an array sorted correctly by the\n`SortOrder` property.\n\n##Avatars\n\nTo create a new avatar:\n\n```coffeescript\navatar = totem.avatar Label: \"new-avatar\"\n```\n\nOptionally, you can pass a hash of attributes to this method, which\nwill be applied to the created avatar (the most relevant of which will\nprobably be the `Label` attribute).\n\nTo get a set of avatars already created by the user:\n\n```coffeescript\ntotem.avatars(\"standard\").then (avatars) ->\n    console.log avatars\n```\n\nThe argument to `totem.avatars` is the name of a representation, which\nis optional only if you have set a global default representation.\n\n###Equipping avatars\n\nOnce you have an avatar, you can equip it with a random set of assets:\n\n```coffeescript\ntotem.randomise(avatar, representation: \"standard\").then ->\n    console.log \"Done!\"\n```\n\nOr with an asset from the inventory:\n\n```coffeescript\nassets = inventory.get representation: \"standard\", category: \"arm\"\navatar.equip \"arm\", assets[0]\n```\n\nOr with a defined set of assets (an 'ensemble'):\n\n```coffeescript\nensemble =\n    arm:\n        [Asset]\n    leg:\n        [Asset]\n    head:\n        [Asset]\n\navatar.build ensemble\n```\n\n###Saving and displaying avatars\n\nWhen you've made changes to an avatar, you can save it:\n\n```coffeescript\navatar.save().then ->\n    console.log \"Done!\"\n```\n\nAnd at any time, you can display it on a given `canvas` element:\n\n```coffeescript\ncanvas = $(\"#myCanvas\").get(0)\ntotem.drawOn avatar, canvas\n```\n\nDrawing an avatar on a canvas 'binds' it to that canvas; changing\nassets or colours on the avatar will automatically redraw it on the\ncanvas.\n\n###Events\n\nOn an `equip`, `build` or `colour[x]` call to an avatar, Totem will send the\n`avatarChange` event, which can be bound to like so:\n\n```coffeescript\n$(totem).on \"avatarChange\", (event, data) ->\n    doSomethingWith data\n```\n\nData is an object which will always have the property `avatar`,\ncontaining the avatar which sent the event, and `event`, which is a\nstring representing the event type (`build`, `equip`, `colour1` or\n`colour2`. If the event was prompted by an `equip` or a local colour\nchange, there will also be a `category` property giving the category\nthat the `equip` was called on.\n","readmeFilename":"README.md","_id":"totem@3.0.0","dist":{"shasum":"30affb01c932dbc9e01290b3bd943a760df59ebe","tarball":"https://registry.npmjs.org/totem/-/totem-3.0.0.tgz","integrity":"sha512-9VEp2z531qKwSELtrtARHaNDurmKU3Bxhr4bUYXxkAXVxgE8Lcb6jcgb8Q40wSzuQdGd3uZZUdaocYbdAJDO4A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDFOCBuN9uco6KOtKy018L/S24VybCD2Vw3/ByUXNS0ZgIgDYx9JTczgbPcJXZ/Gtt1IxXzRQREVEBXa2im4QPPqyM="}]},"_from":".","_npmVersion":"1.2.11","_npmUser":{"name":"huzutechtools","email":"github@huzutech.com"},"maintainers":[{"name":"huzutechtools","email":"github@huzutech.com"}],"directories":{}},"3.0.3":{"name":"totem","version":"3.0.3","author":{"name":"Robert Dallas Gray","email":"robert.dallas.gray@huzutech.com"},"description":"A library to easily manipulate avatar data in HAPI.","keywords":["hapi","avatars"],"dependencies":{"hapilib":"0.5.x"},"devDependencies":{"karma":"0.8.x","browserify":"2.12.x","coffee-script":"1.6.x","codo":"1.6.x"},"repository":{"type":"git","url":"https://github.com/HuzuTech/Totem.git"},"scripts":{"prepublish":"cake build","pretest":"./node_modules/.bin/coffee -c -o lib/ src/","test":"./node_modules/.bin/karma start --single-run --browsers PhantomJS"},"readme":"#Totem\n\nThis is a library built on top of\n[HAPILib](https://github.com/HuzuTech/hapilibjs), intended to be used\nas part of [HAPI.App](https://github.com/HuzuTech/HAPI.App).\n\nIt allows you to simply and quickly perform the necessary procedures\nto load, save, alter and view avatars, in the context of a logged-in\nuser.\n\nThe library uses\n[jQuery Deferred](http://api.jquery.com/category/deferred-object/) to\nhandle asynchronous tasks, all of which return a `promise`.\n\nFor full documentation, see the [API docs](http://huzutech.github.io/Totem).\n\n##Testing\n\nClone the Totem repo, then cd into its root and install dependencies:\n\n```npm install```\n\nWhen done, run\n\n```npm test```\n\n##Setup\n\nTo begin using Totem, create a new `Totem` object:\n\n```coffeescript\ntotem = new Totem endPoint: \"https://my.hapi.instance-hapi\", clientId: 2001\n```\n\nNote that this isn't necessary if you are using\n[HAPI.App](https://github.com/HuzuTech/HAPI.App), which will create a\n`Totem` object for you.\n\n##Quick Start\n\nTo get an inventory of assets for a logged-in user:\n\n```coffeescript\ntotem.inventory().then (inventory) ->\n    console.log inventory.get representation: \"standard\"\n```\n\nOnce you have an `inventory` object to work with, further calls to it are\nmostly synchronous.\n\n###Representations\n\nThe `representation: \"standard\"` option argument to `inventory.get` is the Label of a HAPI\nrepresentation. You must always supply a representation, but you\nmay set a default one to avoid having to do so repeatedly.\n\nYou can set a default representation globally:\n\n```coffeescript\ntotem.representation \"standard\"\n```\n\nOr only in the context of an inventory:\n\n```coffeescript\ninventory.representation \"standard\"\n```\n\n###Scoping\n\nBy default, `Inventory.get` will return categorised arrays of assets with no\nreference to which goods they might belong to:\n\n```coffeescript\ncategory1:\n    [Assets ...]\ncategory2:\n    [Assets ...]\n```\n\nYou can get only assets belonging to a given good like so:\n\n```coffeescript\ninventory.get representation: \"standard\", good: \"default\"\n```\n\nAgain, you can set a default good in the context of an inventory:\n\n```coffeescript\ninventory.good \"default\"\n```\n\nYou can scope assets by category:\n\n```coffeescript\ninventory.get representation: \"standard\", category: \"category1\"\n```\n\nThis will return an array of assets in the given category.\n\nAssets are always returned in the context of the given representation,\nso each asset in a returned array will look like this:\n\n```coffeescript\nId: 1\nLabel: \"skinny_arm\"\nCategoryId: 1\nGoodId: 1\nDateCreated: \"2012-10-17T19:20:36.97\"\nLayers: [...]\nMetadata: \"\"\nThumbnail: \"\"\n```\n\n##Categories and Goods\n\nRetrieve a complete array of categories:\n\n```coffeescript\ntotem.categories().then (categories) ->\n    console.log categories\n```\n\nAnd a complete array of goods in the system:\n\n```coffeescript\ntotem.goods().then (goods) ->\n    console.log goods\n```\n\nOr just those available to the logged-in user:\n\n```coffeescript\ntotem.user().goods().then (goods) ->\n    console.log goods\n```\n\nCategories are always supplied in an array sorted correctly by the\n`SortOrder` property.\n\n##Avatars\n\nTo create a new avatar:\n\n```coffeescript\navatar = totem.avatar Label: \"new-avatar\"\n```\n\nOptionally, you can pass a hash of attributes to this method, which\nwill be applied to the created avatar (the most relevant of which will\nprobably be the `Label` attribute).\n\nTo get a set of avatars already created by the user:\n\n```coffeescript\ntotem.avatars(\"standard\").then (avatars) ->\n    console.log avatars\n```\n\nThe argument to `totem.avatars` is the name of a representation, which\nis optional only if you have set a global default representation.\n\n###Equipping avatars\n\nOnce you have an avatar, you can equip it with a random set of assets:\n\n```coffeescript\ntotem.randomise(avatar, representation: \"standard\").then ->\n    console.log \"Done!\"\n```\n\nOr with an asset from the inventory:\n\n```coffeescript\nassets = inventory.get representation: \"standard\", category: \"arm\"\navatar.equip \"arm\", assets[0]\n```\n\nOr with a defined set of assets (an 'ensemble'):\n\n```coffeescript\nensemble =\n    arm:\n        [Asset]\n    leg:\n        [Asset]\n    head:\n        [Asset]\n\navatar.build ensemble\n```\n\n###Saving and displaying avatars\n\nWhen you've made changes to an avatar, you can save it:\n\n```coffeescript\navatar.save().then ->\n    console.log \"Done!\"\n```\n\nAnd at any time, you can display it on a given `canvas` element:\n\n```coffeescript\ncanvas = $(\"#myCanvas\").get(0)\ntotem.drawOn avatar, canvas\n```\n\nDrawing an avatar on a canvas 'binds' it to that canvas; changing\nassets or colours on the avatar will automatically redraw it on the\ncanvas.\n\n###Events\n\nOn an `equip`, `build` or `colour[x]` call to an avatar, Totem will send the\n`avatarChange` event, which can be bound to like so:\n\n```coffeescript\n$(totem).on \"avatarChange\", (event, data) ->\n    doSomethingWith data\n```\n\nData is an object which will always have the property `avatar`,\ncontaining the avatar which sent the event, and `event`, which is a\nstring representing the event type (`build`, `equip`, `colour1` or\n`colour2`. If the event was prompted by an `equip` or a local colour\nchange, there will also be a `category` property giving the category\nthat the `equip` was called on.\n","readmeFilename":"README.md","_id":"totem@3.0.3","dist":{"shasum":"2e8d8cebb59f1de2882e26f8cc4548af9b6f8178","tarball":"https://registry.npmjs.org/totem/-/totem-3.0.3.tgz","integrity":"sha512-Ov3ztFibrBmWjPLbjGxpcbSMBWYF0vqHKIQqsvkwniUF7+ccR3NDsaSFnsnjHOK1TiYgY6+xbxNx4pcap53oGQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHwaUQ/9ygV3YdZiu4sHHSC8tRnRXqgBowMOI3Rpt5DwAiEA6+M3XGKfEcSK9iQsA2rchmdIr26BXWnY49QsVHcgMIw="}]},"_from":".","_npmVersion":"1.2.11","_npmUser":{"name":"huzutechtools","email":"github@huzutech.com"},"maintainers":[{"name":"huzutechtools","email":"github@huzutech.com"}],"directories":{}},"4.0.0":{"name":"totem","version":"4.0.0","author":{"name":"Robert Dallas Gray","email":"robert.dallas.gray@huzutech.com"},"description":"A library to easily manipulate avatar data in HAPI.","keywords":["hapi","avatars"],"dependencies":{"hapilib":"0.6.x"},"devDependencies":{"karma":"0.8.x","browserify":"2.12.x","coffee-script":"1.6.x","codo":"1.6.x"},"repository":{"type":"git","url":"https://github.com/HuzuTech/Totem.git"},"scripts":{"prepublish":"cake build","pretest":"./node_modules/.bin/coffee -c -o lib/ src/","test":"./node_modules/.bin/karma start --single-run --browsers PhantomJS"},"readme":"#Totem\n\nThis is a library built on top of\n[HAPILib](https://github.com/HuzuTech/hapilibjs), intended to be used\nas part of [HAPI.App](https://github.com/HuzuTech/HAPI.App).\n\nIt allows you to simply and quickly perform the necessary procedures\nto load, save, alter and view avatars, in the context of a logged-in\nuser.\n\nThe library uses\n[jQuery Deferred](http://api.jquery.com/category/deferred-object/) to\nhandle asynchronous tasks, all of which return a `promise`.\n\nFor full documentation, see the [API docs](http://huzutech.github.io/Totem).\n\n##Testing\n\nClone the Totem repo, then cd into its root and install dependencies:\n\n```npm install```\n\nWhen done, run\n\n```npm test```\n\n##Setup\n\nTo begin using Totem, create a new `Totem` object:\n\n```coffeescript\ntotem = new Totem endPoint: \"https://my.hapi.instance-hapi\", clientId: 2001\n```\n\nNote that this isn't necessary if you are using\n[HAPI.App](https://github.com/HuzuTech/HAPI.App), which will create a\n`Totem` object for you.\n\n##Quick Start\n\nTo get an inventory of assets for a logged-in user:\n\n```coffeescript\ntotem.inventory().then (inventory) ->\n    console.log inventory.get representation: \"standard\"\n```\n\nOnce you have an `inventory` object to work with, further calls to it are\nmostly synchronous.\n\n###Representations\n\nThe `representation: \"standard\"` option argument to `inventory.get` is the Label of a HAPI\nrepresentation. You must always supply a representation, but you\nmay set a default one to avoid having to do so repeatedly.\n\nYou can set a default representation globally:\n\n```coffeescript\ntotem.representation \"standard\"\n```\n\nOr only in the context of an inventory:\n\n```coffeescript\ninventory.representation \"standard\"\n```\n\n###Scoping\n\nBy default, `Inventory.get` will return categorised arrays of assets with no\nreference to which goods they might belong to:\n\n```coffeescript\ncategory1:\n    [Assets ...]\ncategory2:\n    [Assets ...]\n```\n\nYou can get only assets belonging to a given good like so:\n\n```coffeescript\ninventory.get representation: \"standard\", good: \"default\"\n```\n\nAgain, you can set a default good in the context of an inventory:\n\n```coffeescript\ninventory.good \"default\"\n```\n\nYou can scope assets by category:\n\n```coffeescript\ninventory.get representation: \"standard\", category: \"category1\"\n```\n\nThis will return an array of assets in the given category.\n\nAssets are always returned in the context of the given representation,\nso each asset in a returned array will look like this:\n\n```coffeescript\nId: 1\nLabel: \"skinny_arm\"\nCategoryId: 1\nGoodId: 1\nDateCreated: \"2012-10-17T19:20:36.97\"\nLayers: [...]\nMetadata: \"\"\nThumbnail: \"\"\n```\n\n##Categories and Goods\n\nRetrieve a complete array of categories:\n\n```coffeescript\ntotem.categories().then (categories) ->\n    console.log categories\n```\n\nAnd a complete array of goods in the system:\n\n```coffeescript\ntotem.goods().then (goods) ->\n    console.log goods\n```\n\nOr just those available to the logged-in user:\n\n```coffeescript\ntotem.user().goods().then (goods) ->\n    console.log goods\n```\n\nCategories are always supplied in an array sorted correctly by the\n`SortOrder` property.\n\n##Avatars\n\nTo create a new avatar:\n\n```coffeescript\navatar = totem.avatar Label: \"new-avatar\"\n```\n\nOptionally, you can pass a hash of attributes to this method, which\nwill be applied to the created avatar (the most relevant of which will\nprobably be the `Label` attribute).\n\nTo get a set of avatars already created by the user:\n\n```coffeescript\ntotem.avatars(\"standard\").then (avatars) ->\n    console.log avatars\n```\n\nThe argument to `totem.avatars` is the name of a representation, which\nis optional only if you have set a global default representation.\n\n###Equipping avatars\n\nOnce you have an avatar, you can equip it with a random set of assets:\n\n```coffeescript\ntotem.randomise(avatar, representation: \"standard\").then ->\n    console.log \"Done!\"\n```\n\nOr with an asset from the inventory:\n\n```coffeescript\nassets = inventory.get representation: \"standard\", category: \"arm\"\navatar.equip \"arm\", assets[0]\n```\n\nOr with a defined set of assets (an 'ensemble'):\n\n```coffeescript\nensemble =\n    arm:\n        [Asset]\n    leg:\n        [Asset]\n    head:\n        [Asset]\n\navatar.build ensemble\n```\n\n###Saving and displaying avatars\n\nWhen you've made changes to an avatar, you can save it:\n\n```coffeescript\navatar.save().then ->\n    console.log \"Done!\"\n```\n\nAnd at any time, you can display it on a given `canvas` element:\n\n```coffeescript\ncanvas = $(\"#myCanvas\").get(0)\ntotem.drawOn avatar, canvas\n```\n\nDrawing an avatar on a canvas 'binds' it to that canvas; changing\nassets or colours on the avatar will automatically redraw it on the\ncanvas.\n\n###Events\n\nOn an `equip`, `build` or `colour[x]` call to an avatar, Totem will send the\n`avatarChange` event, which can be bound to like so:\n\n```coffeescript\n$(totem).on \"avatarChange\", (event, data) ->\n    doSomethingWith data\n```\n\nData is an object which will always have the property `avatar`,\ncontaining the avatar which sent the event, and `event`, which is a\nstring representing the event type (`build`, `equip`, `colour1` or\n`colour2`. If the event was prompted by an `equip` or a local colour\nchange, there will also be a `category` property giving the category\nthat the `equip` was called on.\n","readmeFilename":"README.md","_id":"totem@4.0.0","dist":{"shasum":"a168f500d4d7dbc9292c9e3bbd2e75a8c2caed53","tarball":"https://registry.npmjs.org/totem/-/totem-4.0.0.tgz","integrity":"sha512-MEQfwcnicBKRExpswN1aB8fnSnJoqy4XKncolq7bpUSCkcbe6YOya34K1/fpEu5dGqgG0JqW6MdTHv7SLHn7HA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCc3WZ4kG7G3YkgFp6IdMY2PnTB6WWwSemnVbJQaow9XgIgQ9ZwafCG+rvgaBRREDcHLDLKjhymUWkqdX+3tzPmQ08="}]},"_from":".","_npmVersion":"1.2.11","_npmUser":{"name":"huzutechtools","email":"github@huzutech.com"},"maintainers":[{"name":"huzutechtools","email":"github@huzutech.com"}],"directories":{}},"4.1.0":{"name":"totem","version":"4.1.0","author":{"name":"Robert Dallas Gray","email":"robert.dallas.gray@huzutech.com"},"description":"A library to easily manipulate avatar data in HAPI.","keywords":["hapi","avatars"],"dependencies":{"hapilib":"0.6.x"},"devDependencies":{"karma":"0.8.x","browserify":"2.12.x","coffee-script":"1.6.x","codo":"1.6.x","hapi.app.tools":"0.0.x"},"repository":{"type":"git","url":"https://github.com/HuzuTech/Totem.git"},"scripts":{"prepublish":"cake build","pretest":"./node_modules/.bin/coffee -c -o lib/ src/","test":"./node_modules/.bin/karma start --single-run --browsers PhantomJS"},"readme":"#Totem\n\nThis is a library built on top of\n[HAPILib](https://github.com/HuzuTech/hapilibjs), intended to be used\nas part of [HAPI.App](https://github.com/HuzuTech/HAPI.App).\n\nIt allows you to simply and quickly perform the necessary procedures\nto load, save, alter and view avatars, in the context of a logged-in\nuser.\n\nThe library uses\n[jQuery Deferred](http://api.jquery.com/category/deferred-object/) to\nhandle asynchronous tasks, all of which return a `promise`.\n\nFor full documentation, see the [API docs](http://huzutech.github.io/Totem).\n\n##Testing\n\nClone the Totem repo, then cd into its root and install dependencies:\n\n```npm install```\n\nWhen done, run\n\n```npm test```\n\n##Setup\n\nTo begin using Totem, create a new `Totem` object:\n\n```coffeescript\ntotem = new Totem endPoint: \"https://my.hapi.instance-hapi\", clientId: 2001\n```\n\nNote that this isn't necessary if you are using\n[HAPI.App](https://github.com/HuzuTech/HAPI.App), which will create a\n`Totem` object for you.\n\n##Quick Start\n\nTo get an inventory of assets for a logged-in user:\n\n```coffeescript\ntotem.inventory().then (inventory) ->\n    console.log inventory.get representation: \"standard\"\n```\n\nOnce you have an `inventory` object to work with, further calls to it are\nmostly synchronous.\n\n###Representations\n\nThe `representation: \"standard\"` option argument to `inventory.get` is the Label of a HAPI\nrepresentation. You must always supply a representation, but you\nmay set a default one to avoid having to do so repeatedly.\n\nYou can set a default representation globally:\n\n```coffeescript\ntotem.representation \"standard\"\n```\n\nOr only in the context of an inventory:\n\n```coffeescript\ninventory.representation \"standard\"\n```\n\n###Scoping\n\nBy default, `Inventory.get` will return categorised arrays of assets with no\nreference to which goods they might belong to:\n\n```coffeescript\ncategory1:\n    [Assets ...]\ncategory2:\n    [Assets ...]\n```\n\nYou can get only assets belonging to a given good like so:\n\n```coffeescript\ninventory.get representation: \"standard\", good: \"default\"\n```\n\nAgain, you can set a default good in the context of an inventory:\n\n```coffeescript\ninventory.good \"default\"\n```\n\nYou can scope assets by category:\n\n```coffeescript\ninventory.get representation: \"standard\", category: \"category1\"\n```\n\nThis will return an array of assets in the given category.\n\nAssets are always returned in the context of the given representation,\nso each asset in a returned array will look like this:\n\n```coffeescript\nId: 1\nLabel: \"skinny_arm\"\nCategoryId: 1\nGoodId: 1\nDateCreated: \"2012-10-17T19:20:36.97\"\nLayers: [...]\nMetadata: \"\"\nThumbnail: \"\"\n```\n\n##Categories and Goods\n\nRetrieve a complete array of categories:\n\n```coffeescript\ntotem.categories().then (categories) ->\n    console.log categories\n```\n\nAnd a complete array of goods in the system:\n\n```coffeescript\ntotem.goods().then (goods) ->\n    console.log goods\n```\n\nOr just those available to the logged-in user:\n\n```coffeescript\ntotem.user().goods().then (goods) ->\n    console.log goods\n```\n\nCategories are always supplied in an array sorted correctly by the\n`SortOrder` property.\n\n##Avatars\n\nTo create a new avatar:\n\n```coffeescript\navatar = totem.avatar Label: \"new-avatar\"\n```\n\nOptionally, you can pass a hash of attributes to this method, which\nwill be applied to the created avatar (the most relevant of which will\nprobably be the `Label` attribute).\n\nTo get a set of avatars already created by the user:\n\n```coffeescript\ntotem.avatars(\"standard\").then (avatars) ->\n    console.log avatars\n```\n\nThe argument to `totem.avatars` is the name of a representation, which\nis optional only if you have set a global default representation.\n\n###Equipping avatars\n\nOnce you have an avatar, you can equip it with a random set of assets:\n\n```coffeescript\ntotem.randomise(avatar, representation: \"standard\").then ->\n    console.log \"Done!\"\n```\n\nOr with an asset from the inventory:\n\n```coffeescript\nassets = inventory.get representation: \"standard\", category: \"arm\"\navatar.equip \"arm\", assets[0]\n```\n\nOr with a defined set of assets (an 'ensemble'):\n\n```coffeescript\nensemble =\n    arm:\n        [Asset]\n    leg:\n        [Asset]\n    head:\n        [Asset]\n\navatar.build ensemble\n```\n\n###Saving and displaying avatars\n\nWhen you've made changes to an avatar, you can save it:\n\n```coffeescript\navatar.save().then ->\n    console.log \"Done!\"\n```\n\nAnd at any time, you can display it on a given `canvas` element:\n\n```coffeescript\ncanvas = $(\"#myCanvas\").get(0)\ntotem.drawOn avatar, canvas\n```\n\nDrawing an avatar on a canvas 'binds' it to that canvas; changing\nassets or colours on the avatar will automatically redraw it on the\ncanvas.\n\n###Events\n\nOn an `equip`, `build` or `colour[x]` call to an avatar, Totem will send the\n`avatarChange` event, which can be bound to like so:\n\n```coffeescript\n$(totem).on \"avatarChange\", (event, data) ->\n    doSomethingWith data\n```\n\nData is an object which will always have the property `avatar`,\ncontaining the avatar which sent the event, and `event`, which is a\nstring representing the event type (`build`, `equip`, `colour1` or\n`colour2`. If the event was prompted by an `equip` or a local colour\nchange, there will also be a `category` property giving the category\nthat the `equip` was called on.\n","readmeFilename":"README.md","_id":"totem@4.1.0","dist":{"shasum":"348980a1be1ca6422063cf8798af01dcf212f76f","tarball":"https://registry.npmjs.org/totem/-/totem-4.1.0.tgz","integrity":"sha512-PjXJfnZJwLrgRBKL/r4l/x0qpXkEUbuKirfEMpc7vupIcKGq0hEb6/rcAGmK3beuytZScU0SG8ZliTNKat5fHg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCpWTgE6Np9R3hFmw34uSffrdwmoBrdpRP/FpwkRHjHyAIgcBJVbcuGeTfiNVWmxXL6vZRsXPLmN79KGDfGiFal9YE="}]},"_from":".","_npmVersion":"1.2.11","_npmUser":{"name":"huzutechtools","email":"github@huzutech.com"},"maintainers":[{"name":"huzutechtools","email":"github@huzutech.com"}],"directories":{}},"5.0.0":{"name":"totem","version":"5.0.0","author":{"name":"Robert Dallas Gray","email":"robert.dallas.gray@huzutech.com"},"description":"A library to easily manipulate avatar data in HAPI.","keywords":["hapi","avatars"],"dependencies":{"hapilib":"0.6.x"},"devDependencies":{"karma":"0.8.x","browserify":"2.12.x","coffee-script":"1.6.x","codo":"1.6.x","hapi.app.tools":"0.0.x"},"repository":{"type":"git","url":"https://github.com/HuzuTech/Totem.git"},"scripts":{"prepublish":"cake build","pretest":"./node_modules/.bin/coffee -c -o lib/ src/","test":"./node_modules/.bin/karma start --single-run --browsers PhantomJS"},"readme":"#Totem\n\nThis is a library built on top of\n[HAPILib](https://github.com/HuzuTech/hapilibjs), intended to be used\nas part of [HAPI.App](https://github.com/HuzuTech/HAPI.App).\n\nIt allows you to simply and quickly perform the necessary procedures\nto load, save, alter and view avatars, in the context of a logged-in\nuser.\n\nThe library uses\n[jQuery Deferred](http://api.jquery.com/category/deferred-object/) to\nhandle asynchronous tasks, all of which return a `promise`.\n\nFor full documentation, see the [API docs](http://huzutech.github.io/Totem).\n\n##Testing\n\nClone the Totem repo, then cd into its root and install dependencies:\n\n```npm install```\n\nWhen done, run\n\n```npm test```\n\n##Setup\n\nTo begin using Totem, create a new `Totem` object:\n\n```coffeescript\ntotem = new Totem endPoint: \"https://my.hapi.instance-hapi\", clientId: 2001\n```\n\nNote that this isn't necessary if you are using\n[HAPI.App](https://github.com/HuzuTech/HAPI.App), which will create a\n`Totem` object for you.\n\n##Quick Start\n\nTo get an inventory of assets for a logged-in user:\n\n```coffeescript\ntotem.inventory().then (inventory) ->\n    console.log inventory.get representation: \"standard\"\n```\n\nOnce you have an `inventory` object to work with, further calls to it are\nmostly synchronous.\n\n###Representations\n\nThe `representation: \"standard\"` option argument to `inventory.get` is the Label of a HAPI\nrepresentation. You must always supply a representation, but you\nmay set a default one to avoid having to do so repeatedly.\n\nYou can set a default representation globally:\n\n```coffeescript\ntotem.representation \"standard\"\n```\n\nOr only in the context of an inventory:\n\n```coffeescript\ninventory.representation \"standard\"\n```\n\n###Scoping\n\nBy default, `Inventory.get` will return categorised arrays of assets with no\nreference to which goods they might belong to:\n\n```coffeescript\ncategory1:\n    [Assets ...]\ncategory2:\n    [Assets ...]\n```\n\nYou can get only assets belonging to a given good like so:\n\n```coffeescript\ninventory.get representation: \"standard\", good: \"default\"\n```\n\nAgain, you can set a default good in the context of an inventory:\n\n```coffeescript\ninventory.good \"default\"\n```\n\nYou can scope assets by category:\n\n```coffeescript\ninventory.get representation: \"standard\", category: \"category1\"\n```\n\nThis will return an array of assets in the given category.\n\nAssets are always returned in the context of the given representation,\nso each asset in a returned array will look like this:\n\n```coffeescript\nId: 1\nLabel: \"skinny_arm\"\nCategoryId: 1\nGoodId: 1\nDateCreated: \"2012-10-17T19:20:36.97\"\nLayers: [...]\nMetadata: \"\"\nThumbnail: \"\"\n```\n\n##Categories and Goods\n\nRetrieve a complete array of categories:\n\n```coffeescript\ntotem.categories().then (categories) ->\n    console.log categories\n```\n\nAnd a complete array of goods in the system:\n\n```coffeescript\ntotem.goods().then (goods) ->\n    console.log goods\n```\n\nOr just those available to the logged-in user:\n\n```coffeescript\ntotem.user().goods().then (goods) ->\n    console.log goods\n```\n\nCategories are always supplied in an array sorted correctly by the\n`SortOrder` property.\n\n##Avatars\n\nTo create a new avatar:\n\n```coffeescript\navatar = totem.avatar Label: \"new-avatar\"\n```\n\nOptionally, you can pass a hash of attributes to this method, which\nwill be applied to the created avatar (the most relevant of which will\nprobably be the `Label` attribute).\n\nTo get a set of avatars already created by the user:\n\n```coffeescript\ntotem.avatars(\"standard\").then (avatars) ->\n    console.log avatars\n```\n\nThe argument to `totem.avatars` is the name of a representation, which\nis optional only if you have set a global default representation.\n\n###Equipping avatars\n\nOnce you have an avatar, you can equip it with a random set of assets:\n\n```coffeescript\ntotem.randomise(avatar, representation: \"standard\").then ->\n    console.log \"Done!\"\n```\n\nOr with an asset from the inventory:\n\n```coffeescript\nassets = inventory.get representation: \"standard\", category: \"arm\"\navatar.equip \"arm\", assets[0]\n```\n\nOr with a defined set of assets (an 'ensemble'):\n\n```coffeescript\nensemble =\n    arm:\n        [Asset]\n    leg:\n        [Asset]\n    head:\n        [Asset]\n\navatar.build ensemble\n```\n\n###Saving and displaying avatars\n\nWhen you've made changes to an avatar, you can save it:\n\n```coffeescript\navatar.save().then ->\n    console.log \"Done!\"\n```\n\nAnd at any time, you can display it on a given `canvas` element:\n\n```coffeescript\ncanvas = $(\"#myCanvas\").get(0)\ntotem.drawOn avatar, canvas\n```\n\nDrawing an avatar on a canvas 'binds' it to that canvas; changing\nassets or colours on the avatar will automatically redraw it on the\ncanvas.\n\n###Events\n\nOn an `equip`, `build` or `colour[x]` call to an avatar, Totem will send the\n`avatarChange` event, which can be bound to like so:\n\n```coffeescript\n$(totem).on \"avatarChange\", (event, data) ->\n    doSomethingWith data\n```\n\nData is an object which will always have the property `avatar`,\ncontaining the avatar which sent the event, and `event`, which is a\nstring representing the event type (`build`, `equip`, `colour1` or\n`colour2`. If the event was prompted by an `equip` or a local colour\nchange, there will also be a `category` property giving the category\nthat the `equip` was called on.\n","readmeFilename":"README.md","_id":"totem@5.0.0","dist":{"shasum":"0a4c75253ba867ac2b9bb3378e4c032d071a94f2","tarball":"https://registry.npmjs.org/totem/-/totem-5.0.0.tgz","integrity":"sha512-V+TsqCkioF1M+gl/Vwvigx3tM5sXro+Uv3k/luXJRnrpujK/esPYdU6fgvdAn79QYOyTKroL8fQOv6OzDEgLGA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICd2pDqaUTlQ/47Y+o8A/UfQTYuROcB4JKfgI2G8RCJ8AiEAuL0XpkeOObTgk0A9Ms6L1FD/+c2YgFDOwZ6FpDq3t2w="}]},"_from":".","_npmVersion":"1.2.11","_npmUser":{"name":"huzutechtools","email":"github@huzutech.com"},"maintainers":[{"name":"huzutechtools","email":"github@huzutech.com"}],"directories":{}},"5.1.0":{"name":"totem","version":"5.1.0","author":{"name":"Robert Dallas Gray","email":"robert.dallas.gray@huzutech.com"},"description":"A library to easily manipulate avatar data in HAPI.","keywords":["hapi","avatars"],"dependencies":{"hapilib":"0.6.x"},"devDependencies":{"karma":"0.8.x","browserify":"2.12.x","coffee-script":"1.6.x","codo":"1.6.x","hapi.app.tools":"0.0.x"},"repository":{"type":"git","url":"https://github.com/HuzuTech/Totem.git"},"scripts":{"prepublish":"cake build","pretest":"./node_modules/.bin/coffee -c -o lib/ src/","test":"./node_modules/.bin/karma start --single-run --browsers PhantomJS"},"readme":"#Totem\n\nThis is a library built on top of\n[HAPILib](https://github.com/HuzuTech/hapilibjs), intended to be used\nas part of [HAPI.App](https://github.com/HuzuTech/HAPI.App).\n\nIt allows you to simply and quickly perform the necessary procedures\nto load, save, alter and view avatars, in the context of a logged-in\nuser.\n\nThe library uses\n[jQuery Deferred](http://api.jquery.com/category/deferred-object/) to\nhandle asynchronous tasks, all of which return a `promise`.\n\nFor full documentation, see the [API docs](http://huzutech.github.io/Totem).\n\n##Testing\n\nClone the Totem repo, then cd into its root and install dependencies:\n\n```npm install```\n\nWhen done, run\n\n```npm test```\n\n##Setup\n\nTo begin using Totem, create a new `Totem` object:\n\n```coffeescript\ntotem = new Totem endPoint: \"https://my.hapi.instance-hapi\", clientId: 2001\n```\n\nNote that this isn't necessary if you are using\n[HAPI.App](https://github.com/HuzuTech/HAPI.App), which will create a\n`Totem` object for you.\n\n##Quick Start\n\nTo get an inventory of assets for a logged-in user:\n\n```coffeescript\ntotem.inventory().then (inventory) ->\n    console.log inventory.get representation: \"standard\"\n```\n\nOnce you have an `inventory` object to work with, further calls to it are\nmostly synchronous.\n\n###Representations\n\nThe `representation: \"standard\"` option argument to `inventory.get` is the Label of a HAPI\nrepresentation. You must always supply a representation, but you\nmay set a default one to avoid having to do so repeatedly.\n\nYou can set a default representation globally:\n\n```coffeescript\ntotem.config \"representation\", \"standard\"\n```\n\nOr only in the context of an inventory:\n\n```coffeescript\ninventory.representation \"standard\"\n```\n\n###Scoping\n\nBy default, `Inventory.get` will return categorised arrays of assets with no\nreference to which goods they might belong to:\n\n```coffeescript\ncategory1:\n    [Assets ...]\ncategory2:\n    [Assets ...]\n```\n\nYou can get only assets belonging to a given good like so:\n\n```coffeescript\ninventory.get representation: \"standard\", good: \"default\"\n```\n\nAgain, you can set a default good in the context of an inventory:\n\n```coffeescript\ninventory.good \"default\"\n```\n\nYou can scope assets by category:\n\n```coffeescript\ninventory.get representation: \"standard\", category: \"category1\"\n```\n\nThis will return an array of assets in the given category.\n\nAssets are always returned in the context of the given representation,\nso each asset in a returned array will look like this:\n\n```coffeescript\nId: 1\nLabel: \"skinny_arm\"\nCategoryId: 1\nGoodId: 1\nDateCreated: \"2012-10-17T19:20:36.97\"\nLayers: [...]\nMetadata: \"\"\nThumbnail: \"\"\n```\n\n##Categories and Goods\n\nRetrieve a complete array of categories:\n\n```coffeescript\ntotem.categories().then (categories) ->\n    console.log categories\n```\n\nAnd a complete array of goods in the system:\n\n```coffeescript\ntotem.goods().then (goods) ->\n    console.log goods\n```\n\nOr just those available to the logged-in user:\n\n```coffeescript\ntotem.user().goods().then (goods) ->\n    console.log goods\n```\n\nCategories are always supplied in an array sorted correctly by the\n`SortOrder` property.\n\n##Avatars\n\nTo create a new avatar:\n\n```coffeescript\navatar = totem.avatar Label: \"new-avatar\"\n```\n\nOptionally, you can pass a hash of attributes to this method, which\nwill be applied to the created avatar (the most relevant of which will\nprobably be the `Label` attribute).\n\nTo get a set of avatars already created by the user:\n\n```coffeescript\ntotem.avatars(\"standard\").then (avatars) ->\n    console.log avatars\n```\n\nThe argument to `totem.avatars` is the name of a representation, which\nis optional only if you have set a global default representation.\n\n###Equipping avatars\n\nOnce you have an avatar, you can equip it with a random set of assets:\n\n```coffeescript\ntotem.randomise(avatar, representation: \"standard\").then ->\n    console.log \"Done!\"\n```\n\nOr with an asset from the inventory:\n\n```coffeescript\nassets = inventory.get representation: \"standard\", category: \"arm\"\navatar.equip \"arm\", assets[0]\n```\n\nOr with a defined set of assets (an 'ensemble'):\n\n```coffeescript\nensemble =\n    arm:\n        [Asset]\n    leg:\n        [Asset]\n    head:\n        [Asset]\n\navatar.build ensemble\n```\n\n###Saving and displaying avatars\n\nWhen you've made changes to an avatar, you can save it:\n\n```coffeescript\navatar.save().then ->\n    console.log \"Done!\"\n```\n\nAnd at any time, you can display it on a given `canvas` element:\n\n```coffeescript\ncanvas = $(\"#myCanvas\").get(0)\ntotem.drawOn avatar, canvas\n```\n\nDrawing an avatar on a canvas 'binds' it to that canvas; changing\nassets or colours on the avatar will automatically redraw it on the\ncanvas.\n\n###Events\n\nOn an `equip`, `build` or `colour[x]` call to an avatar, Totem will send the\n`avatarChange` event, which can be bound to like so:\n\n```coffeescript\n$(totem).on \"avatarChange\", (event, data) ->\n    doSomethingWith data\n```\n\nData is an object which will always have the property `avatar`,\ncontaining the avatar which sent the event, and `event`, which is a\nstring representing the event type (`build`, `equip`, `colour1` or\n`colour2`. If the event was prompted by an `equip` or a local colour\nchange, there will also be a `category` property giving the category\nthat the `equip` was called on.\n","readmeFilename":"README.md","_id":"totem@5.1.0","dist":{"shasum":"e4ac459b0551eb69e0eaf22545ddcf417ef7fa32","tarball":"https://registry.npmjs.org/totem/-/totem-5.1.0.tgz","integrity":"sha512-huf8dO0nEmPQxggRn/QXCihCCFfGz0vL+uGMepL2NQFXdB0fj5CF2O60c5Vre8JkzY2IK32W0uMbKdibaWyFxw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCgepKxE30dqHawZL+pE7mKa3VwbMpPMyVrbhNMEbcIzwIhAIsjmigMNip1WTIrOgxrV4xEnFavIoK0+8r27RtV0MOu"}]},"_from":".","_npmVersion":"1.2.11","_npmUser":{"name":"huzutechtools","email":"github@huzutech.com"},"maintainers":[{"name":"huzutechtools","email":"github@huzutech.com"}]},"5.2.0":{"name":"totem","version":"5.2.0","author":{"name":"Robert Dallas Gray","email":"robert.dallas.gray@huzutech.com"},"description":"A library to easily manipulate avatar data in HAPI.","keywords":["hapi","avatars"],"dependencies":{"hapilib":"0.6.x"},"devDependencies":{"karma":"0.8.x","browserify":"2.12.x","coffee-script":"1.6.x","codo":"1.6.x","hapi.app.tools":"0.0.x"},"repository":{"type":"git","url":"https://github.com/HuzuTech/Totem.git"},"scripts":{"prepublish":"cake build","pretest":"./node_modules/.bin/coffee -c -o lib/ src/","test":"./node_modules/.bin/karma start --single-run --browsers PhantomJS"},"readme":"#Totem\n\nThis is a library built on top of\n[HAPILib](https://github.com/HuzuTech/hapilibjs), intended to be used\nas part of [HAPI.App](https://github.com/HuzuTech/HAPI.App).\n\nIt allows you to simply and quickly perform the necessary procedures\nto load, save, alter and view avatars, in the context of a logged-in\nuser.\n\nThe library uses\n[jQuery Deferred](http://api.jquery.com/category/deferred-object/) to\nhandle asynchronous tasks, all of which return a `promise`.\n\nFor full documentation, see the [API docs](http://huzutech.github.io/Totem).\n\n##Testing\n\nClone the Totem repo, then cd into its root and install dependencies:\n\n```npm install```\n\nWhen done, run\n\n```npm test```\n\n##Setup\n\nTo begin using Totem, create a new `Totem` object:\n\n```coffeescript\ntotem = new Totem endPoint: \"https://my.hapi.instance-hapi\", clientId: 2001\n```\n\nNote that this isn't necessary if you are using\n[HAPI.App](https://github.com/HuzuTech/HAPI.App), which will create a\n`Totem` object for you.\n\n##Quick Start\n\nTo get an inventory of assets for a logged-in user:\n\n```coffeescript\ntotem.inventory().then (inventory) ->\n    console.log inventory.get representation: \"standard\"\n```\n\nOnce you have an `inventory` object to work with, further calls to it are\nmostly synchronous.\n\n###Representations\n\nThe `representation: \"standard\"` option argument to `inventory.get` is the Label of a HAPI\nrepresentation. You must always supply a representation, but you\nmay set a default one to avoid having to do so repeatedly.\n\nYou can set a default representation globally:\n\n```coffeescript\ntotem.config \"representation\", \"standard\"\n```\n\nOr only in the context of an inventory:\n\n```coffeescript\ninventory.representation \"standard\"\n```\n\n###Scoping\n\nBy default, `Inventory.get` will return categorised arrays of assets with no\nreference to which goods they might belong to:\n\n```coffeescript\ncategory1:\n    [Assets ...]\ncategory2:\n    [Assets ...]\n```\n\nYou can get only assets belonging to a given good like so:\n\n```coffeescript\ninventory.get representation: \"standard\", good: \"default\"\n```\n\nAgain, you can set a default good in the context of an inventory:\n\n```coffeescript\ninventory.good \"default\"\n```\n\nYou can scope assets by category:\n\n```coffeescript\ninventory.get representation: \"standard\", category: \"category1\"\n```\n\nThis will return an array of assets in the given category.\n\nAssets are always returned in the context of the given representation,\nso each asset in a returned array will look like this:\n\n```coffeescript\nId: 1\nLabel: \"skinny_arm\"\nCategoryId: 1\nGoodId: 1\nDateCreated: \"2012-10-17T19:20:36.97\"\nLayers: [...]\nMetadata: \"\"\nThumbnail: \"\"\n```\n\n##Categories and Goods\n\nRetrieve a complete array of categories:\n\n```coffeescript\ntotem.categories().then (categories) ->\n    console.log categories\n```\n\nAnd a complete array of goods in the system:\n\n```coffeescript\ntotem.goods().then (goods) ->\n    console.log goods\n```\n\nOr just those available to the logged-in user:\n\n```coffeescript\ntotem.user().goods().then (goods) ->\n    console.log goods\n```\n\nCategories are always supplied in an array sorted correctly by the\n`SortOrder` property.\n\n##Avatars\n\nTo create a new avatar:\n\n```coffeescript\navatar = totem.avatar Label: \"new-avatar\"\n```\n\nOptionally, you can pass a hash of attributes to this method, which\nwill be applied to the created avatar (the most relevant of which will\nprobably be the `Label` attribute).\n\nTo get a set of avatars already created by the user:\n\n```coffeescript\ntotem.avatars(\"standard\").then (avatars) ->\n    console.log avatars\n```\n\nThe argument to `totem.avatars` is the name of a representation, which\nis optional only if you have set a global default representation.\n\n###Equipping avatars\n\nOnce you have an avatar, you can equip it with a random set of assets:\n\n```coffeescript\ntotem.randomise(avatar, representation: \"standard\").then ->\n    console.log \"Done!\"\n```\n\nOr with an asset from the inventory:\n\n```coffeescript\nassets = inventory.get representation: \"standard\", category: \"arm\"\navatar.equip \"arm\", assets[0]\n```\n\nOr with a defined set of assets (an 'ensemble'):\n\n```coffeescript\nensemble =\n    arm:\n        [Asset]\n    leg:\n        [Asset]\n    head:\n        [Asset]\n\navatar.build ensemble\n```\n\n###Saving and displaying avatars\n\nWhen you've made changes to an avatar, you can save it:\n\n```coffeescript\navatar.save().then ->\n    console.log \"Done!\"\n```\n\nAnd at any time, you can display it on a given `canvas` element:\n\n```coffeescript\ncanvas = $(\"#myCanvas\").get(0)\ntotem.drawOn avatar, canvas\n```\n\nDrawing an avatar on a canvas 'binds' it to that canvas; changing\nassets or colours on the avatar will automatically redraw it on the\ncanvas.\n\n###Events\n\nOn an `equip`, `build` or `colour[x]` call to an avatar, Totem will send the\n`avatarChange` event, which can be bound to like so:\n\n```coffeescript\n$(totem).on \"avatarChange\", (event, data) ->\n    doSomethingWith data\n```\n\nData is an object which will always have the property `avatar`,\ncontaining the avatar which sent the event, and `event`, which is a\nstring representing the event type (`build`, `equip`, `colour1` or\n`colour2`. If the event was prompted by an `equip` or a local colour\nchange, there will also be a `category` property giving the category\nthat the `equip` was called on.\n","readmeFilename":"README.md","_id":"totem@5.2.0","dist":{"shasum":"31bfbe72c1a993df48276ed5b95837372b9b7027","tarball":"https://registry.npmjs.org/totem/-/totem-5.2.0.tgz","integrity":"sha512-vYRyBBuRjiuUbZ7Dxuro34JghrFXW24qXFjSPkmUagICY1Ctoh62BPHKRG5UylwLBTZT/6tgZvTTc8gscDKs5A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCI6QUUjWtyV6phmjZhyVkQ2vEM2pCKeVSWnuDUbLVO9gIgb5P6eYagYS2Jimwo2wJY+F9KW4HfJzcSEOZCDs+7bkQ="}]},"_from":".","_npmVersion":"1.2.11","_npmUser":{"name":"huzutechtools","email":"github@huzutech.com"},"maintainers":[{"name":"huzutechtools","email":"github@huzutech.com"}]}},"readme":"hapi.app.avatars\n================\n\nThis is a small library built on top of [HAPILib](https://github.com/HuzuTech/hapilibjs), intended to be used as part of [HAPI.App](https://github.com/HuzuTech/HAPI.App).\n\nThe functionality is very limited at present. It allows you to very easily access all assets available to a user, organised in a data structure intended to enable easy app development.\n\nThe library uses [jQuery Deferred](http://api.jquery.com/category/deferred-object/) to handle asynchronous tasks, all of which return a `promise`.\n\nTo get assets available to a user:\n```javascript\nvar hav = new HapiAvatars;\nhav.user.assets({ representation: \"standard\" })\n    .then(function(assets) { doSomethingWithAssets(assets); });\n```\n\nThe data structure returned is of the form:\n```javascript\n{\n   pack_name:\n   {\n       category_name:\n       [\n           {\n               Id: \"1\",\n               Label: \"asset_label\",\n               Title: \"Asset Title\",\n               Metadata: {},\n               DateCreated: \"2013-01-14T17:11:11.777\",\n               GoodId: \"1\",\n               CategoryId: \"1\",\n               Thumbnail: \"http://thumbnail.com/thumbnail\",\n               Layers: [...]\n           },\n           {\n               Id: \"2\",\n               Label: \"asset_label\",\n               Title: \"Asset Title\",\n               Metadata: {},\n               DateCreated: \"2013-01-14T17:11:11.777\",\n               GoodId: \"1\",\n               CategoryId: \"1\",\n               Thumbnail: \"http://thumbnail.com/thumbnail\",\n               Layers: [...]\n           }, ...\n       ],\n       category_name:\n       [\n           {\n               ...\n           }\n       ]\n   }\n}\n```\n","maintainers":[{"name":"huzutechtools","email":"github@huzutech.com"}],"time":{"modified":"2022-06-27T18:57:01.410Z","created":"2013-05-01T11:33:54.551Z","0.0.8":"2013-05-01T11:33:56.922Z","0.1.0":"2013-05-07T13:28:32.552Z","0.2.0":"2013-05-17T15:07:20.194Z","1.0.0":"2013-05-20T15:33:07.942Z","1.0.2":"2013-05-21T08:25:16.527Z","2.0.0":"2013-05-23T09:10:41.191Z","2.0.2":"2013-05-24T08:41:40.941Z","1.0.11":"2013-05-24T10:00:29.261Z","2.0.4":"2013-05-24T10:01:32.842Z","2.0.5":"2013-05-24T10:45:57.184Z","2.0.8":"2013-05-29T09:37:38.500Z","3.0.0":"2013-05-29T09:39:25.504Z","3.0.3":"2013-05-30T15:44:07.705Z","4.0.0":"2013-06-10T15:37:55.606Z","4.1.0":"2013-06-13T08:45:43.964Z","5.0.0":"2013-06-14T14:13:51.833Z","5.1.0":"2013-06-27T16:37:42.001Z","5.2.0":"2013-07-01T09:57:12.722Z"},"author":{"name":"Robert Dallas Gray","email":"robert.dallas.gray@huzutech.com"},"repository":{"type":"git","url":"https://github.com/HuzuTech/Totem.git"}}