Skip to content

nicolasleger/nice

Repository files navigation

nice

A Ruby gem for accessing and managing OpenData from Nice Côte d'Azur (NCA) metropolitan area via CKAN API.

Installation

Add this line to your application's Gemfile:

gem 'nice'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install nice

Configuration

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"
end

Alternatively, set environment variables:

export NICE_CKAN_URL="https://opendata.nicecotedazur.org/data/"
export NICE_CKAN_API_KEY="your-api-key-here"

Usage

Create a client

client = Nice::Client.new

Or with direct credentials:

client = Nice::Client.new(
  ckan_url: "https://opendata.nicecotedazur.org/data/",
  api_key: "your-api-key-here"
)

List packages (datasets)

packages = client.list_packages
puts "Found #{packages.count} packages"

Search for datasets

results = client.search_packages("transport")
puts "Found #{results['count']} matches"

Get package details

package = client.get_package("package-id")
puts package['title']

List organizations

organizations = client.list_organizations

Get organization details

org = client.get_organization("organization-id")

List groups

groups = client.list_groups

Get resource details

resource = client.get_resource("resource-id")

Development

After checking out the repo, run bundle install to install dependencies.

Running Tests

Run the test suite:

bundle exec rspec

Run tests with detailed output:

bundle exec rspec --format documentation

Run a specific test file:

bundle exec rspec spec/nice/client_spec.rb

Linting

Check code style with RuboCop:

bundle exec rubocop

Contributing

Bug reports and pull requests are welcome.

License

The gem is available as open source under the terms of the MIT License.

About

OpenData NCA - Métropole Nice Côte d'Azur

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages