README.md in mocrata-0.0.1 vs README.md in mocrata-0.1.0

- old
+ new

@@ -1,7 +1,11 @@ # Mocrata +[![Build Status](https://travis-ci.org/mode/mocrata.svg?branch=master)](https://travis-ci.org/mode/mocrata) +[![Code Climate](https://codeclimate.com/repos/53d16a75695680764e01ea68/badges/c93756788e4438e90512/gpa.png)](https://codeclimate.com/repos/53d16a75695680764e01ea68/feed) +[![Gem Version](https://badge.fury.io/rb/mocrata.svg)](http://badge.fury.io/rb/mocrata) + Mocrata is a [SODA](http://dev.socrata.com/) (Socrata Open Data API) client developed by [Mode Analytics](https://modeanalytics.com). ## Installation @@ -28,20 +32,33 @@ ``` ### Accessing data ``` -dataset = Mocrata::Dataset.new('http://soda.demo.socrata.com/resource/6xzm-fzcu') +dataset = Mocrata::Dataset.new("http://opendata.socrata.com/resource/mnkm-8ram") +dataset.name +=> "Country List ISO 3166 Codes Latitude Longitude" + +dataset.csv_header +=> ["Country", "Alpha code", "Numeric code", "Latitude", "Longitude"] + dataset.csv -=> [["Sally", 10], ["Earl", 2]] +=> [["Albania", "AL", "8", "41", "20"], + ["Algeria", "DZ", "12", "28", "3"], ...] dataset.json -=> [{"name"=>"Sally", "age"=>10}, {"name"=>"Earl", "age"=>2}] +=> [{"longitude_average"=>"20", + "latitude_average"=>"41", + "alpha_2_code"=>"AL", + "numeric_code"=>"8", + "country"=>"Albania"}, ...] dataset.fields -=> {"name"=>"text", "age"=>"number"} +=> {":created_at"=>"meta_data", ":id"=>"meta_data", ":updated_at"=>"meta_data", +"alpha_2_code"=>"text", "country"=>"text", "latitude_average"=>"number", +"longitude_average"=>"number", "numeric_code"=>"number"} ``` ### Iterating through rows ``` @@ -49,9 +66,13 @@ # do something with the row end dataset.each_row(:json) { |row| ... } ``` + +## Documentation + +http://rubydoc.info/github/mode/mocrata/master/frames ## Contributing 1. Fork it 2. Create your feature branch (`git checkout -b my-new-feature`)