-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Martin Fenner
committed
Mar 12, 2019
1 parent
914dfaa
commit d1fdf10
Showing
6 changed files
with
119 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import DS from 'ember-data'; | ||
import DataAdapterMixin from 'ember-simple-auth/mixins/data-adapter-mixin'; | ||
import ENV from 'bracco/config/environment'; | ||
|
||
const { JSONAPIAdapter } = DS; | ||
|
||
export default JSONAPIAdapter.extend(DataAdapterMixin, { | ||
host: ENV.ORCID_API_URL, | ||
|
||
init() { | ||
this._super(...arguments); | ||
|
||
this.set('headers', { | ||
'Content-Type': 'application/json', | ||
'Accept': 'application/json' | ||
}); | ||
}, | ||
|
||
pathForType() { | ||
return 'v2.1'; | ||
}, | ||
|
||
authorize() { | ||
|
||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import DS from 'ember-data'; | ||
|
||
export default DS.Model.extend({ | ||
meta: DS.attr(), | ||
|
||
identifier: DS.attr('string'), | ||
creditName: DS.attr('string'), | ||
givenNames: DS.attr('string', { defaultValue: null }), | ||
familyName: DS.attr('string', { defaultValue: null }) | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { underscore } from '@ember/string'; | ||
// import { assign } from '@ember/polyfills'; | ||
import DS from 'ember-data'; | ||
|
||
export default DS.JSONSerializer.extend({ | ||
normalizeSingleResponse(store, primaryModelClass, payload, id, requestType) { | ||
// strip "https://" from id | ||
console.log(payload) | ||
payload.id = payload.id.substr(8); | ||
return this._super(store, primaryModelClass, payload, id, requestType); | ||
}, | ||
// normalizeFindRecordResponse(store, primaryModelClass, payload) { | ||
// payload.data.attributes.meta = payload.meta || {}; | ||
|
||
// return this._super(store, primaryModelClass, payload); | ||
// }, | ||
keyForAttribute(attr) { | ||
return underscore(attr); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters