{"_id":"glass-prism","_rev":"27-2769cf605197ff8b8d082360737e4b3c","name":"glass-prism","description":"Node.js framework for building Google Glass Mirror applications","dist-tags":{"latest":"0.3.0"},"versions":{"0.0.1":{"name":"glass-prism","version":"0.0.1","description":"Node.js framework for building Google Glass Mirror applications","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"https://github.com/jaxbot/repos/glass-prism"},"keywords":["glass","google","prism","google","glass","mirror","api"],"author":{"name":"Jonathan Warner"},"license":"MIT","dependencies":{"googleapis":"~0.6.1","dot":"~1.0.2"},"_id":"glass-prism@0.0.1","dist":{"shasum":"5ff583eb223b9b20ad9f993357c284eea952c9e6","tarball":"https://registry.npmjs.org/glass-prism/-/glass-prism-0.0.1.tgz","integrity":"sha512-FKwzvgFDxAJYHmjpXCkR+YS2JqLjXykSo4leygdUnr55mVsj8N847sAgqk17+caSmYKEc25LcWwSvgDg6BHsxQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICQkNYkB6mkbHafNkVTZijKH37n898eJuP+Q8Vq6nfsaAiEA6nNI5xx2/m1EakGWMRZERyf4Wrc8Z5F4EaQqwTe0ezM="}]},"_from":".","_npmVersion":"1.3.14","_npmUser":{"name":"jaxbot","email":"jaxbot@gmail.com"},"maintainers":[{"name":"jaxbot","email":"jaxbot@gmail.com"}]},"0.0.2":{"name":"glass-prism","version":"0.0.2","description":"Node.js framework for building Google Glass Mirror applications","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"https://github.com/jaxbot/repos/glass-prism"},"keywords":["glass","google","prism","google","glass","mirror","api"],"author":{"name":"Jonathan Warner"},"license":"MIT","dependencies":{"googleapis":"~0.6.1","dot":"~1.0.2"},"_id":"glass-prism@0.0.2","dist":{"shasum":"ea3f4f4a8171314f9fd9d687ae9bbaca86f8d4a5","tarball":"https://registry.npmjs.org/glass-prism/-/glass-prism-0.0.2.tgz","integrity":"sha512-7KLFEXQIEk/22jnQDUyExIh3n2V+DgRekfzTidmUglBCM2H0FKdBfB6pyANxqNCELcFOXMtJDWgnoWmS6w2Smw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFvSx23kJAtL+uCRSoT3WnbmlZOYuMItFVtb+LL6EIkKAiAftJ39DfJjjfpkMtj+BMCEkCSnpnFGlYP7KyYp0ZaOmA=="}]},"_from":".","_npmVersion":"1.3.14","_npmUser":{"name":"jaxbot","email":"jaxbot@gmail.com"},"maintainers":[{"name":"jaxbot","email":"jaxbot@gmail.com"}]},"0.1.0":{"name":"glass-prism","version":"0.1.0","description":"Node.js framework for building Google Glass Mirror applications","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"https://github.com/jaxbot/glass-prism"},"keywords":["glass","google","prism","google","glass","mirror","api"],"author":{"name":"Jonathan Warner"},"license":"MIT","dependencies":{"googleapis":"~0.6.1","dot":"~1.0.2"},"bugs":{"url":"https://github.com/jaxbot/glass-prism/issues"},"homepage":"https://github.com/jaxbot/glass-prism","_id":"glass-prism@0.1.0","dist":{"shasum":"c149dcbbcdfb450b21823720803e29591aa62086","tarball":"https://registry.npmjs.org/glass-prism/-/glass-prism-0.1.0.tgz","integrity":"sha512-Uv7WHE70B8/uGCO5Br8yD9HYR2pEs5LhWd894iiVPpg4baJynVm9IRZPDNyzZVtA/7vRTepm2qdUZD65tFTg6A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCHYtqXDlK53SPMUbRV9v1LwvRIya58v+AmiJwjY1NFwAIgOvKlRzWcPzlQV0zhIbGYbpmcsqbMjN+d3VbEtYz5S5g="}]},"_from":".","_npmVersion":"1.3.14","_npmUser":{"name":"jaxbot","email":"jaxbot@gmail.com"},"maintainers":[{"name":"jaxbot","email":"jaxbot@gmail.com"}]},"0.3.0":{"name":"glass-prism","version":"0.3.0","description":"Node.js framework for building Google Glass Mirror applications","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"https://github.com/jaxbot/glass-prism"},"keywords":["glass","google","prism","google","glass","mirror","api"],"author":{"name":"Jonathan Warner"},"license":"MIT","dependencies":{"googleapis":"~0.6.1","dot":"~1.0.2"},"bugs":{"url":"https://github.com/jaxbot/glass-prism/issues"},"homepage":"https://github.com/jaxbot/glass-prism","_id":"glass-prism@0.3.0","dist":{"shasum":"2432f5ab8348dfd26a428c12522c124165fbfe29","tarball":"https://registry.npmjs.org/glass-prism/-/glass-prism-0.3.0.tgz","integrity":"sha512-H6Acdyz0J/PUGCQ1+c3IHvt/9/jWi5RhLXP2M53rX/VvLZA+U+lZGGQaGKJHneD4eYsKlBOtifjMINUAp2oS8g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDesTmxlU+5yW4h9MHFXvQPCKBbu40qPbaoyoQrQDsiugIhALwOhaRYgwewlGrGUZM1dfUt6I8lVRkSB5opCcoR6Ikf"}]},"_from":".","_npmVersion":"1.3.14","_npmUser":{"name":"jaxbot","email":"jaxbot@gmail.com"},"maintainers":[{"name":"jaxbot","email":"jaxbot@gmail.com"}]}},"readme":"# Glass Prism\n\nA Node.js framework and boilerplate for Google Glass Mirror applications.\n\n## Getting started\n\n```\nnpm install glass-prism\n```\n\nCreate an application in the [Google API Console](https://console.developers.google.com/). [Here's a tutorial about that.](http://okaysass.com/posts/14-03-16-tutorial-node-js-mirror-api-google-glass)\n\nExample application:\n\n```\nvar prism = require(\"glass-prism\");\n\nprism.init({\n\t\"client_id\": \"3489342843-383i3euefwjkf.apps.googleusercontent.com\",\n\t\"client_secret\": \"kjsdlDKLJSSDLSDJsdkjsdkl\",\n\t\"redirect_dir\": \"http://localhost:8099/oauth2callback\"\n}, function() {\n\tconsole.log('Ready to roll!');\n\tprism.all.insertCard({ text: \"Hello, world!\" });\n});\n\nprism.on('newclient', function(tokens) {\n\tprism.insertCard({ html: prism.cards.main(\"Hi!\") }, tokens);\n});\n\n```\n\n## Cards\n\nPrism automatically compiles together card templates for your use.\nSimply place HTML cards in cards/, and they will be converted into a doT template function\nstored in prism.cards. For example:\n\n```\n<article>\n\t<section>\n\t\t<div class=\"text-auto-size\">\n\t\t\t<p>{{=it.config.hostname}}</p>\n\t\t\t<p>\n\t\t\t\t<span class='{{=it.cpuColor}}'>{{=it.avg}}</span>\n\t\t\t</p>\n\t\t\t<p class='{{=it.memColor}}'>{{=it.memused}}/{{=it.memtotal}}mb</p>\n\t\t</div>\n\t</section>\n\t<footer><div>{{=it.uptime}}</div></footer>\n</article>\n```\n\n```\nvar args = {\n\tuptime: 0,\n\tavg: 0,\n\tmemtotal: 0,\n\tmemused: 0,\n\tcpuColor: 'green',\n\tmemColor: 'green',\n\tconfig: config\n};\nvar html = prism.cards.main(args);\nprism.insertCard({ html: html }, tokens);\n```\n\nThe [Mirror API playground](https://developers.google.com/glass/tools-downloads/playground) is a great place to create HTML for your cards.\n\nMore information [about doT templates](http://olado.github.io/doT/index.html).\n\n## Configuration options\n\nThese are passed to the init function as a JSON object.\n\n```\n{\n\t/* required, obtain from the Google API console */\n\t\"client_id\": \"\",\n\t\"client_secret\": \"\",\n\t// should be set to point to this application's port and machine\n\t\"redirect_dir\": \"\",\n\n\t/* optional tweaking */\n\t// http interface. this is used to authorize via OAuth with the Google APIs\n\t\"port\": 8099,\n\n\t// default not set, can be a manual array of client tokens\n\t// if used, make sure refresh tokens are included!\n\t\"clientTokens\": null,\n\n\t// file that stores client tokens of users\n\t\"tokenFileName\": \".clienttokens.json\",\n\t// disable scanning for card templates\n\t\"noCardTemplates\": null,\n\t// disable the HTTP interface. If this is set, client tokens will need to be provided\n\t\"noHttpInterface\": null,\n\t// whether or not we care about subscribers\n\t\"subscribe\": null,\n\t// if set, a contact interface for -post an update to- is created\n\t\"displayName\": null,\n\n\t// if subscriptions are used, this string is used to confirm that Google sent the\n\t// subscription\n\t\"verify_hash\": null,\n\t\n\t// this is the actual URL Google sends a POST request to. This *must* be publicly\n\t// accessible over HTTPS (with valid SSL working).\n\t// If you only care about sending stuff to the device, you can ignore this safely.\n\t\"subscription_callback\": null,\n\t\n\t// the phonetic name for the contact\n\t\"speakableName\": null,\n\n\t// an icon for the endpoint, shown in the Glass post menu\n\t\"contactIcon\": null,\n\n\t// if set, nothing will be output to the console\n\t\"noOutputErrors\": null\n}\n```\n\nThe following events are emitted from the framework:\n\n`newclient` : a new client has connected. Passes `tokens` as the argument, an object containing the connect user's OAuth tokens\n\n`subscription` : a subscription from the Google API has been received. Occurs when a card is replied to, deleted, pinned, etc.\n\n## Methods and properties\n\n```\nfunction init(configinput, callback)\n```\n\nUsed to initialize the Prism interface and discover the Google API endpoints. Executes callback(err) when completed.\n\n```\ninsertCard(options, tokens, [callback])\n```\n\nInsert a card to the device authed with `token`, where `token` can be obtained from a [callback] or\nthe `client_tokens` property. `options` is the JSON object to send to the Mirror API. callback is sent (err, data).\n\n```\nupdateCard(options, tokens, [callback])\n```\n\nUpdate a card by sourceItemId. The card is first requested; if it does not exist, a new one is inserted. This is useful when you want to send information that will always be updated to the device. If `options.isPinned` is not set, it defaults to true, meaning new cards will always be inserted unless one is pinned. `tokens` and `callback` are the same as above.\n\n```\ndeleteBundle(options, tokens, [callback])\n```\n\nDeletes a bundle by `options.bundleId`\n\n```\ndeleteCard(options, tokens, [callback])\n```\n\nDeletes a card by id\n\n```\npatchCard(options, tokens, [callback])\n```\n\nUpdates a card by id\n\n```\nmirrorCall(call, tokens, callback)\n```\n\nPlaces a call to the Mirror API, authenticated with `token`. `call` is a function returned from `mirror`, which contains discovered functions, i.e.\n\n```\nmirrorCall(mirror.timeline.list({ \"sourceItemId\": options.sourceItemId,\n\t\t\"isPinned\": options.isPinned || true }), tokens, callback);\n```\n\n```\nclient_tokens\n```\n\nAn array of the client OAuth tokens.\n\n```\nall\n```\n\nAny of the above methods can be called with exports.all, which runs the command on *all* client tokens, and accepts (options, callback) as the arguments. E.g.:\n\n```\nprism.all.updateCard({ html: html, isPinned: true, sourceItemId: \"gtop_\"+config.hostname });\n```\n\n\n## Examples\n\nI built Prism so I could abstract out a lot of the code for my Mirror API projects, and as such have a few examples to share. More are welcome ;)\n\n[gtop](https://github.com/jaxbot/gtop) - Server monitor\n[Glass-Mint](https://github.com/jaxbot/glass-mint) - Mint.com banking information on Glass\n\n## License\nMIT\n\n## Shameless plug\n\nI do stuff with Google Glass, Node.js, and Vim plugins. [Follow me](https://github.com/jaxbot) if that sounds like something you're into (or you just want to make my day!)\n\n","maintainers":[{"name":"jaxbot","email":"jaxbot@gmail.com"}],"time":{"modified":"2022-06-18T12:49:27.326Z","created":"2014-03-07T03:38:47.481Z","0.0.1":"2014-03-07T03:38:48.458Z","0.0.2":"2014-03-10T01:35:36.063Z","0.1.0":"2014-03-24T02:50:38.461Z","0.3.0":"2014-03-30T01:09:55.223Z"},"readmeFilename":"README.md","keywords":["glass","google","prism","google","glass","mirror","api"],"repository":{"type":"git","url":"https://github.com/jaxbot/glass-prism"},"author":{"name":"Jonathan Warner"},"license":"MIT","homepage":"https://github.com/jaxbot/glass-prism","bugs":{"url":"https://github.com/jaxbot/glass-prism/issues"},"users":{"darionovoa":true}}