An adapter and serializer for interacting with Socrata open data services.
Currently, Ember-Socrata only handles Socrata's Consumer API, ie. retrieving data.
Ember-Socrata relies on Soda-JS to communicate with Socrata data repositories, as well as Ember-Browserify to make Soda-JS available to the Ember application.
ember install ember-socrata
ember install ember-browserify
npm install soda-jsIn your project's config/environment.js:
module.exports = function(environment) {
var ENV = {
socrata: { dataRepo: 'some.data-repository.com' },
// ...
};
// ...
};For each Socrata dataset you want to retrieve you must create a model and an adapter:
ember generate model something
ember generate adapter somethingIn the model you should define attributes as normal, using camelCasedAttributes where the dataset uses underscored_attributes.
Example:
{
something_id: 123,
some_attribute: 'some value',
related_object_id: 456,
}// app/models/something.js
import Model from 'ember-data/model';
import attr from 'ember-data/attr';
import { belongsTo } from 'ember-data/relationships';
export default Model.extend({
someAttribute: attr(),
relatedObject: belongsTo('related-object'),
});You must add a dataset property with the value of the Socrata dataset to the
model's adapter:
// app/adapters/something.js
import ApplicationAdapter from './application';
export default ApplicationAdapter.extend({
dataset: 'ab12-34xy',
});