class CrimeCrimeChicago::Crime

Attributes

arrest[R]
date[R]
description[R]
id[R]
primary_type[R]

Public Class Methods

all() click to toggle source
# File lib/crime_crime_chicago.rb, line 16
def self.all 
  collection = []
  Unirest.get('https://data.cityofchicago.org/resource/vwwp-7yr9.json').body.each do |crime_hash|
    collection << Crime.new(crime_hash)
  end
  collection
end
find(params_id) click to toggle source
# File lib/crime_crime_chicago.rb, line 24
def self.find(params_id)
  Crime.new(Unirest.get("https://data.cityofchicago.org/resource/vwwp-7yr9.json?id=#{params_id}").body.first)
end
new(hash) click to toggle source
# File lib/crime_crime_chicago.rb, line 8
def initialize(hash)
  @id = hash["id"]
  @date = hash["date"]
  @primary_type = hash["primary_type"]
  @description = hash["description"]
  @arrest = hash["arrest"]
end