Module: OldBill::Api::Neighbourhood
- Included in:
- Session
- Defined in:
- lib/oldbill/api/neighbourhood.rb
Instance Method Summary collapse
- #events(force, neighbourhood, params = {}) ⇒ Array<OldBill::V2::Neighbourhoods::Event>
- #locate(lat, lng, params = {}) ⇒ OldBill::V2::Neighbourhoods::Locator
- #neighbourhood(force, neighbourhood, params = {}) ⇒ Array<OldBill::Neighbourhood>
-
#neighbourhoods(force, params = {}) ⇒ Array<OldBill::Neighbourhood>
Only partially loaded.
- #police_officers(force, neighbourhood, params = {}) ⇒ Array<OldBill::V2::Neighbourhoods::PoliceOfficer>
Instance Method Details
#events(force, neighbourhood, params = {}) ⇒ Array<OldBill::V2::Neighbourhoods::Event>
26 27 28 29 30 |
# File 'lib/oldbill/api/neighbourhood.rb', line 26 def events(force, neighbourhood, params = {}) api_call(:get, "/#{force}/#{neighbourhood}/events", params) do |response| response.map{|event| OldBill::V2::Neighbourhoods::Event.new(merge_session!(event))} end end |
#locate(lat, lng, params = {}) ⇒ OldBill::V2::Neighbourhoods::Locator
46 47 48 49 50 51 52 |
# File 'lib/oldbill/api/neighbourhood.rb', line 46 def locate(lat, lng, params = {}) api_call(:get, "/locate-neighbourhood", params.merge!({:q => "#{lat},#{lng}"})) do |response| OldBill::V2::Neighbourhoods::Locator.new(merge_session!(response)) end rescue NotFoundError nil end |
#neighbourhood(force, neighbourhood, params = {}) ⇒ Array<OldBill::Neighbourhood>
17 18 19 20 21 |
# File 'lib/oldbill/api/neighbourhood.rb', line 17 def neighbourhood(force, neighbourhood, params = {}) api_call(:get, "/#{force}/#{neighbourhood}", params) do |response| OldBill::V2::Neighbourhood.new(merge_session!(response.merge({:force => force, :fully_loaded => true}))) end end |
#neighbourhoods(force, params = {}) ⇒ Array<OldBill::Neighbourhood>
Returns only partially loaded.
8 9 10 11 12 |
# File 'lib/oldbill/api/neighbourhood.rb', line 8 def neighbourhoods(force, params = {}) api_call(:get, "/#{force}/neighbourhoods", params) do |response| response.map{|neighbourhood| OldBill::V2::Neighbourhood.new(merge_session!(neighbourhood.merge({:force => force, :fully_loaded => false}))) } end end |
#police_officers(force, neighbourhood, params = {}) ⇒ Array<OldBill::V2::Neighbourhoods::PoliceOfficer>
36 37 38 39 40 |
# File 'lib/oldbill/api/neighbourhood.rb', line 36 def police_officers(force, neighbourhood, params = {}) api_call(:get, "/#{force}/#{neighbourhood}/people", params) do |response| response.map{|event| OldBill::V2::Neighbourhoods::PoliceOfficer.new(merge_session!(event))} end end |