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,75 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.enigma.io/v2/meta/test-key/us.gov.whitehouse.salaries
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 18:58:51 GMT
21
+ Content-Type:
22
+ - application/json; charset=utf-8
23
+ Content-Length:
24
+ - '2805'
25
+ Connection:
26
+ - keep-alive
27
+ Vary:
28
+ - Accept-Encoding
29
+ Access-Control-Allow-Origin:
30
+ - ! '*'
31
+ Etag:
32
+ - ! '"1839071709"'
33
+ body:
34
+ encoding: US-ASCII
35
+ string: ! "{\n \"datapath\": \"us.gov.whitehouse.salaries\",\n \"success\":
36
+ true,\n \"info\": {\n \"result_type\": \"parent\",\n \"children_tables_limit\":
37
+ 50,\n \"children_tables_total\": 4,\n \"current_page\": 1,\n \"total_pages\":
38
+ 1\n },\n \"result\": {\n \"path\": [\n {\n \"level\": \"us\",\n
39
+ \ \"label\": \"United States\",\n \"description\": \"United States\"\n
40
+ \ },\n {\n \"level\": \"gov\",\n \"label\": \"U.S.
41
+ Federal Government\",\n \"description\": \"Government comprising the
42
+ Legislative, Executive, and Judicial branches of the United States of America.\"\n
43
+ \ },\n {\n \"level\": \"whitehouse\",\n \"label\":
44
+ \"The White House\",\n \"description\": \"Located at 1600 Pennsylvania
45
+ Avenue in Washington D.C., the White House has served as the home and office
46
+ for every U.S. president since John Adams.\"\n },\n {\n \"level\":
47
+ \"White House Salaries\",\n \"label\": \"White House Salaries\",\n
48
+ \ \"description\": \"The White House has been required to deliver a
49
+ report to Congress listing the title and salary of every White House Office
50
+ employee since 1995. Consistent with President Obama's commitment to transparency,
51
+ this report is being publicly disclosed on our website as it is transmitted
52
+ to Congress. In addition, this report also contains the title and salary
53
+ details of administration officials who work at the Office of Policy Development,
54
+ including the Domestic Policy Council and the National Economic Council --
55
+ along with White House Office employees.\"\n }\n ],\n \"immediate_nodes\":
56
+ [],\n \"children_tables\": [\n {\n \"datapath\": \"us.gov.whitehouse.salaries.2009\",\n
57
+ \ \"label\": \"2009\",\n \"description\": \"Information regarding
58
+ White House Office employee salaries for 2009.\",\n \"db_boundary_datapath\":
59
+ \"us.gov.whitehouse.salaries\",\n \"db_boundary_label\": \"White House
60
+ Salaries\"\n },\n {\n \"datapath\": \"us.gov.whitehouse.salaries.2010\",\n
61
+ \ \"label\": \"2010\",\n \"description\": \"Information regarding
62
+ White House Office employee salaries for 2010.\",\n \"db_boundary_datapath\":
63
+ \"us.gov.whitehouse.salaries\",\n \"db_boundary_label\": \"White House
64
+ Salaries\"\n },\n {\n \"datapath\": \"us.gov.whitehouse.salaries.2011\",\n
65
+ \ \"label\": \"2011\",\n \"description\": \"Information regarding
66
+ White House Office employee salaries for 2011.\",\n \"db_boundary_datapath\":
67
+ \"us.gov.whitehouse.salaries\",\n \"db_boundary_label\": \"White House
68
+ Salaries\"\n },\n {\n \"datapath\": \"us.gov.whitehouse.salaries.2012\",\n
69
+ \ \"label\": \"2012\",\n \"description\": \"Information regarding
70
+ White House Office employee salaries for 2012.\",\n \"db_boundary_datapath\":
71
+ \"us.gov.whitehouse.salaries\",\n \"db_boundary_label\": \"White House
72
+ Salaries\"\n }\n ]\n }\n}"
73
+ http_version:
74
+ recorded_at: Sun, 26 Jan 2014 18:59:55 GMT
75
+ recorded_with: VCR 2.8.0
@@ -0,0 +1,48 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.enigma.io/v2/stats/test-key/us.gov.whitehouse.visitor-list?select=type_of_access
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:28:01 GMT
21
+ Content-Type:
22
+ - application/json; charset=utf-8
23
+ Content-Length:
24
+ - '835'
25
+ Connection:
26
+ - keep-alive
27
+ Vary:
28
+ - Accept-Encoding
29
+ Access-Control-Allow-Origin:
30
+ - ! '*'
31
+ body:
32
+ encoding: US-ASCII
33
+ string: ! "{\n \"datapath\": \"us.gov.whitehouse.visitor-list\",\n \"success\":
34
+ true,\n \"info\": {\n \"column\": {\n \"id\": \"type_of_access\",\n
35
+ \ \"label\": \"Type Of Access\",\n \"description\": \"Type of access
36
+ to the complex (VA = Visitor Access)\",\n \"type\": \"type_varchar\",\n
37
+ \ \"index\": 6\n },\n \"operations\": [\n \"frequency\"\n ],\n
38
+ \ \"rows_limit\": 500,\n \"total_results\": 5,\n \"total_pages\":
39
+ 1,\n \"current_page\": 1\n },\n \"result\": {\n \"frequency\": [\n
40
+ \ {\n \"type_of_access\": \"VA\",\n \"count\": \"3383388\"\n
41
+ \ },\n {\n \"type_of_access\": \"AL\",\n \"count\":
42
+ \"28384\"\n },\n {\n \"type_of_access\": \"PE\",\n \"count\":
43
+ \"12\"\n },\n {\n \"type_of_access\": \"WO\",\n \"count\":
44
+ \"8\"\n },\n {\n \"type_of_access\": null,\n \"count\":
45
+ \"0\"\n }\n ]\n }\n}"
46
+ http_version:
47
+ recorded_at: Sun, 26 Jan 2014 21:29:06 GMT
48
+ recorded_with: VCR 2.8.0