oldbill 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
@@ -0,0 +1,3 @@
1
+ module Oldbill
2
+ VERSION = "0.0.1"
3
+ 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