ChuckJHardy / CrimeFetcher

Wrapper for the Police UK API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Crime Fetcher - Codeship Status for ChuckJHardy/CrimeFetcher

Wrapper for the Police UK API.

Documentation

The API provides a rich data source for information, including:

  • Neighbourhood team members Todo
  • Upcoming events Todo
  • Street-level crime and outcome data Covered in CrimeFetcher
  • Nearest police stations Todo

The API is implemented as a standard JSON web service using HTTP GET and POST requests. Full request and response examples are provided in the documentation.

Installation

Add this line to your application's Gemfile:

gem 'crime-fetcher', github: 'ChuckJHardy/CrimeFetcher'

And then execute:

$ bundle

Configuration

CrimeFetcher.configure do |config|
  config.domain = "https://data.police.uk/api/v2"
  config.verbose = true
  config.log = true
  config.logger = Rails.logger
end
  • domain sets the base url https://data.police.uk/api/
  • verbose sets the logger level false
  • log should log message be logged false
  • logger Logger object. Logger

Usage

Find Exchange Rate:

crime_fetcher = CrimeFetcher.new(lat: 52.629729, lng: -1.131592, date: Date.today)
# => #<CrimeFetcher:0x007f985c021f10>

crime_fetcher.street
# => #<CrimeFetcher::Street:0x007f985c021f10>

crime_fetcher.street.as_hash
# => { ... }

Testing

# Includes Rubocop
$ bin/rspec

Development

After checking out the repo, run bin/setup to install dependencies. Then, run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release to create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

  1. Fork it ( https://github.com/[my-github-username]/CrimeFetcher/fork )
  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 a new Pull Request

About

Wrapper for the Police UK API

License:MIT License


Languages

Language:Ruby 99.5%Language:Shell 0.5%