enigma_io 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. data/.gitignore +17 -0
  2. data/.rubocop.yml +14 -0
  3. data/.travis.yml +14 -0
  4. data/Gemfile +11 -0
  5. data/LICENSE.txt +22 -0
  6. data/README.md +64 -0
  7. data/Rakefile +28 -0
  8. data/enigma_io.gemspec +30 -0
  9. data/examples/data.md +94 -0
  10. data/examples/export.md +35 -0
  11. data/lib/enigma/client.rb +26 -0
  12. data/lib/enigma/download.rb +81 -0
  13. data/lib/enigma/endpoint.rb +108 -0
  14. data/lib/enigma/endpoints/data.rb +5 -0
  15. data/lib/enigma/endpoints/export.rb +22 -0
  16. data/lib/enigma/endpoints/meta.rb +5 -0
  17. data/lib/enigma/endpoints/stats.rb +5 -0
  18. data/lib/enigma/response.rb +17 -0
  19. data/lib/enigma/version.rb +6 -0
  20. data/lib/enigma.rb +49 -0
  21. data/test/client_test.rb +32 -0
  22. data/test/data_test.rb +81 -0
  23. data/test/endpoint_test.rb +55 -0
  24. data/test/export_test.rb +67 -0
  25. data/test/fixtures/download.csv +4 -0
  26. data/test/fixtures/download.zip +0 -0
  27. data/test/fixtures/vcr_cassettes/compound_average.yml +121 -0
  28. data/test/fixtures/vcr_cassettes/data_with_error.yml +38 -0
  29. data/test/fixtures/vcr_cassettes/export.yml +37 -0
  30. data/test/fixtures/vcr_cassettes/filtered_data.yml +6727 -0
  31. data/test/fixtures/vcr_cassettes/limit_data.yml +54 -0
  32. data/test/fixtures/vcr_cassettes/page_data.yml +53 -0
  33. data/test/fixtures/vcr_cassettes/selected_data.yml +541 -0
  34. data/test/fixtures/vcr_cassettes/simple_data.yml +6762 -0
  35. data/test/fixtures/vcr_cassettes/simple_metadata.yml +75 -0
  36. data/test/fixtures/vcr_cassettes/simple_stats.yml +48 -0
  37. data/test/fixtures/vcr_cassettes/sorted_data.yml +6690 -0
  38. data/test/fixtures/vcr_cassettes/sorted_data_descending.yml +6690 -0
  39. data/test/meta_test.rb +26 -0
  40. data/test/response_test.rb +13 -0
  41. data/test/stats_test.rb +27 -0
  42. data/test/test_helper.rb +37 -0
  43. metadata +223 -0
@@ -0,0 +1,54 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.enigma.io/v2/data/test-key/us.gov.whitehouse.visitor-list?limit=1
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Typhoeus - https://github.com/typhoeus/typhoeus
12
+ response:
13
+ status:
14
+ code: 200
15
+ message: OK
16
+ headers:
17
+ Server:
18
+ - nginx/1.2.9
19
+ Date:
20
+ - Sun, 26 Jan 2014 21:21:19 GMT
21
+ Content-Type:
22
+ - application/json; charset=utf-8
23
+ Content-Length:
24
+ - '1158'
25
+ Connection:
26
+ - keep-alive
27
+ Vary:
28
+ - Accept-Encoding
29
+ Access-Control-Allow-Origin:
30
+ - ! '*'
31
+ Etag:
32
+ - ! '"1671210483"'
33
+ body:
34
+ encoding: US-ASCII
35
+ string: ! "{\n \"datapath\": \"us.gov.whitehouse.visitor-list\",\n \"success\":
36
+ true,\n \"info\": {\n \"rows_limit\": 1,\n \"total_results\": 3427529,\n
37
+ \ \"total_pages\": 3427529,\n \"current_page\": 1\n },\n \"result\":
38
+ [\n {\n \"namelast\": \"BELBAS\",\n \"namefirst\": \"TED\",\n
39
+ \ \"namemid\": null,\n \"namefull\": \"TED BELBAS\",\n \"uin\":
40
+ \"U14155\",\n \"bdgnbr\": null,\n \"type_of_access\": \"VA\",\n
41
+ \ \"toa\": null,\n \"poa\": null,\n \"tod\": null,\n \"pod\":
42
+ null,\n \"appt_made_date\": \"2010-06-15T21:23:00.000Z\",\n \"appt_start_date\":
43
+ \"2010-06-17T20:00:00.000Z\",\n \"appt_end_date\": \"2010-06-18T03:59:00.000Z\",\n
44
+ \ \"appt_cancel_date\": null,\n \"total_people\": \"466\",\n \"last_updatedby\":
45
+ \"T1\",\n \"post\": \"WIN\",\n \"lastentrydate\": \"2010-06-15T21:23:00.000Z\",\n
46
+ \ \"terminal_suffix\": \"T1\",\n \"visitee_namelast\": \"OFFICE\",\n
47
+ \ \"visitee_namefirst\": \"VISITORS\",\n \"meeting_loc\": \"WH\",\n
48
+ \ \"meeting_room\": \"RES\",\n \"caller_name_last\": \"OFFICE\",\n
49
+ \ \"caller_name_first\": \"VISITORS\",\n \"caller_room\": null,\n
50
+ \ \"description\": null,\n \"release_date\": \"2010-09-24T00:00:00.000Z\",\n
51
+ \ \"serialid\": 1\n }\n ]\n}"
52
+ http_version:
53
+ recorded_at: Sun, 26 Jan 2014 21:22:24 GMT
54
+ recorded_with: VCR 2.8.0
@@ -0,0 +1,53 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.enigma.io/v2/data/test-key/us.gov.whitehouse.visitor-list?limit=1&page=2
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Typhoeus - https://github.com/typhoeus/typhoeus
12
+ response:
13
+ status:
14
+ code: 200
15
+ message: OK
16
+ headers:
17
+ Server:
18
+ - nginx/1.2.9
19
+ Date:
20
+ - Sun, 26 Jan 2014 21:21:19 GMT
21
+ Content-Type:
22
+ - application/json; charset=utf-8
23
+ Content-Length:
24
+ - '1158'
25
+ Connection:
26
+ - keep-alive
27
+ Vary:
28
+ - Accept-Encoding
29
+ Access-Control-Allow-Origin:
30
+ - ! '*'
31
+ Etag:
32
+ - ! '"-986426965"'
33
+ body:
34
+ encoding: US-ASCII
35
+ string: ! "{\n \"datapath\": \"us.gov.whitehouse.visitor-list\",\n \"success\":
36
+ true,\n \"info\": {\n \"rows_limit\": 1,\n \"total_results\": 3427529,\n
37
+ \ \"total_pages\": 3427529,\n \"current_page\": 2\n },\n \"result\":
38
+ [\n {\n \"namelast\": \"BOUL\",\n \"namefirst\": \"DAVID\",\n
39
+ \ \"namemid\": null,\n \"namefull\": \"DAVID BOUL\",\n \"uin\":
40
+ \"U17331\",\n \"bdgnbr\": null,\n \"type_of_access\": \"VA\",\n
41
+ \ \"toa\": null,\n \"poa\": null,\n \"tod\": null,\n \"pod\":
42
+ null,\n \"appt_made_date\": \"2010-06-17T20:38:00.000Z\",\n \"appt_start_date\":
43
+ \"2010-06-22T21:00:00.000Z\",\n \"appt_end_date\": \"2010-06-23T03:59:00.000Z\",\n
44
+ \ \"appt_cancel_date\": null,\n \"total_people\": \"388\",\n \"last_updatedby\":
45
+ \"J7\",\n \"post\": \"WIN\",\n \"lastentrydate\": \"2010-06-17T20:38:00.000Z\",\n
46
+ \ \"terminal_suffix\": \"J7\",\n \"visitee_namelast\": \"POTUS\",\n
47
+ \ \"visitee_namefirst\": null,\n \"meeting_loc\": \"WH\",\n \"meeting_room\":
48
+ \"STATE FLOO\",\n \"caller_name_last\": \"GALLAGHER\",\n \"caller_name_first\":
49
+ \"CLARE\",\n \"caller_room\": null,\n \"description\": null,\n \"release_date\":
50
+ \"2010-09-24T00:00:00.000Z\",\n \"serialid\": 2\n }\n ]\n}"
51
+ http_version:
52
+ recorded_at: Sun, 26 Jan 2014 21:22:24 GMT
53
+ recorded_with: VCR 2.8.0