11/**
22 @name : aping-plugin-github
3- @version : 0.7.8 (03-02 -2016)
3+ @version : 0.7.9 (01-06 -2016)
44 @author : Jonathan Hornung
55 @url : https://github.com/JohnnyTheTank/apiNG-plugin-github
66 @license : MIT
@@ -31,9 +31,7 @@ angular.module("jtt_aping_github", ['jtt_github'])
3131 }
3232
3333 //create requestObject for api request call
34- var requestObject = {
35- access_token : apingUtilityHelper . getApiCredentials ( apingGithubHelper . getThisPlatformString ( ) , "access_token" ) ,
36- } ;
34+ var requestObject = { } ;
3735
3836 if ( angular . isDefined ( request . items ) ) {
3937 requestObject . per_page = request . items ;
@@ -128,7 +126,6 @@ angular.module("jtt_aping_github")
128126 var _this = this ;
129127
130128 if ( _data . data . constructor === Array ) {
131-
132129 angular . forEach ( _data . data , function ( value , key ) {
133130 var tempResult ;
134131 if ( _helperObject . getNativeData === true || _helperObject . getNativeData === "true" ) {
@@ -141,7 +138,6 @@ angular.module("jtt_aping_github")
141138 }
142139 } ) ;
143140 } else {
144-
145141 if ( _data . data . items ) {
146142 angular . forEach ( _data . data . items , function ( value , key ) {
147143 var tempResult ;
@@ -159,7 +155,7 @@ angular.module("jtt_aping_github")
159155 if ( _helperObject . getNativeData === true || _helperObject . getNativeData === "true" ) {
160156 tempResult = _data . data ;
161157 } else {
162- tempResult = _this . getItemByJsonData ( _data , _helperObject . model ) ;
158+ tempResult = _this . getItemByJsonData ( _data . data , _helperObject . model ) ;
163159 }
164160 if ( tempResult ) {
165161 requestResults . push ( tempResult ) ;
@@ -291,7 +287,7 @@ angular.module("jtt_github", [])
291287 this . fillDataInObjectByList = function ( _object , _params , _list ) {
292288
293289 angular . forEach ( _list , function ( value , key ) {
294- if ( typeof _params [ value ] !== "undefined" ) {
290+ if ( angular . isDefined ( _params [ value ] ) ) {
295291 _object . object [ value ] = _params [ value ] ;
296292 }
297293 } ) ;
@@ -301,16 +297,18 @@ angular.module("jtt_github", [])
301297
302298 this . getNew = function ( _type , _params ) {
303299 var githubSearchData = {
304- object : {
305- access_token : _params . access_token ,
306- } ,
300+ object : { } ,
307301 url : "" ,
308302 } ;
309303
310- if ( typeof _params . per_page !== "undefined" ) {
304+ if ( angular . isDefined ( _params . per_page ) ) {
311305 githubSearchData . object . per_page = _params . per_page ;
312306 }
313307
308+ if ( angular . isDefined ( _params . access_token ) ) {
309+ githubSearchData . object . access_token = _params . access_token ;
310+ }
311+
314312 switch ( _type ) {
315313 case "user" :
316314 githubSearchData . object . per_page = undefined ;
@@ -356,7 +354,6 @@ angular.module("jtt_github", [])
356354 githubSearchData . url = this . getApiBaseUrl ( ) + "repos/" + _params . user + "/" + _params . repo + "/events" ;
357355 break ;
358356 }
359-
360357 return githubSearchData ;
361358 } ;
362359 } ) ;
0 commit comments