Refactor BaseResource.extendAs to properly setup root

BaseResource.extendAs takes a constructor function.
No resource classes define instantiate, they use the above.
This ensures resource.root is always correct.
Merge pull request #34 from mattdenner/fix_base_resource_reference_to_root

Refactor BaseResource.extendAs to properly setup root