Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make our output JS less terrible. #31

Merged
merged 3 commits into from Aug 9, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Binary file modified bin/braise
Binary file not shown.
19 changes: 11 additions & 8 deletions examples/output/adapters/v1/calendar-event.js
Expand Up @@ -2,16 +2,19 @@
import DS from 'ember-data';
import Ember from 'ember';

export default DS.RESTAdapter.extend({
const { RESTAdapter } = DS;
const { computed, String: EmberString } = Ember;

export default RESTAdapter.extend({
host: "https://production.icisapp.com",
namespace: "api/v1",
token: Ember.computed.alias('accessTokenWrapper.token'),
pathForType: function(type) {
var underscorized = Ember.String.underscore(type);
return Ember.String.pluralize(underscorized);
token: computed.alias('accessTokenWrapper.token'),
pathForType(type) {
const underscorized = EmberString.underscore(type);
return EmberString.pluralize(underscorized);
},

ajaxOptions: function(url, type, options) {
ajaxOptions(url, type, options) {
options = options || {};
if (type === "GET") {
options.data = options.data || {};
Expand All @@ -23,8 +26,8 @@ export default DS.RESTAdapter.extend({
return this._super(url, type, options);
},

cancel: function(modelName, id, snapshot) {
var url = this.buildURL(modelName, id) + '/cancel';
cancel(modelName, id, snapshot) {
const url = this.buildURL(modelName, id) + '/cancel';
return this.ajax(url, 'PUT', { data: snapshot });
}

Expand Down
13 changes: 8 additions & 5 deletions examples/output/adapters/v1/event.js
Expand Up @@ -2,12 +2,15 @@
import DS from 'ember-data';
import Ember from 'ember';

export default DS.RESTAdapter.extend({
const { RESTAdapter } = DS;
const { computed, String: EmberString } = Ember;

export default RESTAdapter.extend({
host: "https://production.icisapp.com",
namespace: "api/v1",
token: Ember.computed.alias('accessTokenWrapper.token'),
token: computed.alias('accessTokenWrapper.token'),

ajaxOptions: function(url, type, options) {
ajaxOptions(url, type, options) {
options = options || {};
if (type === "GET") {
options.data = options.data || {};
Expand All @@ -19,8 +22,8 @@ export default DS.RESTAdapter.extend({
return this._super(url, type, options);
},

cancel: function(modelName, id, snapshot) {
var url = this.buildURL(modelName, id) + '/cancel';
cancel(modelName, id, snapshot) {
const url = this.buildURL(modelName, id) + '/cancel';
return this.ajax(url, 'PUT', { data: snapshot });
}

Expand Down
15 changes: 9 additions & 6 deletions examples/output/adapters/v20150918/emergency-contact.js
Expand Up @@ -2,16 +2,19 @@
import DS from 'ember-data';
import Ember from 'ember';

export default DS.RESTAdapter.extend({
const { RESTAdapter } = DS;
const { computed, String: EmberString } = Ember;

export default RESTAdapter.extend({
host: "https://api.icisapp.com",
namespace: "v20150918",
token: Ember.computed.alias('accessTokenWrapper.token'),
pathForType: function(type) {
var underscorized = Ember.String.underscore(type);
return Ember.String.pluralize(underscorized);
token: computed.alias('accessTokenWrapper.token'),
pathForType(type) {
const underscorized = EmberString.underscore(type);
return EmberString.pluralize(underscorized);
},

ajaxOptions: function(url, type, options) {
ajaxOptions(url, type, options) {
options = options || {};
if (type === "GET") {
options.data = options.data || {};
Expand Down
9 changes: 6 additions & 3 deletions examples/output/adapters/v20150918/location.js
Expand Up @@ -2,12 +2,15 @@
import DS from 'ember-data';
import Ember from 'ember';

export default DS.RESTAdapter.extend({
const { RESTAdapter } = DS;
const { computed, String: EmberString } = Ember;

export default RESTAdapter.extend({
host: "https://api.icisapp.com",
namespace: "v20150918",
token: Ember.computed.alias('accessTokenWrapper.token'),
token: computed.alias('accessTokenWrapper.token'),

ajaxOptions: function(url, type, options) {
ajaxOptions(url, type, options) {
options = options || {};
if (type === "GET") {
options.data = options.data || {};
Expand Down
9 changes: 6 additions & 3 deletions examples/output/adapters/v20150918/patient.js
Expand Up @@ -2,12 +2,15 @@
import DS from 'ember-data';
import Ember from 'ember';

export default DS.RESTAdapter.extend({
const { RESTAdapter } = DS;
const { computed, String: EmberString } = Ember;

export default RESTAdapter.extend({
host: "https://api.icisapp.com",
namespace: "v20150918",
token: Ember.computed.alias('accessTokenWrapper.token'),
token: computed.alias('accessTokenWrapper.token'),

ajaxOptions: function(url, type, options) {
ajaxOptions(url, type, options) {
options = options || {};
if (type === "GET") {
options.data = options.data || {};
Expand Down
9 changes: 6 additions & 3 deletions examples/output/adapters/v20150918/practice.js
Expand Up @@ -2,12 +2,15 @@
import DS from 'ember-data';
import Ember from 'ember';

export default DS.RESTAdapter.extend({
const { RESTAdapter } = DS;
const { computed, String: EmberString } = Ember;

export default RESTAdapter.extend({
host: "https://api.icisapp.com",
namespace: "v20150918",
token: Ember.computed.alias('accessTokenWrapper.token'),
token: computed.alias('accessTokenWrapper.token'),

ajaxOptions: function(url, type, options) {
ajaxOptions(url, type, options) {
options = options || {};
if (type === "GET") {
options.data = options.data || {};
Expand Down
15 changes: 9 additions & 6 deletions examples/output/adapters/v20150918/staff-member.js
Expand Up @@ -2,16 +2,19 @@
import DS from 'ember-data';
import Ember from 'ember';

export default DS.RESTAdapter.extend({
const { RESTAdapter } = DS;
const { computed, String: EmberString } = Ember;

export default RESTAdapter.extend({
host: "https://api.icisapp.com",
namespace: "v20150918",
token: Ember.computed.alias('accessTokenWrapper.token'),
pathForType: function(type) {
var underscorized = Ember.String.underscore(type);
return Ember.String.pluralize(underscorized);
token: computed.alias('accessTokenWrapper.token'),
pathForType(type) {
const underscorized = EmberString.underscore(type);
return EmberString.pluralize(underscorized);
},

ajaxOptions: function(url, type, options) {
ajaxOptions(url, type, options) {
options = options || {};
if (type === "GET") {
options.data = options.data || {};
Expand Down
15 changes: 9 additions & 6 deletions examples/output/adapters/v20150918/state-of-health.js
Expand Up @@ -2,16 +2,19 @@
import DS from 'ember-data';
import Ember from 'ember';

export default DS.RESTAdapter.extend({
const { RESTAdapter } = DS;
const { computed, String: EmberString } = Ember;

export default RESTAdapter.extend({
host: "https://api.icisapp.com",
namespace: "v20150918",
token: Ember.computed.alias('accessTokenWrapper.token'),
pathForType: function(type) {
var underscorized = Ember.String.underscore(type);
return Ember.String.pluralize(underscorized);
token: computed.alias('accessTokenWrapper.token'),
pathForType(type) {
const underscorized = EmberString.underscore(type);
return EmberString.pluralize(underscorized);
},

ajaxOptions: function(url, type, options) {
ajaxOptions(url, type, options) {
options = options || {};
if (type === "GET") {
options.data = options.data || {};
Expand Down
15 changes: 9 additions & 6 deletions examples/output/adapters/v3/medication-verification.js
Expand Up @@ -2,16 +2,19 @@
import DS from 'ember-data';
import Ember from 'ember';

export default DS.RESTAdapter.extend({
const { RESTAdapter } = DS;
const { computed, String: EmberString } = Ember;

export default RESTAdapter.extend({
host: "https://production.icisapp.com",
namespace: "api/v3",
token: Ember.computed.alias('accessTokenWrapper.token'),
pathForType: function(type) {
var underscorized = Ember.String.underscore(type);
return Ember.String.pluralize(underscorized);
token: computed.alias('accessTokenWrapper.token'),
pathForType(type) {
const underscorized = EmberString.underscore(type);
return EmberString.pluralize(underscorized);
},

ajaxOptions: function(url, type, options) {
ajaxOptions(url, type, options) {
options = options || {};
if (type === "GET") {
options.data = options.data || {};
Expand Down
13 changes: 8 additions & 5 deletions examples/output/adapters/v3/patient.js
Expand Up @@ -2,12 +2,15 @@
import DS from 'ember-data';
import Ember from 'ember';

export default DS.RESTAdapter.extend({
const { RESTAdapter } = DS;
const { computed, String: EmberString } = Ember;

export default RESTAdapter.extend({
host: "https://production.icisapp.com",
namespace: "api/patients/v3",
token: Ember.computed.alias('accessTokenWrapper.token'),
token: computed.alias('accessTokenWrapper.token'),

ajaxOptions: function(url, type, options) {
ajaxOptions(url, type, options) {
options = options || {};
if (type === "GET") {
options.data = options.data || {};
Expand All @@ -19,8 +22,8 @@ export default DS.RESTAdapter.extend({
return this._super(url, type, options);
},

autocomplete: function(modelName, id, snapshot) {
var url = this.buildURL(modelName, id) + '/autocomplete';
autocomplete(modelName, id, snapshot) {
const url = this.buildURL(modelName, id) + '/autocomplete';
return this.ajax(url, 'GET', { data: snapshot });
}

Expand Down
44 changes: 23 additions & 21 deletions examples/output/model/v1/calendar-event.js
@@ -1,33 +1,35 @@
// DO NOT EDIT - this file was autogenerated by Braise
import DS from 'ember-data';

export default DS.Model.extend({
attendees: DS.attr(),
categories: DS.attr(),
description: DS.attr("string"),
end_time: DS.attr("date"),
event_type: DS.attr("string"),
location: DS.attr(),
start_time: DS.attr("date"),
status: DS.attr("string"),
title: DS.attr("string"),
uid: DS.attr("string"),
const { Model, attr } = DS;

show: function() {
export default Model.extend({
attendees: attr(),
categories: attr(),
description: attr("string"),
end_time: attr("date"),
event_type: attr("string"),
location: attr(),
start_time: attr("date"),
status: attr("string"),
title: attr("string"),
uid: attr("string"),

show() {
throw new Error("'show' is not supported by the api");
},
delete: function() {
delete() {
throw new Error("'delete' is not supported by the api");
},

cancel: function() {
var _this = this;
var modelName = this.constructor.modelName;
var adapter = this.store.adapterFor(modelName);
return adapter.cancel(modelName, this.get('id'), arguments).then(function(response) {
var serializer = _this.store.serializerFor(modelName);
var payloadKey = serializer.payloadKeyFromModelName(modelName);
var payload = response[payloadKey];
cancel() {
let _this = this;
const modelName = this.constructor.modelName;
const adapter = this.store.adapterFor(modelName);
return adapter.cancel(modelName, this.get('id'), arguments).then((response) => {
const serializer = _this.store.serializerFor(modelName);
const payloadKey = serializer.payloadKeyFromModelName(modelName);
const payload = response[payloadKey];
_this.setProperties(payload);
});
},
Expand Down
44 changes: 23 additions & 21 deletions examples/output/model/v1/event.js
@@ -1,33 +1,35 @@
// DO NOT EDIT - this file was autogenerated by Braise
import DS from 'ember-data';

export default DS.Model.extend({
attendees: DS.attr(),
categories: DS.attr(),
description: DS.attr("string"),
end_time: DS.attr("date"),
event_type: DS.attr("string"),
location: DS.attr(),
start_time: DS.attr("date"),
status: DS.attr("string"),
title: DS.attr("string"),
uid: DS.attr("string"),
const { Model, attr } = DS;

show: function() {
export default Model.extend({
attendees: attr(),
categories: attr(),
description: attr("string"),
end_time: attr("date"),
event_type: attr("string"),
location: attr(),
start_time: attr("date"),
status: attr("string"),
title: attr("string"),
uid: attr("string"),

show() {
throw new Error("'show' is not supported by the api");
},
delete: function() {
delete() {
throw new Error("'delete' is not supported by the api");
},

cancel: function() {
var _this = this;
var modelName = this.constructor.modelName;
var adapter = this.store.adapterFor(modelName);
return adapter.cancel(modelName, this.get('id'), arguments).then(function(response) {
var serializer = _this.store.serializerFor(modelName);
var payloadKey = serializer.payloadKeyFromModelName(modelName);
var payload = response[payloadKey];
cancel() {
let _this = this;
const modelName = this.constructor.modelName;
const adapter = this.store.adapterFor(modelName);
return adapter.cancel(modelName, this.get('id'), arguments).then((response) => {
const serializer = _this.store.serializerFor(modelName);
const payloadKey = serializer.payloadKeyFromModelName(modelName);
const payload = response[payloadKey];
_this.setProperties(payload);
});
},
Expand Down