oldbill 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +4 -0
- data/.rspec +2 -0
- data/Gemfile +18 -0
- data/README.rdoc +82 -0
- data/Rakefile +2 -0
- data/autotest/discover.rb +1 -0
- data/lib/oldbill/api/crime.rb +46 -0
- data/lib/oldbill/api/neighbourhood.rb +56 -0
- data/lib/oldbill/errors.rb +24 -0
- data/lib/oldbill/service.rb +43 -0
- data/lib/oldbill/session.rb +85 -0
- data/lib/oldbill/v2/crime_by_month.rb +30 -0
- data/lib/oldbill/v2/crimes/location.rb +34 -0
- data/lib/oldbill/v2/crimes/street_level.rb +32 -0
- data/lib/oldbill/v2/force.rb +37 -0
- data/lib/oldbill/v2/neighbourhood.rb +98 -0
- data/lib/oldbill/v2/neighbourhoods/event.rb +43 -0
- data/lib/oldbill/v2/neighbourhoods/location.rb +19 -0
- data/lib/oldbill/v2/neighbourhoods/locator.rb +34 -0
- data/lib/oldbill/v2/neighbourhoods/police_officer.rb +33 -0
- data/lib/oldbill/version.rb +3 -0
- data/lib/oldbill.rb +25 -0
- data/oldbill.gemspec +28 -0
- data/spec/fixtures/vcr_cassettes/share.yml +24852 -0
- data/spec/session/cache_spec.rb +76 -0
- data/spec/session/create_spec.rb +28 -0
- data/spec/session/crime_spec.rb +121 -0
- data/spec/session/neighbourhoods_spec.rb +131 -0
- data/spec/spec_helper.rb +19 -0
- data/spec/vcr_enabled.rb +11 -0
- metadata +188 -0
@@ -0,0 +1,34 @@
|
|
1
|
+
module OldBill
|
2
|
+
module V2
|
3
|
+
module Neighbourhoods
|
4
|
+
class Locator < Hashie::Dash
|
5
|
+
|
6
|
+
# == Propertys
|
7
|
+
property :force #Unique force identifier
|
8
|
+
property :neighbourhood #Force specific team identifier
|
9
|
+
property :session
|
10
|
+
|
11
|
+
# @return [Arrray<OldBill::V2::CrimeByMonth>]
|
12
|
+
def crimes_by_month
|
13
|
+
@crimes_by_month ||= session.crimes_by_month(self.force, self.neighbourhood)
|
14
|
+
end
|
15
|
+
|
16
|
+
# @return [O]ldBill::V2::Neighbourhood]
|
17
|
+
def full_neighbourhood
|
18
|
+
@full_neighbourhood ||= session.neighbourhood(self.force, self.neighbourhood)
|
19
|
+
end
|
20
|
+
|
21
|
+
# @return [Arrray<OldBill::V2::Neighbourhoods::Events>]
|
22
|
+
def events
|
23
|
+
@events ||= session.events(self.force, self.neighbourhood)
|
24
|
+
end
|
25
|
+
|
26
|
+
# @return [Arrray<OldBill::V2::Neighbourhoods::PoliceOfficers>]
|
27
|
+
def police_officers
|
28
|
+
@police_officers ||= session.police_officers(self.force, self.neighbourhood)
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module OldBill
|
2
|
+
module V2
|
3
|
+
module Neighbourhoods
|
4
|
+
class PoliceOfficer < Hashie::Dash
|
5
|
+
|
6
|
+
property :bio #Team member biography (if available)
|
7
|
+
property :name #Name of the person
|
8
|
+
property :rank #Force rank
|
9
|
+
property :contact_details # Unique force identifier
|
10
|
+
property :session
|
11
|
+
|
12
|
+
# email
|
13
|
+
# telephone
|
14
|
+
def contact_details_parsed(value)
|
15
|
+
unless value.nil?
|
16
|
+
Hashie::Mash.new(value)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
# == yak!!!!! refactor me please
|
21
|
+
def []=(property, value)
|
22
|
+
case property
|
23
|
+
when "contact_details"
|
24
|
+
super(property.to_s, contact_details_parsed(value))
|
25
|
+
else
|
26
|
+
super
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/lib/oldbill.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# requires
|
2
|
+
require "httparty"
|
3
|
+
require "hashie"
|
4
|
+
require "moneta"
|
5
|
+
require "moneta/memory"
|
6
|
+
require 'active_support/ordered_hash'
|
7
|
+
|
8
|
+
require "oldbill/api/crime"
|
9
|
+
require "oldbill/api/neighbourhood"
|
10
|
+
require "oldbill/errors"
|
11
|
+
require "oldbill/service"
|
12
|
+
require "oldbill/session"
|
13
|
+
require "oldbill/v2/force"
|
14
|
+
require "oldbill/v2/crime_by_month"
|
15
|
+
require "oldbill/v2/crimes/location"
|
16
|
+
require "oldbill/v2/crimes/street_level"
|
17
|
+
require "oldbill/v2/neighbourhood"
|
18
|
+
require "oldbill/v2/neighbourhoods/event"
|
19
|
+
require "oldbill/v2/neighbourhoods/location"
|
20
|
+
require "oldbill/v2/neighbourhoods/locator"
|
21
|
+
require "oldbill/v2/neighbourhoods/police_officer"
|
22
|
+
|
23
|
+
module Oldbill
|
24
|
+
# Your code goes here...
|
25
|
+
end
|
data/oldbill.gemspec
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "oldbill/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "oldbill"
|
7
|
+
s.version = Oldbill::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["hookercookerman"]
|
10
|
+
s.email = ["hookercookerman@gmail.com"]
|
11
|
+
s.homepage = ""
|
12
|
+
s.summary = %q{ruby wrapper for the police API}
|
13
|
+
s.description = %q{ruby wrapper for the police API}
|
14
|
+
|
15
|
+
s.rubyforge_project = "oldbill"
|
16
|
+
|
17
|
+
s.add_dependency 'activesupport', '~> 3.0.5'
|
18
|
+
s.add_dependency 'i18n', '>= 0.5'
|
19
|
+
s.add_dependency 'httparty', '~> 0.7.4'
|
20
|
+
s.add_dependency 'hashie', '~> 1.0.0'
|
21
|
+
s.add_dependency 'moneta', '~> 0.6.0'
|
22
|
+
s.add_dependency 'tzinfo', '~> 0.3.22'
|
23
|
+
|
24
|
+
s.files = `git ls-files`.split("\n")
|
25
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
26
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
27
|
+
s.require_paths = ["lib"]
|
28
|
+
end
|