0.1.2 • Published 12 years ago

oexchange v0.1.2

Weekly downloads
14
License
-
Repository
github
Last release
12 years ago

==============

node_oexchange

A module for handling OExchange host discovery (see http://www.oexchange.org/).

Installation

::

npm install oexchange

Usage

First you have to require the oexchange package

::

var oexchange = require('oexchange');

node_oexchange exposes two methods:

"getSharingUrl" which can be used to get a valid sharing URL based on a given hostname and sharing object. The sharing object can contain all fiels that are specified in the OExchange specification (see http://www.oexchange.org/spec/#offer-parameters)

::

var sharingObject = { 'url': 'http://www.example.com/foo', 'title': 'Example site' };
oexchange.getSharingUrl('www.researchgate.net', sharingObject, function(result) { console.log(result); // either the sharing url or "false" });

and "getSharingObject" wich not only returns the sharing URL but also all other information that is specified in the OExchange XRD (see http://www.oexchange.org/spec/#discovery-targetxrd), so that you can build a linked sharing button for example

::

var sharingObject = { 'url': 'http://www.example.com/foo', 'title': 'Example site' };
oexchange.getSharingObject('www.researchgate.net', sharingObject, function(result) { console.log(result); // either the sharing object url or "false" // to render a the result sharing object you should use a templating language, e.g. Mustache.js (see https://github.com/janl/mustache.js/) var template = ''; var html = Mustache.to_html(template, sharingObject); });

0.1.2

12 years ago

0.1.1

13 years ago

0.1.0

13 years ago