A Ruby gem for accessing and managing OpenData from Nice Côte d'Azur (NCA) metropolitan area via CKAN API.
Add this line to your application's Gemfile:
gem 'nice'And then execute:
$ bundle install
Or install it yourself as:
$ gem install nice
Configure the gem with your CKAN instance URL and API key:
require 'nice'
Nice.configure do |config|
config.ckan_url = "https://opendata.nicecotedazur.org/data/"
config.api_key = "your-api-key-here"
endAlternatively, set environment variables:
export NICE_CKAN_URL="https://opendata.nicecotedazur.org/data/"
export NICE_CKAN_API_KEY="your-api-key-here"client = Nice::Client.newOr with direct credentials:
client = Nice::Client.new(
ckan_url: "https://opendata.nicecotedazur.org/data/",
api_key: "your-api-key-here"
)packages = client.list_packages
puts "Found #{packages.count} packages"results = client.search_packages("transport")
puts "Found #{results['count']} matches"package = client.get_package("package-id")
puts package['title']organizations = client.list_organizationsorg = client.get_organization("organization-id")groups = client.list_groupsresource = client.get_resource("resource-id")After checking out the repo, run bundle install to install dependencies.
Run the test suite:
bundle exec rspecRun tests with detailed output:
bundle exec rspec --format documentationRun a specific test file:
bundle exec rspec spec/nice/client_spec.rbCheck code style with RuboCop:
bundle exec rubocopBug reports and pull requests are welcome.
The gem is available as open source under the terms of the MIT License.