Sha256: bc61ef73d09bc9b22a98f15e1509a1fcc8e6406e09cb174efa202cd613ba83a6

Contents?: true

Size: 1.09 KB

Versions: 1

Compression:

Stored size: 1.09 KB

Contents

# Mocrata

Mocrata is a [SODA](http://dev.socrata.com/) (Socrata Open Data API) client
developed by [Mode Analytics](https://modeanalytics.com).

## Installation

Add this line to your application's Gemfile:

    gem 'mocrata'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install mocrata

## Usage

### Setup

```
Mocrata.configure do |config|
  config.app_token = 'yourtoken' # optional Socrata application token
end
```

### Accessing data

```
dataset = Mocrata::Dataset.new('http://soda.demo.socrata.com/resource/6xzm-fzcu')

dataset.csv
=> [["Sally", 10], ["Earl", 2]]

dataset.json
=> [{"name"=>"Sally", "age"=>10}, {"name"=>"Earl", "age"=>2}]

dataset.fields
=> {"name"=>"text", "age"=>"number"}
```

### Iterating through rows

```
dataset.each_row(:csv) do |row|
  # do something with the row
end

dataset.each_row(:json) { |row| ... }
```

## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mocrata-0.0.1 README.md