/*! elastic.js - v1.1.1 - 2013-05-24
 * https://github.com/fullscale/elastic.js
 * Copyright (c) 2013 FullScale Labs, LLC; Licensed MIT */

"use strict";angular.module("elasticjs.service",[]).factory("ejsResource",["$http",function(a){return function(b){var c=window.ejs||{},d=function(a,b,c){return a.then(function(a){return(b||angular.noop)(a.data),a.data},function(a){return(c||angular.noop)(a.data),a.data})};return b!==Object(b)&&(b={server:b}),null==b.server&&(b.server=""),c.client={server:function(a){return null==a?b.server:(b.server=a,this)},post:function(c,e,f,g){c=b.server+c;var h={url:c,data:e,method:"POST"};return d(a(angular.extend(h,b)),f,g)},get:function(c,e,f,g){c=b.server+c;var h={url:c,params:e,method:"GET"};return d(a(angular.extend(h,b)),f,g)},put:function(c,e,f,g){c=b.server+c;var h={url:c,data:e,method:"PUT"};return d(a(angular.extend(h,b)),f,g)},del:function(c,e,f,g){c=b.server+c;var h={url:c,data:e,method:"DELETE"};return d(a(angular.extend(h,b)),f,g)},head:function(c,d,e,f){c=b.server+c;var g={url:c,params:d,method:"HEAD"};return a(angular.extend(g,b)).then(function(a){return(e||angular.noop)(a.headers()),a.headers()},function(){return(f||angular.noop)(void 0),void 0})}},c}}]);