New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

mocrata

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mocrata

  • 0.1.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Mocrata

Build Status Code Climate Gem Version

Mocrata is a SODA (Socrata Open Data API) client developed by Mode Analytics.

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://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"}

Iterating through rows

dataset.each_row(:csv) do |row|
  # 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)
  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

FAQs

Package last updated on 07 Aug 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc