ember-data-github
Advanced tools
Comparing version 0.0.0 to 0.0.1
import GithubAdapter from './github'; | ||
export default GithubAdapter.extend({ | ||
buildURL: function(type, id, snapshot) { | ||
var builtURL = this._super(type, id, snapshot); | ||
if(id) { | ||
builtURL = builtURL.replace('repositories', 'repos'); | ||
builtURL = builtURL.replace('%2F', '/'); | ||
} | ||
return builtURL; | ||
} | ||
}); |
@@ -6,4 +6,4 @@ import GithubAdapter from './github'; | ||
var builtURL = this._super(type, id, snapshot); | ||
if(id==='') { | ||
builtURL = builtURL.replace('users', 'user'); | ||
if(id==='#') { | ||
builtURL = builtURL.replace('users/%23', 'user'); | ||
} | ||
@@ -10,0 +10,0 @@ return builtURL; |
@@ -7,10 +7,12 @@ import DS from 'ember-data'; | ||
host: 'https://api.github.com', | ||
headers: Ember.computed('session.githubToken', function() { | ||
return { | ||
Authorization: `token ${this.get('session.githubToken')}`, | ||
}; | ||
headers: Ember.computed('session.githubAccessToken', function() { | ||
var headers = {}; | ||
if(this.get('session.githubAccessToken')) { | ||
headers.Authorization = `token ${this.get('session.githubAccessToken')}`; | ||
} | ||
return headers; | ||
}), | ||
pathForType: function(type) { | ||
return Ember.String.camelize(type.replace('github','')); | ||
return Ember.String.camelize(Ember.String.pluralize(type.replace('github',''))); | ||
} | ||
}); |
import DS from 'ember-data'; | ||
export default DS.Model.extend({ | ||
fullName: DS.attr('string'), | ||
name: DS.attr('string') | ||
}); |
import DS from 'ember-data'; | ||
export default DS.Model.extend({ | ||
login: DS.attr('string'), | ||
name: DS.attr('string'), | ||
@@ -5,0 +6,0 @@ avatarUrl: DS.attr('string'), |
@@ -7,2 +7,3 @@ import GithubSerializer from './github'; | ||
id: hash.full_name, | ||
fullName: hash.full_name, | ||
name: hash.name | ||
@@ -9,0 +10,0 @@ }; |
@@ -5,3 +5,4 @@ import GithubSerializer from './github'; | ||
extractSingle: function(store, primaryType, payload, recordId) { | ||
if(recordId==='') { | ||
if(recordId==='#') { | ||
payload.isCurrent = true; | ||
payload.repos_url = payload.repos_url.replace(`users/${payload.login}`, 'user'); | ||
@@ -13,3 +14,4 @@ } | ||
hash = { | ||
id: hash.login, | ||
id: hash.isCurrent ? '#' : hash.login, | ||
login: hash.login, | ||
name: hash.name, | ||
@@ -16,0 +18,0 @@ avatarUrl: hash.avatar_url, |
{ | ||
"name": "ember-data-github", | ||
"version": "0.0.0", | ||
"version": "0.0.1", | ||
"description": "Ember Data library for the GitHub API", | ||
@@ -26,11 +26,11 @@ "directories": { | ||
"ember-cli-dependency-checker": "0.0.8", | ||
"ember-cli-htmlbars": "0.7.4", | ||
"ember-cli-ic-ajax": "0.1.1", | ||
"ember-cli-htmlbars": "0.7.6", | ||
"ember-cli-ic-ajax": "0.1.2", | ||
"ember-cli-inject-live-reload": "^1.3.0", | ||
"ember-cli-qunit": "0.3.10", | ||
"ember-cli-qunit": "0.3.11", | ||
"ember-cli-uglify": "1.0.1", | ||
"ember-data": "1.0.0-beta.16.1", | ||
"ember-disable-prototype-extensions": "^1.0.0", | ||
"ember-export-application-global": "^1.0.2", | ||
"ember-disable-prototype-extensions": "^1.0.0", | ||
"ember-try": "0.0.4" | ||
"ember-try": "0.0.5" | ||
}, | ||
@@ -37,0 +37,0 @@ "keywords": [ |
@@ -1,2 +0,2 @@ | ||
# ember-data-github [![Build Status](https://travis-ci.org/jimmay5469/ember-data-github.svg)](https://travis-ci.org/jimmay5469/ember-data-github) | ||
# ember-data-github [![Build Status](https://travis-ci.org/jimmay5469/ember-data-github.svg?branch=master)](https://travis-ci.org/jimmay5469/ember-data-github) [![Ember Observer Score](http://emberobserver.com/badges/ember-data-github.svg)](http://emberobserver.com/addons/ember-data-github) | ||
@@ -11,5 +11,10 @@ Ember Data library for the [GitHub API](https://developer.github.com/v3/). | ||
To use OAuth endpoints you must also make sure you have a session service which contains a property named `githubToken`. | ||
In order to use OAuth endpoints you must also make sure you have a session service which contains a property named `githubAccessToken` with the currently logged in user's GitHub access token (Exmple: [app/services/session.js](https://github.com/jimmay5469/old-hash/blob/master/app/services/session.js)). | ||
To see what is currently supported check out the `addon/models/` directory. Currently this addon does not support write actions. | ||
Examples: | ||
``` | ||
this.get('store').find('githubUser', '#'); // get the current user | ||
this.get('store').find('githubUser', 'jimmay5469'); // get a user | ||
this.get('store').find('githubRepository', 'jimmay5469/old-hash'); // get a repository | ||
``` | ||
@@ -16,0 +21,0 @@ ## Installation |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8410304
40
67329
41
2
1