An adapter and serializer for interacting with Socrata open data services.
JavaScript HTML
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
addon
app
config Updated to ember-cli 2.13.0 May 17, 2017
tests
vendor
.bowerrc
.editorconfig
.ember-cli
.eslintrc.js
.gitignore
.jshintrc
.npmignore
.travis.yml
.watchmanconfig
LICENSE.md
README.md
ember-cli-build.js
index.js
package.json
testem.js

README.md

Ember-Socrata

Greenkeeper badge

NPM Version Ember Badge Build Status Dependency Status Ember Observer Score


An adapter and serializer for interacting with Socrata open data services.

Currently, Ember-Socrata only handles Socrata's Consumer API, ie. retrieving data.

Installation

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-js

Configuration

In your project's config/environment.js:

module.exports = function(environment) {
  var ENV = {
    socrata: { dataRepo: 'some.data-repository.com' },
    // ...
  };
  // ...
};

Usage

For each Socrata dataset you want to retrieve you must create a model and an adapter:

ember generate model something
ember generate adapter something

Models

In the model you should define attributes as normal, using camelCasedAttributes where the dataset uses underscored_attributes.

Example:

Socrata object

{
    something_id: 123,
    some_attribute: 'some value',
    related_object_id: 456,
}

Ember model

// 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'),
});

Adapters

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',
});