gaye/dav — pull request #46 by gaye (2014-06-25 21:22:49+00:00)
Title: Experiment with request factory pattern

Hey @evert! This is a wip/experiment to see what things would look like if I took one of the routes that you suggested related to having things like `Propfind` be request factories which you can configure and then ask for `Request` objects. Let me know what you think. This would enable

```js
var xhr = new dav.transport.Basic(
new dav.Credentials({
username: 'xxx',
password: 'xxx'
})
);

var client = new dav.Client(xhr);

// Create PROPFIND
var propfind = new dav.Propfind({
depth: 'Infinity',
url: 'http://dav.example.com'
});
propfind.props.push(
new dav.Prop({ namespace: ns.CALDAV, name: 'getctag' })
);

// Send request
var request = propfind.createRequest();
var promise = client.send(request);

// Or perhaps
var promise = client.send(propfind); // calls createRequest() on propfind internally

promise.then(function(response) {
console.log(response.props.getctag);
});
```