Repo Status: Archived.
This repo was identified as an un-managed repository. As such, we have chosedn to decommission this repository to prevent the consumption of security vulnerabilities within this repository.
More info can be found here: https://mode.quip.com/NwvJAwA7l4SN/August-Issue-Review-Committee-Meeting#GYBACAb6dwZ
Mocrata is a SODA (Socrata Open Data API) client developed by Mode Analytics.
Add this line to your application's Gemfile:
gem 'mocrata'
And then execute:
$ bundle
Or install it yourself as:
$ gem install mocrata
Mocrata.configure do |config|
config.app_token = 'yourtoken' # optional Socrata application token
end
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
=> [["Albania", "AL", "8", "41", "20"],
["Algeria", "DZ", "12", "28", "3"], ...]
dataset.json
=> [{"longitude_average"=>"20",
"latitude_average"=>"41",
"alpha_2_code"=>"AL",
"numeric_code"=>"8",
"country"=>"Albania"}, ...]
dataset.fields
=> {":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"}
dataset.each_row(:csv) do |row|
# do something with the row
end
dataset.each_row(:json) { |row| ... }
http://rubydoc.info/github/mode/mocrata/master/frames
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request