hatolence 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.
Files changed (37) hide show
  1. data/.gitignore +17 -0
  2. data/.rspec +2 -0
  3. data/Gemfile +4 -0
  4. data/Guardfile +10 -0
  5. data/LICENSE.txt +22 -0
  6. data/README.md +29 -0
  7. data/Rakefile +1 -0
  8. data/hatolence.gemspec +31 -0
  9. data/lib/hatolence.rb +21 -0
  10. data/lib/hatolence/bias.rb +25 -0
  11. data/lib/hatolence/bias_category.rb +16 -0
  12. data/lib/hatolence/http_client.rb +21 -0
  13. data/lib/hatolence/offense.rb +25 -0
  14. data/lib/hatolence/offense_category.rb +16 -0
  15. data/lib/hatolence/params_builder.rb +10 -0
  16. data/lib/hatolence/version.rb +3 -0
  17. data/lib/hatolence/victim_count.rb +45 -0
  18. data/spec/fixtures/vcr_cassettes/all_biases.yml +48 -0
  19. data/spec/fixtures/vcr_cassettes/all_offenses.yml +48 -0
  20. data/spec/fixtures/vcr_cassettes/all_victim_count.yml +48 -0
  21. data/spec/fixtures/vcr_cassettes/bias_categories.yml +48 -0
  22. data/spec/fixtures/vcr_cassettes/cat_and_turtle_bias_victim_count.yml +48 -0
  23. data/spec/fixtures/vcr_cassettes/cat_bias_victim_count.yml +48 -0
  24. data/spec/fixtures/vcr_cassettes/land_and_water_bias.yml +48 -0
  25. data/spec/fixtures/vcr_cassettes/land_bias.yml +48 -0
  26. data/spec/fixtures/vcr_cassettes/offense_categories.yml +48 -0
  27. data/spec/fixtures/vcr_cassettes/person_and_property_offense.yml +48 -0
  28. data/spec/fixtures/vcr_cassettes/person_offense.yml +48 -0
  29. data/spec/fixtures/vcr_cassettes/poked_and_dropped_offense_victim_count.yml +48 -0
  30. data/spec/fixtures/vcr_cassettes/poked_offense_victim_conut.yml +48 -0
  31. data/spec/hatolence/bias_category_spec.rb +12 -0
  32. data/spec/hatolence/bias_spec.rb +30 -0
  33. data/spec/hatolence/offense_category_spec.rb +12 -0
  34. data/spec/hatolence/offense_spec.rb +30 -0
  35. data/spec/hatolence/victim_count_spec.rb +51 -0
  36. data/spec/spec_helper.rb +28 -0
  37. metadata +251 -0
@@ -0,0 +1,48 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://hate-crimes.herokuapp.com/api/bias_categories.json
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - "*/*; q=0.5, application/xml"
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: ! 'OK '
20
+ headers:
21
+ Cache-Control:
22
+ - max-age=0, private, must-revalidate
23
+ Content-Type:
24
+ - application/json; charset=utf-8
25
+ Date:
26
+ - Sun, 02 Jun 2013 03:12:48 GMT
27
+ Etag:
28
+ - "\"e032e1850f01a2667a8286371a519a08\""
29
+ Server:
30
+ - WEBrick/1.3.1 (Ruby/1.9.2/2011-07-09)
31
+ X-Rack-Cache:
32
+ - miss
33
+ X-Request-Id:
34
+ - 5a8ecb1e5648231cc81de7c5bea64b8b
35
+ X-Runtime:
36
+ - '0.017325'
37
+ X-Ua-Compatible:
38
+ - IE=Edge,chrome=1
39
+ Content-Length:
40
+ - '124'
41
+ Connection:
42
+ - keep-alive
43
+ body:
44
+ encoding: UTF-8
45
+ string: "[{\"name\":\"land\",\"biases\":[{\"name\":\"cat\"},{\"name\":\"turtle\"}]},{\"name\":\"water\",\"biases\":[{\"name\":\"fish\"},{\"name\":\"dolphin\"}]}]"
46
+ http_version:
47
+ recorded_at: Sun, 02 Jun 2013 03:12:48 GMT
48
+ recorded_with: VCR 2.5.0
@@ -0,0 +1,48 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://hate-crimes.herokuapp.com/api/victim_counts.json?bias%5B0%5D=cat&bias%5B1%5D=turtle
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - "*/*; q=0.5, application/xml"
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: ! 'OK '
20
+ headers:
21
+ Cache-Control:
22
+ - max-age=0, private, must-revalidate
23
+ Content-Type:
24
+ - application/json; charset=utf-8
25
+ Date:
26
+ - Sun, 02 Jun 2013 03:12:46 GMT
27
+ Etag:
28
+ - "\"13c2197af63396cd56b35f4eef6d70f4\""
29
+ Server:
30
+ - WEBrick/1.3.1 (Ruby/1.9.2/2011-07-09)
31
+ X-Rack-Cache:
32
+ - miss
33
+ X-Request-Id:
34
+ - 0def3ed7551d89617e2dbf6e438fbc5c
35
+ X-Runtime:
36
+ - '0.036137'
37
+ X-Ua-Compatible:
38
+ - IE=Edge,chrome=1
39
+ Content-Length:
40
+ - '517'
41
+ Connection:
42
+ - keep-alive
43
+ body:
44
+ encoding: UTF-8
45
+ string: "[{\"total\":1,\"bias\":{\"name\":\"cat\"},\"offense\":{\"name\":\"poked\"}},{\"total\":2,\"bias\":{\"name\":\"cat\"},\"offense\":{\"name\":\"dropped\"}},{\"total\":3,\"bias\":{\"name\":\"cat\"},\"offense\":{\"name\":\"vandalism\"}},{\"total\":4,\"bias\":{\"name\":\"cat\"},\"offense\":{\"name\":\"arson\"}},{\"total\":11,\"bias\":{\"name\":\"turtle\"},\"offense\":{\"name\":\"poked\"}},{\"total\":12,\"bias\":{\"name\":\"turtle\"},\"offense\":{\"name\":\"dropped\"}},{\"total\":13,\"bias\":{\"name\":\"turtle\"},\"offense\":{\"name\":\"vandalism\"}},{\"total\":14,\"bias\":{\"name\":\"turtle\"},\"offense\":{\"name\":\"arson\"}}]"
46
+ http_version:
47
+ recorded_at: Sun, 02 Jun 2013 03:12:46 GMT
48
+ recorded_with: VCR 2.5.0
@@ -0,0 +1,48 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://hate-crimes.herokuapp.com/api/victim_counts.json?bias%5B0%5D=cat
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - "*/*; q=0.5, application/xml"
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: ! 'OK '
20
+ headers:
21
+ Cache-Control:
22
+ - max-age=0, private, must-revalidate
23
+ Content-Type:
24
+ - application/json; charset=utf-8
25
+ Date:
26
+ - Sun, 02 Jun 2013 03:12:46 GMT
27
+ Etag:
28
+ - "\"1363dd16e04e046d61f678ea7e519158\""
29
+ Server:
30
+ - WEBrick/1.3.1 (Ruby/1.9.2/2011-07-09)
31
+ X-Rack-Cache:
32
+ - miss
33
+ X-Request-Id:
34
+ - 6b8745f1a95407e1e4dd68748768a93a
35
+ X-Runtime:
36
+ - '0.088798'
37
+ X-Ua-Compatible:
38
+ - IE=Edge,chrome=1
39
+ Content-Length:
40
+ - '251'
41
+ Connection:
42
+ - keep-alive
43
+ body:
44
+ encoding: UTF-8
45
+ string: "[{\"total\":1,\"bias\":{\"name\":\"cat\"},\"offense\":{\"name\":\"poked\"}},{\"total\":2,\"bias\":{\"name\":\"cat\"},\"offense\":{\"name\":\"dropped\"}},{\"total\":3,\"bias\":{\"name\":\"cat\"},\"offense\":{\"name\":\"vandalism\"}},{\"total\":4,\"bias\":{\"name\":\"cat\"},\"offense\":{\"name\":\"arson\"}}]"
46
+ http_version:
47
+ recorded_at: Sun, 02 Jun 2013 03:12:46 GMT
48
+ recorded_with: VCR 2.5.0
@@ -0,0 +1,48 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://hate-crimes.herokuapp.com/api/biases.json?category%5B0%5D=land&category%5B1%5D=water
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - "*/*; q=0.5, application/xml"
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: ! 'OK '
20
+ headers:
21
+ Cache-Control:
22
+ - max-age=0, private, must-revalidate
23
+ Content-Type:
24
+ - application/json; charset=utf-8
25
+ Date:
26
+ - Sun, 02 Jun 2013 03:12:47 GMT
27
+ Etag:
28
+ - "\"77dec0a5715ff5863ce4bb17f1af03e9\""
29
+ Server:
30
+ - WEBrick/1.3.1 (Ruby/1.9.2/2011-07-09)
31
+ X-Rack-Cache:
32
+ - miss
33
+ X-Request-Id:
34
+ - 3e302e735380c6efb0323222650bd1c7
35
+ X-Runtime:
36
+ - '0.005927'
37
+ X-Ua-Compatible:
38
+ - IE=Edge,chrome=1
39
+ Content-Length:
40
+ - '69'
41
+ Connection:
42
+ - keep-alive
43
+ body:
44
+ encoding: UTF-8
45
+ string: "[{\"name\":\"cat\"},{\"name\":\"turtle\"},{\"name\":\"fish\"},{\"name\":\"dolphin\"}]"
46
+ http_version:
47
+ recorded_at: Sun, 02 Jun 2013 03:12:47 GMT
48
+ recorded_with: VCR 2.5.0
@@ -0,0 +1,48 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://hate-crimes.herokuapp.com/api/biases.json?category%5B0%5D=land
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - "*/*; q=0.5, application/xml"
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: ! 'OK '
20
+ headers:
21
+ Cache-Control:
22
+ - max-age=0, private, must-revalidate
23
+ Content-Type:
24
+ - application/json; charset=utf-8
25
+ Date:
26
+ - Sun, 02 Jun 2013 03:12:47 GMT
27
+ Etag:
28
+ - "\"fbb66d480dc0bdcb86b392dc45e880ad\""
29
+ Server:
30
+ - WEBrick/1.3.1 (Ruby/1.9.2/2011-07-09)
31
+ X-Rack-Cache:
32
+ - miss
33
+ X-Request-Id:
34
+ - 3026d04b3f98c510787748b424e665ec
35
+ X-Runtime:
36
+ - '0.033641'
37
+ X-Ua-Compatible:
38
+ - IE=Edge,chrome=1
39
+ Content-Length:
40
+ - '34'
41
+ Connection:
42
+ - keep-alive
43
+ body:
44
+ encoding: UTF-8
45
+ string: "[{\"name\":\"cat\"},{\"name\":\"turtle\"}]"
46
+ http_version:
47
+ recorded_at: Sun, 02 Jun 2013 03:12:47 GMT
48
+ recorded_with: VCR 2.5.0
@@ -0,0 +1,48 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://hate-crimes.herokuapp.com/api/offense_categories.json
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - "*/*; q=0.5, application/xml"
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: ! 'OK '
20
+ headers:
21
+ Cache-Control:
22
+ - max-age=0, private, must-revalidate
23
+ Content-Type:
24
+ - application/json; charset=utf-8
25
+ Date:
26
+ - Sun, 02 Jun 2013 03:12:48 GMT
27
+ Etag:
28
+ - "\"317bc47bf7663221af75e43dcb561e28\""
29
+ Server:
30
+ - WEBrick/1.3.1 (Ruby/1.9.2/2011-07-09)
31
+ X-Rack-Cache:
32
+ - miss
33
+ X-Request-Id:
34
+ - b823fa08f0e230493ed9f86fc154a367
35
+ X-Runtime:
36
+ - '0.008616'
37
+ X-Ua-Compatible:
38
+ - IE=Edge,chrome=1
39
+ Content-Length:
40
+ - '139'
41
+ Connection:
42
+ - keep-alive
43
+ body:
44
+ encoding: UTF-8
45
+ string: "[{\"name\":\"person\",\"offenses\":[{\"name\":\"poked\"},{\"name\":\"dropped\"}]},{\"name\":\"property\",\"offenses\":[{\"name\":\"vandalism\"},{\"name\":\"arson\"}]}]"
46
+ http_version:
47
+ recorded_at: Sun, 02 Jun 2013 03:12:48 GMT
48
+ recorded_with: VCR 2.5.0
@@ -0,0 +1,48 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://hate-crimes.herokuapp.com/api/offenses.json?category%5B0%5D=person&category%5B1%5D=property
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - "*/*; q=0.5, application/xml"
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: ! 'OK '
20
+ headers:
21
+ Cache-Control:
22
+ - max-age=0, private, must-revalidate
23
+ Content-Type:
24
+ - application/json; charset=utf-8
25
+ Date:
26
+ - Sun, 02 Jun 2013 03:12:47 GMT
27
+ Etag:
28
+ - "\"bd4a8bb70b6cf5f97ab4a5f3335b7db8\""
29
+ Server:
30
+ - WEBrick/1.3.1 (Ruby/1.9.2/2011-07-09)
31
+ X-Rack-Cache:
32
+ - miss
33
+ X-Request-Id:
34
+ - 20753a3f3fc9248b74253a2e3149bf6a
35
+ X-Runtime:
36
+ - '0.007128'
37
+ X-Ua-Compatible:
38
+ - IE=Edge,chrome=1
39
+ Content-Length:
40
+ - '75'
41
+ Connection:
42
+ - keep-alive
43
+ body:
44
+ encoding: UTF-8
45
+ string: "[{\"name\":\"poked\"},{\"name\":\"dropped\"},{\"name\":\"vandalism\"},{\"name\":\"arson\"}]"
46
+ http_version:
47
+ recorded_at: Sun, 02 Jun 2013 03:12:47 GMT
48
+ recorded_with: VCR 2.5.0
@@ -0,0 +1,48 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://hate-crimes.herokuapp.com/api/offenses.json?category%5B0%5D=person
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - "*/*; q=0.5, application/xml"
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: ! 'OK '
20
+ headers:
21
+ Cache-Control:
22
+ - max-age=0, private, must-revalidate
23
+ Content-Type:
24
+ - application/json; charset=utf-8
25
+ Date:
26
+ - Sun, 02 Jun 2013 03:12:47 GMT
27
+ Etag:
28
+ - "\"fc2ad2d41202934e360d6cca7d6d50a2\""
29
+ Server:
30
+ - WEBrick/1.3.1 (Ruby/1.9.2/2011-07-09)
31
+ X-Rack-Cache:
32
+ - miss
33
+ X-Request-Id:
34
+ - 319c3f7b2792bc1a061683a8743954e5
35
+ X-Runtime:
36
+ - '0.006812'
37
+ X-Ua-Compatible:
38
+ - IE=Edge,chrome=1
39
+ Content-Length:
40
+ - '37'
41
+ Connection:
42
+ - keep-alive
43
+ body:
44
+ encoding: UTF-8
45
+ string: "[{\"name\":\"poked\"},{\"name\":\"dropped\"}]"
46
+ http_version:
47
+ recorded_at: Sun, 02 Jun 2013 03:12:47 GMT
48
+ recorded_with: VCR 2.5.0
@@ -0,0 +1,48 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://hate-crimes.herokuapp.com/api/victim_counts.json?offense%5B0%5D=poked&offense%5B1%5D=dropped&offense%5B2%5D=vandalism
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - "*/*; q=0.5, application/xml"
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: ! 'OK '
20
+ headers:
21
+ Cache-Control:
22
+ - max-age=0, private, must-revalidate
23
+ Content-Type:
24
+ - application/json; charset=utf-8
25
+ Date:
26
+ - Sun, 02 Jun 2013 03:12:47 GMT
27
+ Etag:
28
+ - "\"7b603f862952d6294e57b3d4b99fa8d6\""
29
+ Server:
30
+ - WEBrick/1.3.1 (Ruby/1.9.2/2011-07-09)
31
+ X-Rack-Cache:
32
+ - miss
33
+ X-Request-Id:
34
+ - bf5de2678803410dffcdbe6b90a2257d
35
+ X-Runtime:
36
+ - '0.026055'
37
+ X-Ua-Compatible:
38
+ - IE=Edge,chrome=1
39
+ Content-Length:
40
+ - '787'
41
+ Connection:
42
+ - keep-alive
43
+ body:
44
+ encoding: UTF-8
45
+ string: "[{\"total\":1,\"bias\":{\"name\":\"cat\"},\"offense\":{\"name\":\"poked\"}},{\"total\":2,\"bias\":{\"name\":\"cat\"},\"offense\":{\"name\":\"dropped\"}},{\"total\":3,\"bias\":{\"name\":\"cat\"},\"offense\":{\"name\":\"vandalism\"}},{\"total\":11,\"bias\":{\"name\":\"turtle\"},\"offense\":{\"name\":\"poked\"}},{\"total\":12,\"bias\":{\"name\":\"turtle\"},\"offense\":{\"name\":\"dropped\"}},{\"total\":13,\"bias\":{\"name\":\"turtle\"},\"offense\":{\"name\":\"vandalism\"}},{\"total\":21,\"bias\":{\"name\":\"fish\"},\"offense\":{\"name\":\"poked\"}},{\"total\":22,\"bias\":{\"name\":\"fish\"},\"offense\":{\"name\":\"dropped\"}},{\"total\":23,\"bias\":{\"name\":\"fish\"},\"offense\":{\"name\":\"vandalism\"}},{\"total\":21,\"bias\":{\"name\":\"fish\"},\"offense\":{\"name\":\"poked\"}},{\"total\":32,\"bias\":{\"name\":\"dolphin\"},\"offense\":{\"name\":\"dropped\"}},{\"total\":33,\"bias\":{\"name\":\"dolphin\"},\"offense\":{\"name\":\"vandalism\"}}]"
46
+ http_version:
47
+ recorded_at: Sun, 02 Jun 2013 03:12:47 GMT
48
+ recorded_with: VCR 2.5.0
@@ -0,0 +1,48 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://hate-crimes.herokuapp.com/api/victim_counts.json?offense%5B0%5D=poked
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - "*/*; q=0.5, application/xml"
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: ! 'OK '
20
+ headers:
21
+ Cache-Control:
22
+ - max-age=0, private, must-revalidate
23
+ Content-Type:
24
+ - application/json; charset=utf-8
25
+ Date:
26
+ - Sun, 02 Jun 2013 03:12:46 GMT
27
+ Etag:
28
+ - "\"908badb32ec27498a9b3aa2c47e1bdde\""
29
+ Server:
30
+ - WEBrick/1.3.1 (Ruby/1.9.2/2011-07-09)
31
+ X-Rack-Cache:
32
+ - miss
33
+ X-Request-Id:
34
+ - c925025b491a56b2e0af96322cc0d83d
35
+ X-Runtime:
36
+ - '0.013590'
37
+ X-Ua-Compatible:
38
+ - IE=Edge,chrome=1
39
+ Content-Length:
40
+ - '253'
41
+ Connection:
42
+ - keep-alive
43
+ body:
44
+ encoding: UTF-8
45
+ string: "[{\"total\":1,\"bias\":{\"name\":\"cat\"},\"offense\":{\"name\":\"poked\"}},{\"total\":11,\"bias\":{\"name\":\"turtle\"},\"offense\":{\"name\":\"poked\"}},{\"total\":21,\"bias\":{\"name\":\"fish\"},\"offense\":{\"name\":\"poked\"}},{\"total\":21,\"bias\":{\"name\":\"fish\"},\"offense\":{\"name\":\"poked\"}}]"
46
+ http_version:
47
+ recorded_at: Sun, 02 Jun 2013 03:12:46 GMT
48
+ recorded_with: VCR 2.5.0