pig_sniffer 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/pig_sniffer.rb +3 -6
- data/lib/pig_sniffer/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e155fd2aaaa70de61d70143d93dbc6152479f26
|
4
|
+
data.tar.gz: 38b2db3400fc2577f58601e480658d101c0e2cf7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 554d4c1d8db3b188dfa04c2fad28c038ed911dc544844f579294cf4c342d1fa423faaa2188e442d16137bbd97850253a8e70b838516e2e0ac6aa6a21c00693c1
|
7
|
+
data.tar.gz: 07500bce2cf2d5bc8a465a7fbe323f8b0c588c847f5d2864aab995bd6acbb860e3eee571d550b938839eb06b22fa686d4f080f52836a42d66d221cbb2976d768
|
data/README.md
CHANGED
@@ -28,10 +28,10 @@ Finds All Police stations in chicago
|
|
28
28
|
police = PigSniffer::Police.all
|
29
29
|
|
30
30
|
```
|
31
|
-
search by
|
31
|
+
search by Address
|
32
32
|
|
33
33
|
```ruby
|
34
|
-
police = PigSniffer::Police.
|
34
|
+
police = PigSniffer::Police.search_address('1718 S State St')
|
35
35
|
```
|
36
36
|
|
37
37
|
## Development
|
data/lib/pig_sniffer.rb
CHANGED
@@ -8,29 +8,26 @@ module PigSniffer
|
|
8
8
|
attr_reader :zip, :location, :address, :state, :district, :city
|
9
9
|
|
10
10
|
def initialize(police_api_info)
|
11
|
-
|
12
11
|
@zip = police_api_info["zip"]
|
13
12
|
@location = police_api_info["location"]
|
14
13
|
@address = police_api_info["address"]
|
15
14
|
@state = police_api_info["state"]
|
16
15
|
@district = police_api_info["district"]
|
17
16
|
@city = police_api_info["city"]
|
18
|
-
|
19
|
-
end
|
17
|
+
end
|
20
18
|
|
21
19
|
|
22
20
|
def self.all
|
23
21
|
api_array = Unirest.get('https://data.cityofchicago.org/resource/z8bn-74gv.json').body
|
24
22
|
police_stations = []
|
25
|
-
|
26
23
|
api_array.each do |station|
|
27
24
|
police_stations << Police.new(station)
|
28
25
|
end
|
29
26
|
police_stations
|
30
27
|
end
|
31
28
|
|
32
|
-
def self.
|
33
|
-
api_array = Unirest.get("https://data.cityofchicago.org/resource/z8bn-74gv.json
|
29
|
+
def self.search_address(search_address)
|
30
|
+
api_array = Unirest.get("https://data.cityofchicago.org/resource/z8bn-74gv.json?address=#{search_address}").body
|
34
31
|
police_stations = []
|
35
32
|
|
36
33
|
police_stations = []
|
data/lib/pig_sniffer/version.rb
CHANGED