blob: ceff93aceab247cd10b4d69a796b3e1777cdee73 [file] [log] [blame]
Simon Hunte6720442015-01-15 12:21:06 -08001/*
2 * Copyright 2015 Open Networking Laboratory
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17/*
18 ONOS GUI -- Remote Communications Module -- REST Service
19
20 @author Bri Prebilic Cole
21 @author Simon Hunt
22 */
23(function () {
24 'use strict';
25
26 var $log;
27
28 angular.module('onosRemote')
29 .factory('RestService', ['$log', '$http', function (_$log_, $http) {
30 $log = _$log_;
31
32 function get(url, callback) {
33 $http.get(url).then(function (response) {
34 // success
35 callback(response.data);
36 }, function (response) {
37 // error
38 $log.warn('Failed to retrieve JSON data: ' + url,
39 response.status, response.data);
40 });
41 }
42
43 return {
44 get: get
45 };
46 }]);
47
48}());