How to use the active-model-adapter.extend function in active-model-adapter

To help you get started, we’ve selected a few active-model-adapter examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github travis-ci / travis-web / app / adapters / application.js View on Github external
import config from 'travis/config/environment';
import Ember from 'ember';
import ActiveModelAdapter from 'active-model-adapter';

const { service } = Ember.inject;

export default ActiveModelAdapter.extend({
  auth: service(),
  features: service(),
  host: config.apiEndpoint,
  coalesceFindRequests: true,

  // Before Ember Data 2.0 the default behaviour of running `findAll` was to get
  // new records only when there're no records in the store. This will change
  // to a different strategy in 2.0: when you run `findAll` it will not get any
  // new data initially, but it will try loading new data in the background.
  //
  // I'm disabling the new behaviour for now.
  shouldBackgroundReloadRecord() {
    return false;
  },

  ajaxOptions() {
github miragejs / ember-cli-mirage / tests / dummy / app / adapters / application.js View on Github external
import ActiveModelAdapter from 'active-model-adapter';

export default ActiveModelAdapter.extend({
  namespace: 'api'
});
github cowboyd / mirage-server / tests / dummy / app / adapters / application.js View on Github external
import ActiveModelAdapter from 'active-model-adapter';

export default ActiveModelAdapter.extend({
  namespace: 'api'
});
github ember-admin / ember-cli-admin / tests / dummy / app / adapters / application.js View on Github external
import ActiveModelAdapter from 'active-model-adapter';

export default ActiveModelAdapter.extend({
  namespace: 'api'
});
github PrecisionNutrition / ember-data-polymorphic-full-stack-example / ember / app / adapters / application.js View on Github external
import ActiveModelAdapter from 'active-model-adapter';

export default ActiveModelAdapter.extend({
  host: 'http://localhost:3009'
});
github abuiles / borrowers / app / adapters / application.js View on Github external
import ActiveModelAdapter from 'active-model-adapter';

export default ActiveModelAdapter.extend({
  namespace: 'api/v4',
  coalesceFindRequests: true
});
github coala / git-task-list / app / adapters / application.js View on Github external
import ActiveModelAdapter from 'active-model-adapter';

export default ActiveModelAdapter.extend({
  host: 'https://api.github.com',
  queryUrl: 'https://api.github.com/search',
  buildURL(modelName, id, snapshot, requestType) {
    if(requestType === 'query') {
      this.host = this.queryUrl
    }
    return this._super(...arguments);
  }
});
github exercism / gui / app / application / adapter.js View on Github external
import Ember from 'ember';
import ActiveModelAdapter from 'active-model-adapter';

const urlJoin = requireNode('url-join'),
      lodash = requireNode('lodash'),
      url = requireNode('url');

export default ActiveModelAdapter.extend({
  configuration: Ember.inject.service(),

  host: Ember.computed(function() {
    return this.get('configuration.xapi');
  }),

  addKeyParam(fullUrl) {
    let params = url.parse(fullUrl, true).query,
        apiKey = this.get('configuration.apiKey'),
        suffix = '';
    if (lodash.isEmpty(params)) {
      suffix = `?key=${apiKey}`;
    } else if (!params.key) {
      suffix = `&key=${apiKey}`;
    }
    return `${fullUrl}${suffix}`;
github MishaHerscu / togetherness-ember-client / app / application / adapter.js View on Github external
import Ember from 'ember';
import ActiveModelAdapter from 'active-model-adapter';
import ENV from '../config/environment';

export default ActiveModelAdapter.extend({
  host: ENV.apiHost,
  auth: Ember.inject.service(),

  headers: Ember.computed('auth.credentials.token', {
    get () {
      let headers = {};
      const token = this.get('auth.credentials.token');
      if (token) {
        headers.Authorization = `Token token=${token}`;
      }

      return headers;
    },
  }),
});

active-model-adapter

Adapters and Serializers for Rails's ActiveModel::Serializers

MIT
Latest version published 2 years ago

Package Health Score

56 / 100
Full package analysis