formhub_ruby 0.0.6.1 → 0.0.7.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 95753893821c1be2a8456e22fb70499992484a8d
4
- data.tar.gz: a847323a8e96ec51dfa6137f75204c50d987dcc9
3
+ metadata.gz: 9dd9257d4957e47651feddee8bf252f9bc2016a8
4
+ data.tar.gz: 6c18c95b97b1a04edc3523614056a6d8b6acd37a
5
5
  SHA512:
6
- metadata.gz: eab39d6ce6bb0b1de0a1302102913c47cc32b4a867f4ff4c9b374c74530644301c0e2ac69d1ff8394af193503dd9fdf73f934b9c626eb9eef1a6e64a0545208b
7
- data.tar.gz: eff1f2671954992df3408fc050f52f716ae113d4c95d37260363bebac0142f7fadd37f687dbe8dbee48f6fcd6711a03d8ced9bf8486a6c088e673b6bd7a124ba
6
+ metadata.gz: ea762170cedbcb0790cda3554d57de631c6e45313e8af33dbf702ba09135a8d148799f3c332e54548ac8519af5c9f38d3edafa2e738e26d53052d452f476f7dd
7
+ data.tar.gz: 14dde1a2d40a6566a4d78c618c762134a3c515841b082e2ddb0bd6d04d27a4b61585bb5724dde2493052b55f0f1aa02a53164d83ae824ae74a081562a8d4b8ff
data/README.md CHANGED
@@ -28,7 +28,7 @@ More details on their JSON API can be foud on their [wiki page]( https://github.
28
28
 
29
29
  Create a connection like so:
30
30
 
31
- connection = FormhubRuby::API.new(username: 'fake_username', password: 'fake_password', formnamne: 'my_form_name' )
31
+ connection = FormhubRuby::ApiConnector.new(username: 'fake_username', password: 'fake_password', formnamne: 'my_form_name' )
32
32
 
33
33
  You can also pass authentification configuration arguments in a block (e.g. in a initializer file, etc...):
34
34
 
@@ -72,6 +72,12 @@ Finally you can also sort the results: 1 denotes an ascending sort while -1 den
72
72
 
73
73
  As far as I could tell though, the integers seem to be stored as strings in the Formhub database, so the sorting of these would be quite irrelevant.
74
74
 
75
+ Also consequently added: a parameter to cast integers types:
76
+
77
+ connection.cast_integers = true # false by default
78
+
79
+ Be aware that this will also cast float values to integer values.
80
+
75
81
 
76
82
  ## Contributing
77
83
 
@@ -6,7 +6,7 @@ require 'addressable/uri'
6
6
  module FormhubRuby
7
7
  class ApiConnector
8
8
  attr_reader :formname, :filetype, :username, :password, :data
9
- attr_accessor :query, :start, :limit, :sort, :fields
9
+ attr_accessor :query, :start, :limit, :sort, :fields, :cast_integers
10
10
 
11
11
 
12
12
  def initialize(args)
@@ -19,6 +19,7 @@ module FormhubRuby
19
19
  @limit = args[:limit]
20
20
  @sort = args[:sort]
21
21
  @fields = args[:fields]
22
+ @cast_integers = args[:cast_integers] || false
22
23
  @data = []
23
24
  end
24
25
 
@@ -45,7 +46,15 @@ module FormhubRuby
45
46
  end
46
47
 
47
48
  begin
48
- @data = JSON.parse(response.body)
49
+ returned_data = JSON.parse(response.body)
50
+ @data = if @cast_integers
51
+ returned_data.map do |row|
52
+ Hash[ row.map { |a, b| [a, cast_to_value_to_int(b)] } ]
53
+ end
54
+ else
55
+ returned_data
56
+ end
57
+
49
58
  rescue
50
59
  raise 'API connection error'
51
60
  end
@@ -115,7 +124,14 @@ module FormhubRuby
115
124
 
116
125
  end
117
126
 
118
- # end
127
+ def cast_to_value_to_int(str)
128
+ begin
129
+ Integer(str)
130
+ rescue ArgumentError, TypeError
131
+ str
132
+ end
133
+ end
134
+
119
135
  end
120
136
  end
121
137
 
@@ -1,3 +1,3 @@
1
1
  module FormhubRuby
2
- VERSION = '0.0.6.1'
2
+ VERSION = '0.0.7.1'
3
3
  end
@@ -12,10 +12,23 @@ describe FormhubRuby::ApiConnector do
12
12
  config.password = credentials['password'] || 'fake'
13
13
  end
14
14
  end
15
+
16
+ let(:connection) {FormhubRuby::ApiConnector.new(formname: 'survey')}
17
+ let(:username) {FormhubRuby.configuration.username}
15
18
 
16
19
 
17
20
  context 'when connecting to the API' do
18
21
 
22
+ it 'appropriately converts data cast as strings in Formhub back to integers' do
23
+ connection.query = {age: 18}
24
+ connection.cast_integers = true
25
+
26
+ expect(connection.api_uri).to eq("http://formhub.org/#{username}/forms/survey/api?query=%7B%22age%22%3A%2218%22%7D")
27
+ VCR.use_cassette 'get_integer' do
28
+ connection.fetch
29
+ expect(connection.data.first['age']).to be_an(Integer)
30
+ end
31
+ end
19
32
 
20
33
  it 'successfully connects to the FormHub API and retrieve JSON Data' do
21
34
  VCR.use_cassette 'successful_connection' do
@@ -35,8 +48,7 @@ describe FormhubRuby::ApiConnector do
35
48
 
36
49
  context 'when formulating a more complex query string' do
37
50
 
38
- let(:connection) {FormhubRuby::ApiConnector.new(formname: 'survey')}
39
- let(:username) {FormhubRuby.configuration.username}
51
+
40
52
 
41
53
  it "does not add any extraneaous query" do
42
54
  connection = FormhubRuby::ApiConnector.new(formname: 'survey')
@@ -44,9 +56,9 @@ describe FormhubRuby::ApiConnector do
44
56
  end
45
57
 
46
58
  it "does form a simple query" do
47
- connection.query = {age: 12}
59
+ connection.query = {age: 18}
48
60
 
49
- expect(connection.api_uri).to eq("http://formhub.org/#{username}/forms/survey/api?query=%7B%22age%22%3A%2212%22%7D")
61
+ expect(connection.api_uri).to eq("http://formhub.org/#{username}/forms/survey/api?query=%7B%22age%22%3A%2218%22%7D")
50
62
  VCR.use_cassette 'age_query' do
51
63
  connection.fetch
52
64
  expect(connection.data.length).to eq(1)
@@ -108,7 +120,6 @@ describe FormhubRuby::ApiConnector do
108
120
  it "only retrieve the selected fields" do
109
121
 
110
122
  connection.fields = [:name, :age]
111
- puts connection.api_uri
112
123
 
113
124
  VCR.use_cassette "retrieve_selected_fields_only" do
114
125
  connection.fetch
@@ -2,7 +2,7 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: get
5
- uri: http://<USERNAME>:<PASSWORD>@formhub.org/<USERNAME>/forms/survey/api?query=%7B%22age%22:%2212%22%7D
5
+ uri: http://<USERNAME>:<PASSWORD>@formhub.org/<USERNAME>/forms/survey/api?query=%7B%22age%22:%2218%22%7D
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
@@ -21,7 +21,7 @@ http_interactions:
21
21
  message: OK
22
22
  headers:
23
23
  Date:
24
- - Mon, 02 Jun 2014 11:09:53 GMT
24
+ - Tue, 10 Jun 2014 11:44:01 GMT
25
25
  Content-Type:
26
26
  - application/json
27
27
  Transfer-Encoding:
@@ -37,7 +37,7 @@ http_interactions:
37
37
  Vary:
38
38
  - Accept-Language, Cookie
39
39
  Etag:
40
- - "\"a8b3103fef34948c7ead4c8335e29543\""
40
+ - "\"4d9f2b49b87df6c35521c3af5cb4a5b2\""
41
41
  Access-Control-Allow-Origin:
42
42
  - "*"
43
43
  Access-Control-Allow-Methods:
@@ -46,15 +46,15 @@ http_interactions:
46
46
  - max-age=31536000
47
47
  body:
48
48
  encoding: UTF-8
49
- string: "[{\"meta/instanceID\": \"uuid:be1b882a-b377-4cf0-95d3-c2acc8d04e7a\",
50
- \"name\": \"georges\", \"_submission_time\": \"2014-05-15T16:29:00\", \"age\":
51
- \"12\", \"_uuid\": \"be1b882a-b377-4cf0-95d3-c2acc8d04e7a\", \"_bamboo_dataset_id\":
52
- \"\", \"_tags\": [], \"_attachments\": [], \"_geolocation\": [null, null],
53
- \"end_time\": \"2014-05-15T17:28:59.000+01:00\", \"_xform_id_string\": \"survey\",
54
- \"imei\": \"enketo.formhub.org:fSucCmZ5zwzNcTe1\", \"phonenumber\": \"no phonenumber
55
- property in enketo\", \"_status\": \"submitted_via_web\", \"_id\": 3318651,
56
- \"start_time\": \"2014-05-15T17:28:43.000+01:00\", \"today\": \"2014-05-15\",
57
- \"formhub/uuid\": \"1bfb7222748a4ee98106ea7d7a9c72cf\"}]"
49
+ string: "[{\"meta/instanceID\": \"uuid:d7ea1e0f-c3b6-4e1b-9f5d-8ebb88c03e94\",
50
+ \"name\": \"georges\", \"formhub/uuid\": \"1bfb7222748a4ee98106ea7d7a9c72cf\",
51
+ \"_submission_time\": \"2014-05-15T16:29:00\", \"age\": \"18\", \"_uuid\":
52
+ \"d7ea1e0f-c3b6-4e1b-9f5d-8ebb88c03e94\", \"_bamboo_dataset_id\": \"\", \"_tags\":
53
+ [], \"_attachments\": [], \"_geolocation\": [null, null], \"end_time\": \"2014-06-10T12:24:34.000+01:00\",
54
+ \"_xform_id_string\": \"survey\", \"imei\": \"enketo.formhub.org:fSucCmZ5zwzNcTe1\",
55
+ \"phonenumber\": \"no phonenumber property in enketo\", \"_status\": \"submitted_via_web\",
56
+ \"_id\": 3318651, \"start_time\": \"2014-05-15T17:28:43.000+01:00\", \"today\":
57
+ \"2014-05-15\", \"meta/deprecatedID\": \"uuid:be1b882a-b377-4cf0-95d3-c2acc8d04e7a\"}]"
58
58
  http_version:
59
- recorded_at: Mon, 02 Jun 2014 11:09:53 GMT
59
+ recorded_at: Tue, 10 Jun 2014 11:44:01 GMT
60
60
  recorded_with: VCR 2.9.0
@@ -0,0 +1,60 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://<USERNAME>:<PASSWORD>@formhub.org/<USERNAME>/forms/survey/api?query=%7B%22age%22:%2218%22%7D
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ Host:
17
+ - formhub.org
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Date:
24
+ - Tue, 10 Jun 2014 11:44:00 GMT
25
+ Content-Type:
26
+ - application/json
27
+ Transfer-Encoding:
28
+ - chunked
29
+ Connection:
30
+ - keep-alive
31
+ Server:
32
+ - gunicorn/0.15.0
33
+ Access-Control-Allow-Headers:
34
+ - Accept, Origin, X-Requested-With, Authorization
35
+ Content-Language:
36
+ - en-us
37
+ Vary:
38
+ - Accept-Language, Cookie
39
+ Etag:
40
+ - "\"4d9f2b49b87df6c35521c3af5cb4a5b2\""
41
+ Access-Control-Allow-Origin:
42
+ - "*"
43
+ Access-Control-Allow-Methods:
44
+ - GET
45
+ Strict-Transport-Security:
46
+ - max-age=31536000
47
+ body:
48
+ encoding: UTF-8
49
+ string: "[{\"meta/instanceID\": \"uuid:d7ea1e0f-c3b6-4e1b-9f5d-8ebb88c03e94\",
50
+ \"name\": \"georges\", \"formhub/uuid\": \"1bfb7222748a4ee98106ea7d7a9c72cf\",
51
+ \"_submission_time\": \"2014-05-15T16:29:00\", \"age\": \"18\", \"_uuid\":
52
+ \"d7ea1e0f-c3b6-4e1b-9f5d-8ebb88c03e94\", \"_bamboo_dataset_id\": \"\", \"_tags\":
53
+ [], \"_attachments\": [], \"_geolocation\": [null, null], \"end_time\": \"2014-06-10T12:24:34.000+01:00\",
54
+ \"_xform_id_string\": \"survey\", \"imei\": \"enketo.formhub.org:fSucCmZ5zwzNcTe1\",
55
+ \"phonenumber\": \"no phonenumber property in enketo\", \"_status\": \"submitted_via_web\",
56
+ \"_id\": 3318651, \"start_time\": \"2014-05-15T17:28:43.000+01:00\", \"today\":
57
+ \"2014-05-15\", \"meta/deprecatedID\": \"uuid:be1b882a-b377-4cf0-95d3-c2acc8d04e7a\"}]"
58
+ http_version:
59
+ recorded_at: Tue, 10 Jun 2014 11:44:00 GMT
60
+ recorded_with: VCR 2.9.0
@@ -21,7 +21,7 @@ http_interactions:
21
21
  message: OK
22
22
  headers:
23
23
  Date:
24
- - Thu, 29 May 2014 15:28:33 GMT
24
+ - Tue, 10 Jun 2014 11:44:03 GMT
25
25
  Content-Type:
26
26
  - application/json
27
27
  Transfer-Encoding:
@@ -48,5 +48,5 @@ http_interactions:
48
48
  encoding: UTF-8
49
49
  string: "[{\"count\": 4}]"
50
50
  http_version:
51
- recorded_at: Thu, 29 May 2014 15:28:43 GMT
51
+ recorded_at: Tue, 10 Jun 2014 11:44:02 GMT
52
52
  recorded_with: VCR 2.9.0
@@ -21,7 +21,7 @@ http_interactions:
21
21
  message: OK
22
22
  headers:
23
23
  Date:
24
- - Thu, 29 May 2014 15:28:31 GMT
24
+ - Tue, 10 Jun 2014 11:44:02 GMT
25
25
  Content-Type:
26
26
  - application/json
27
27
  Transfer-Encoding:
@@ -56,5 +56,5 @@ http_interactions:
56
56
  \"submitted_via_web\", \"_id\": 3413156, \"pizza_fan\": \"no\", \"today\":
57
57
  \"2014-05-29\", \"formhub/uuid\": \"1bfb7222748a4ee98106ea7d7a9c72cf\"}]"
58
58
  http_version:
59
- recorded_at: Thu, 29 May 2014 15:28:41 GMT
59
+ recorded_at: Tue, 10 Jun 2014 11:44:01 GMT
60
60
  recorded_with: VCR 2.9.0
@@ -21,7 +21,7 @@ http_interactions:
21
21
  message: OK
22
22
  headers:
23
23
  Date:
24
- - Thu, 29 May 2014 15:28:31 GMT
24
+ - Tue, 10 Jun 2014 11:44:01 GMT
25
25
  Content-Type:
26
26
  - application/json
27
27
  Transfer-Encoding:
@@ -37,7 +37,7 @@ http_interactions:
37
37
  Vary:
38
38
  - Accept-Language, Cookie
39
39
  Etag:
40
- - "\"ce11c6a0cd553a81e77d3553380fe14d\""
40
+ - "\"a56d09c1a1d5fbee7e2709a146630dea\""
41
41
  Access-Control-Allow-Origin:
42
42
  - "*"
43
43
  Access-Control-Allow-Methods:
@@ -46,33 +46,33 @@ http_interactions:
46
46
  - max-age=31536000
47
47
  body:
48
48
  encoding: UTF-8
49
- string: "[{\"meta/instanceID\": \"uuid:be1b882a-b377-4cf0-95d3-c2acc8d04e7a\",
50
- \"name\": \"georges\", \"_submission_time\": \"2014-05-15T16:29:00\", \"age\":
51
- \"12\", \"_uuid\": \"be1b882a-b377-4cf0-95d3-c2acc8d04e7a\", \"_bamboo_dataset_id\":
52
- \"\", \"_tags\": [], \"_attachments\": [], \"_geolocation\": [null, null],
53
- \"end_time\": \"2014-05-15T17:28:59.000+01:00\", \"_xform_id_string\": \"survey\",
54
- \"imei\": \"enketo.formhub.org:fSucCmZ5zwzNcTe1\", \"phonenumber\": \"no phonenumber
55
- property in enketo\", \"_status\": \"submitted_via_web\", \"_id\": 3318651,
56
- \"start_time\": \"2014-05-15T17:28:43.000+01:00\", \"today\": \"2014-05-15\",
57
- \"formhub/uuid\": \"1bfb7222748a4ee98106ea7d7a9c72cf\"}, {\"meta/instanceID\":
58
- \"uuid:2aebfa29-6284-4c3a-9c3f-6eb604f89194\", \"age\": \"23\", \"name\":
59
- \"loic\", \"_submission_time\": \"2014-05-15T16:28:19\", \"start_time\": \"2014-05-15T17:27:57.000+01:00\",
60
- \"_uuid\": \"2aebfa29-6284-4c3a-9c3f-6eb604f89194\", \"_bamboo_dataset_id\":
61
- \"\", \"_tags\": [], \"_attachments\": [], \"imei\": \"enketo.formhub.org:fSucCmZ5zwzNcTe1\",
62
- \"_geolocation\": [null, null], \"end_time\": \"2014-05-15T17:28:18.000+01:00\",
63
- \"gender\": \"female\", \"_xform_id_string\": \"survey\", \"phonenumber\":
64
- \"no phonenumber property in enketo\", \"_status\": \"submitted_via_web\",
65
- \"_id\": 3318647, \"pizza_fan\": \"no\", \"today\": \"2014-05-15\", \"formhub/uuid\":
66
- \"1bfb7222748a4ee98106ea7d7a9c72cf\"}, {\"_bamboo_dataset_id\": \"\", \"_tags\":
67
- [], \"pizza_type\": \"chitown\", \"phonenumber\": \"no phonenumber property
68
- in enketo\", \"_xform_id_string\": \"survey\", \"meta/instanceID\": \"uuid:d85cf54e-ecf9-4b0a-b9dd-600f3dd69460\",
69
- \"pizza_fan\": \"yes\", \"favorite_toppings\": \"pepperoni sausauge\", \"_attachments\":
70
- [], \"_status\": \"submitted_via_web\", \"today\": \"2014-05-29\", \"start_time\":
71
- \"2014-05-29T14:53:31.000+01:00\", \"_uuid\": \"d85cf54e-ecf9-4b0a-b9dd-600f3dd69460\",
72
- \"imei\": \"enketo.formhub.org:fSucCmZ5zwzNcTe1\", \"formhub/uuid\": \"1bfb7222748a4ee98106ea7d7a9c72cf\",
73
- \"name\": \"Robert\", \"_submission_time\": \"2014-05-29T13:55:41\", \"age\":
74
- \"100\", \"_geolocation\": [null, null], \"end_time\": \"2014-05-29T14:53:58.000+01:00\",
75
- \"gender\": \"male\", \"_id\": 3413155}]"
49
+ string: "[{\"meta/instanceID\": \"uuid:2aebfa29-6284-4c3a-9c3f-6eb604f89194\",
50
+ \"age\": \"23\", \"name\": \"loic\", \"_submission_time\": \"2014-05-15T16:28:19\",
51
+ \"start_time\": \"2014-05-15T17:27:57.000+01:00\", \"_uuid\": \"2aebfa29-6284-4c3a-9c3f-6eb604f89194\",
52
+ \"_bamboo_dataset_id\": \"\", \"_tags\": [], \"_attachments\": [], \"imei\":
53
+ \"enketo.formhub.org:fSucCmZ5zwzNcTe1\", \"_geolocation\": [null, null], \"end_time\":
54
+ \"2014-05-15T17:28:18.000+01:00\", \"gender\": \"female\", \"_xform_id_string\":
55
+ \"survey\", \"phonenumber\": \"no phonenumber property in enketo\", \"_status\":
56
+ \"submitted_via_web\", \"_id\": 3318647, \"pizza_fan\": \"no\", \"today\":
57
+ \"2014-05-15\", \"formhub/uuid\": \"1bfb7222748a4ee98106ea7d7a9c72cf\"}, {\"_bamboo_dataset_id\":
58
+ \"\", \"_tags\": [], \"pizza_type\": \"chitown\", \"phonenumber\": \"no phonenumber
59
+ property in enketo\", \"_xform_id_string\": \"survey\", \"meta/instanceID\":
60
+ \"uuid:d85cf54e-ecf9-4b0a-b9dd-600f3dd69460\", \"pizza_fan\": \"yes\", \"favorite_toppings\":
61
+ \"pepperoni sausauge\", \"_attachments\": [], \"_status\": \"submitted_via_web\",
62
+ \"today\": \"2014-05-29\", \"start_time\": \"2014-05-29T14:53:31.000+01:00\",
63
+ \"_uuid\": \"d85cf54e-ecf9-4b0a-b9dd-600f3dd69460\", \"imei\": \"enketo.formhub.org:fSucCmZ5zwzNcTe1\",
64
+ \"formhub/uuid\": \"1bfb7222748a4ee98106ea7d7a9c72cf\", \"name\": \"Robert\",
65
+ \"_submission_time\": \"2014-05-29T13:55:41\", \"age\": \"100\", \"_geolocation\":
66
+ [null, null], \"end_time\": \"2014-05-29T14:53:58.000+01:00\", \"gender\":
67
+ \"male\", \"_id\": 3413155}, {\"meta/instanceID\": \"uuid:d7ea1e0f-c3b6-4e1b-9f5d-8ebb88c03e94\",
68
+ \"name\": \"georges\", \"formhub/uuid\": \"1bfb7222748a4ee98106ea7d7a9c72cf\",
69
+ \"_submission_time\": \"2014-05-15T16:29:00\", \"age\": \"18\", \"_uuid\":
70
+ \"d7ea1e0f-c3b6-4e1b-9f5d-8ebb88c03e94\", \"_bamboo_dataset_id\": \"\", \"_tags\":
71
+ [], \"_attachments\": [], \"_geolocation\": [null, null], \"end_time\": \"2014-06-10T12:24:34.000+01:00\",
72
+ \"_xform_id_string\": \"survey\", \"imei\": \"enketo.formhub.org:fSucCmZ5zwzNcTe1\",
73
+ \"phonenumber\": \"no phonenumber property in enketo\", \"_status\": \"submitted_via_web\",
74
+ \"_id\": 3318651, \"start_time\": \"2014-05-15T17:28:43.000+01:00\", \"today\":
75
+ \"2014-05-15\", \"meta/deprecatedID\": \"uuid:be1b882a-b377-4cf0-95d3-c2acc8d04e7a\"}]"
76
76
  http_version:
77
- recorded_at: Thu, 29 May 2014 15:28:41 GMT
77
+ recorded_at: Tue, 10 Jun 2014 11:44:01 GMT
78
78
  recorded_with: VCR 2.9.0
@@ -21,7 +21,7 @@ http_interactions:
21
21
  message: OK
22
22
  headers:
23
23
  Date:
24
- - Thu, 29 May 2014 15:28:32 GMT
24
+ - Tue, 10 Jun 2014 11:44:02 GMT
25
25
  Content-Type:
26
26
  - application/json
27
27
  Transfer-Encoding:
@@ -37,7 +37,7 @@ http_interactions:
37
37
  Vary:
38
38
  - Accept-Language, Cookie
39
39
  Etag:
40
- - "\"a8b3103fef34948c7ead4c8335e29543\""
40
+ - "\"cca3b5eba43f81971965707f51c4882b\""
41
41
  Access-Control-Allow-Origin:
42
42
  - "*"
43
43
  Access-Control-Allow-Methods:
@@ -46,15 +46,15 @@ http_interactions:
46
46
  - max-age=31536000
47
47
  body:
48
48
  encoding: UTF-8
49
- string: "[{\"meta/instanceID\": \"uuid:be1b882a-b377-4cf0-95d3-c2acc8d04e7a\",
50
- \"name\": \"georges\", \"_submission_time\": \"2014-05-15T16:29:00\", \"age\":
51
- \"12\", \"_uuid\": \"be1b882a-b377-4cf0-95d3-c2acc8d04e7a\", \"_bamboo_dataset_id\":
52
- \"\", \"_tags\": [], \"_attachments\": [], \"_geolocation\": [null, null],
53
- \"end_time\": \"2014-05-15T17:28:59.000+01:00\", \"_xform_id_string\": \"survey\",
54
- \"imei\": \"enketo.formhub.org:fSucCmZ5zwzNcTe1\", \"phonenumber\": \"no phonenumber
55
- property in enketo\", \"_status\": \"submitted_via_web\", \"_id\": 3318651,
56
- \"start_time\": \"2014-05-15T17:28:43.000+01:00\", \"today\": \"2014-05-15\",
57
- \"formhub/uuid\": \"1bfb7222748a4ee98106ea7d7a9c72cf\"}]"
49
+ string: "[{\"meta/instanceID\": \"uuid:2aebfa29-6284-4c3a-9c3f-6eb604f89194\",
50
+ \"age\": \"23\", \"name\": \"loic\", \"_submission_time\": \"2014-05-15T16:28:19\",
51
+ \"start_time\": \"2014-05-15T17:27:57.000+01:00\", \"_uuid\": \"2aebfa29-6284-4c3a-9c3f-6eb604f89194\",
52
+ \"_bamboo_dataset_id\": \"\", \"_tags\": [], \"_attachments\": [], \"imei\":
53
+ \"enketo.formhub.org:fSucCmZ5zwzNcTe1\", \"_geolocation\": [null, null], \"end_time\":
54
+ \"2014-05-15T17:28:18.000+01:00\", \"gender\": \"female\", \"_xform_id_string\":
55
+ \"survey\", \"phonenumber\": \"no phonenumber property in enketo\", \"_status\":
56
+ \"submitted_via_web\", \"_id\": 3318647, \"pizza_fan\": \"no\", \"today\":
57
+ \"2014-05-15\", \"formhub/uuid\": \"1bfb7222748a4ee98106ea7d7a9c72cf\"}]"
58
58
  http_version:
59
- recorded_at: Thu, 29 May 2014 15:28:42 GMT
59
+ recorded_at: Tue, 10 Jun 2014 11:44:02 GMT
60
60
  recorded_with: VCR 2.9.0
@@ -21,7 +21,7 @@ http_interactions:
21
21
  message: OK
22
22
  headers:
23
23
  Date:
24
- - Mon, 02 Jun 2014 11:53:49 GMT
24
+ - Tue, 10 Jun 2014 11:44:03 GMT
25
25
  Content-Type:
26
26
  - application/json
27
27
  Transfer-Encoding:
@@ -37,7 +37,7 @@ http_interactions:
37
37
  Vary:
38
38
  - Accept-Language, Cookie
39
39
  Etag:
40
- - "\"28b1d13b897184580960f6691040cc94\""
40
+ - "\"be4dbf299020d3a4ac8c3915eb607f29\""
41
41
  Access-Control-Allow-Origin:
42
42
  - "*"
43
43
  Access-Control-Allow-Methods:
@@ -47,9 +47,9 @@ http_interactions:
47
47
  body:
48
48
  encoding: UTF-8
49
49
  string: "[{\"age\": \"15\", \"_id\": 3413156, \"name\": \"napol\\u00e9on\"},
50
- {\"age\": \"12\", \"_id\": 3318651, \"name\": \"georges\"}, {\"age\": \"23\",
51
- \"_id\": 3318647, \"name\": \"loic\"}, {\"age\": \"100\", \"_id\": 3413155,
52
- \"name\": \"Robert\"}]"
50
+ {\"age\": \"23\", \"_id\": 3318647, \"name\": \"loic\"}, {\"age\": \"100\",
51
+ \"_id\": 3413155, \"name\": \"Robert\"}, {\"age\": \"18\", \"_id\": 3318651,
52
+ \"name\": \"georges\"}]"
53
53
  http_version:
54
- recorded_at: Mon, 02 Jun 2014 11:53:49 GMT
54
+ recorded_at: Tue, 10 Jun 2014 11:44:03 GMT
55
55
  recorded_with: VCR 2.9.0
@@ -21,7 +21,7 @@ http_interactions:
21
21
  message: OK
22
22
  headers:
23
23
  Date:
24
- - Mon, 02 Jun 2014 11:37:40 GMT
24
+ - Tue, 10 Jun 2014 11:44:03 GMT
25
25
  Content-Type:
26
26
  - application/json
27
27
  Transfer-Encoding:
@@ -37,7 +37,7 @@ http_interactions:
37
37
  Vary:
38
38
  - Accept-Language, Cookie
39
39
  Etag:
40
- - "\"f9b8d47fed9e7bad4df95ec530fd7134\""
40
+ - "\"b9052a99235c49d7488fc7fb869069ce\""
41
41
  Access-Control-Allow-Origin:
42
42
  - "*"
43
43
  Access-Control-Allow-Methods:
@@ -63,25 +63,25 @@ http_interactions:
63
63
  \"gender\": \"female\", \"_xform_id_string\": \"survey\", \"phonenumber\":
64
64
  \"no phonenumber property in enketo\", \"_status\": \"submitted_via_web\",
65
65
  \"_id\": 3318647, \"pizza_fan\": \"no\", \"today\": \"2014-05-15\", \"formhub/uuid\":
66
- \"1bfb7222748a4ee98106ea7d7a9c72cf\"}, {\"meta/instanceID\": \"uuid:be1b882a-b377-4cf0-95d3-c2acc8d04e7a\",
67
- \"name\": \"georges\", \"_submission_time\": \"2014-05-15T16:29:00\", \"age\":
68
- \"12\", \"_uuid\": \"be1b882a-b377-4cf0-95d3-c2acc8d04e7a\", \"_bamboo_dataset_id\":
69
- \"\", \"_tags\": [], \"_attachments\": [], \"_geolocation\": [null, null],
70
- \"end_time\": \"2014-05-15T17:28:59.000+01:00\", \"_xform_id_string\": \"survey\",
71
- \"imei\": \"enketo.formhub.org:fSucCmZ5zwzNcTe1\", \"phonenumber\": \"no phonenumber
72
- property in enketo\", \"_status\": \"submitted_via_web\", \"_id\": 3318651,
73
- \"start_time\": \"2014-05-15T17:28:43.000+01:00\", \"today\": \"2014-05-15\",
74
- \"formhub/uuid\": \"1bfb7222748a4ee98106ea7d7a9c72cf\"}, {\"_bamboo_dataset_id\":
75
- \"\", \"_tags\": [], \"pizza_type\": \"chitown\", \"phonenumber\": \"no phonenumber
76
- property in enketo\", \"_xform_id_string\": \"survey\", \"meta/instanceID\":
77
- \"uuid:d85cf54e-ecf9-4b0a-b9dd-600f3dd69460\", \"pizza_fan\": \"yes\", \"favorite_toppings\":
78
- \"pepperoni sausauge\", \"_attachments\": [], \"_status\": \"submitted_via_web\",
79
- \"today\": \"2014-05-29\", \"start_time\": \"2014-05-29T14:53:31.000+01:00\",
80
- \"_uuid\": \"d85cf54e-ecf9-4b0a-b9dd-600f3dd69460\", \"imei\": \"enketo.formhub.org:fSucCmZ5zwzNcTe1\",
81
- \"formhub/uuid\": \"1bfb7222748a4ee98106ea7d7a9c72cf\", \"name\": \"Robert\",
82
- \"_submission_time\": \"2014-05-29T13:55:41\", \"age\": \"100\", \"_geolocation\":
83
- [null, null], \"end_time\": \"2014-05-29T14:53:58.000+01:00\", \"gender\":
84
- \"male\", \"_id\": 3413155}]"
66
+ \"1bfb7222748a4ee98106ea7d7a9c72cf\"}, {\"meta/instanceID\": \"uuid:d7ea1e0f-c3b6-4e1b-9f5d-8ebb88c03e94\",
67
+ \"name\": \"georges\", \"formhub/uuid\": \"1bfb7222748a4ee98106ea7d7a9c72cf\",
68
+ \"_submission_time\": \"2014-05-15T16:29:00\", \"age\": \"18\", \"_uuid\":
69
+ \"d7ea1e0f-c3b6-4e1b-9f5d-8ebb88c03e94\", \"_bamboo_dataset_id\": \"\", \"_tags\":
70
+ [], \"_attachments\": [], \"_geolocation\": [null, null], \"end_time\": \"2014-06-10T12:24:34.000+01:00\",
71
+ \"_xform_id_string\": \"survey\", \"imei\": \"enketo.formhub.org:fSucCmZ5zwzNcTe1\",
72
+ \"phonenumber\": \"no phonenumber property in enketo\", \"_status\": \"submitted_via_web\",
73
+ \"_id\": 3318651, \"start_time\": \"2014-05-15T17:28:43.000+01:00\", \"today\":
74
+ \"2014-05-15\", \"meta/deprecatedID\": \"uuid:be1b882a-b377-4cf0-95d3-c2acc8d04e7a\"},
75
+ {\"_bamboo_dataset_id\": \"\", \"_tags\": [], \"pizza_type\": \"chitown\",
76
+ \"phonenumber\": \"no phonenumber property in enketo\", \"_xform_id_string\":
77
+ \"survey\", \"meta/instanceID\": \"uuid:d85cf54e-ecf9-4b0a-b9dd-600f3dd69460\",
78
+ \"pizza_fan\": \"yes\", \"favorite_toppings\": \"pepperoni sausauge\", \"_attachments\":
79
+ [], \"_status\": \"submitted_via_web\", \"today\": \"2014-05-29\", \"start_time\":
80
+ \"2014-05-29T14:53:31.000+01:00\", \"_uuid\": \"d85cf54e-ecf9-4b0a-b9dd-600f3dd69460\",
81
+ \"imei\": \"enketo.formhub.org:fSucCmZ5zwzNcTe1\", \"formhub/uuid\": \"1bfb7222748a4ee98106ea7d7a9c72cf\",
82
+ \"name\": \"Robert\", \"_submission_time\": \"2014-05-29T13:55:41\", \"age\":
83
+ \"100\", \"_geolocation\": [null, null], \"end_time\": \"2014-05-29T14:53:58.000+01:00\",
84
+ \"gender\": \"male\", \"_id\": 3413155}]"
85
85
  http_version:
86
- recorded_at: Mon, 02 Jun 2014 11:37:39 GMT
86
+ recorded_at: Tue, 10 Jun 2014 11:44:03 GMT
87
87
  recorded_with: VCR 2.9.0
@@ -21,7 +21,7 @@ http_interactions:
21
21
  message: OK
22
22
  headers:
23
23
  Date:
24
- - Thu, 29 May 2014 15:28:29 GMT
24
+ - Tue, 10 Jun 2014 11:44:00 GMT
25
25
  Content-Type:
26
26
  - application/json
27
27
  Transfer-Encoding:
@@ -37,7 +37,7 @@ http_interactions:
37
37
  Vary:
38
38
  - Accept-Language, Cookie
39
39
  Etag:
40
- - "\"4baf3432bbeb6cd2b3425cf06e7158ef\""
40
+ - "\"6008f8fc8f44f724d04791fa10719cc9\""
41
41
  Access-Control-Allow-Origin:
42
42
  - "*"
43
43
  Access-Control-Allow-Methods:
@@ -55,14 +55,6 @@ http_interactions:
55
55
  \"survey\", \"phonenumber\": \"no phonenumber property in enketo\", \"_status\":
56
56
  \"submitted_via_web\", \"_id\": 3413156, \"pizza_fan\": \"no\", \"today\":
57
57
  \"2014-05-29\", \"formhub/uuid\": \"1bfb7222748a4ee98106ea7d7a9c72cf\"}, {\"meta/instanceID\":
58
- \"uuid:be1b882a-b377-4cf0-95d3-c2acc8d04e7a\", \"name\": \"georges\", \"_submission_time\":
59
- \"2014-05-15T16:29:00\", \"age\": \"12\", \"_uuid\": \"be1b882a-b377-4cf0-95d3-c2acc8d04e7a\",
60
- \"_bamboo_dataset_id\": \"\", \"_tags\": [], \"_attachments\": [], \"_geolocation\":
61
- [null, null], \"end_time\": \"2014-05-15T17:28:59.000+01:00\", \"_xform_id_string\":
62
- \"survey\", \"imei\": \"enketo.formhub.org:fSucCmZ5zwzNcTe1\", \"phonenumber\":
63
- \"no phonenumber property in enketo\", \"_status\": \"submitted_via_web\",
64
- \"_id\": 3318651, \"start_time\": \"2014-05-15T17:28:43.000+01:00\", \"today\":
65
- \"2014-05-15\", \"formhub/uuid\": \"1bfb7222748a4ee98106ea7d7a9c72cf\"}, {\"meta/instanceID\":
66
58
  \"uuid:2aebfa29-6284-4c3a-9c3f-6eb604f89194\", \"age\": \"23\", \"name\":
67
59
  \"loic\", \"_submission_time\": \"2014-05-15T16:28:19\", \"start_time\": \"2014-05-15T17:27:57.000+01:00\",
68
60
  \"_uuid\": \"2aebfa29-6284-4c3a-9c3f-6eb604f89194\", \"_bamboo_dataset_id\":
@@ -80,7 +72,15 @@ http_interactions:
80
72
  \"imei\": \"enketo.formhub.org:fSucCmZ5zwzNcTe1\", \"formhub/uuid\": \"1bfb7222748a4ee98106ea7d7a9c72cf\",
81
73
  \"name\": \"Robert\", \"_submission_time\": \"2014-05-29T13:55:41\", \"age\":
82
74
  \"100\", \"_geolocation\": [null, null], \"end_time\": \"2014-05-29T14:53:58.000+01:00\",
83
- \"gender\": \"male\", \"_id\": 3413155}]"
75
+ \"gender\": \"male\", \"_id\": 3413155}, {\"meta/instanceID\": \"uuid:d7ea1e0f-c3b6-4e1b-9f5d-8ebb88c03e94\",
76
+ \"name\": \"georges\", \"formhub/uuid\": \"1bfb7222748a4ee98106ea7d7a9c72cf\",
77
+ \"_submission_time\": \"2014-05-15T16:29:00\", \"age\": \"18\", \"_uuid\":
78
+ \"d7ea1e0f-c3b6-4e1b-9f5d-8ebb88c03e94\", \"_bamboo_dataset_id\": \"\", \"_tags\":
79
+ [], \"_attachments\": [], \"_geolocation\": [null, null], \"end_time\": \"2014-06-10T12:24:34.000+01:00\",
80
+ \"_xform_id_string\": \"survey\", \"imei\": \"enketo.formhub.org:fSucCmZ5zwzNcTe1\",
81
+ \"phonenumber\": \"no phonenumber property in enketo\", \"_status\": \"submitted_via_web\",
82
+ \"_id\": 3318651, \"start_time\": \"2014-05-15T17:28:43.000+01:00\", \"today\":
83
+ \"2014-05-15\", \"meta/deprecatedID\": \"uuid:be1b882a-b377-4cf0-95d3-c2acc8d04e7a\"}]"
84
84
  http_version:
85
- recorded_at: Thu, 29 May 2014 15:28:39 GMT
85
+ recorded_at: Tue, 10 Jun 2014 11:44:00 GMT
86
86
  recorded_with: VCR 2.9.0
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: formhub_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6.1
4
+ version: 0.0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Loïc Seigland
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-02 00:00:00.000000000 Z
11
+ date: 2014-06-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -198,8 +198,8 @@ files:
198
198
  - lib/formhub_ruby/configuration.rb
199
199
  - lib/formhub_ruby/version.rb
200
200
  - spec/api_connectior_spec.rb
201
- - spec/client_spec.rb
202
201
  - spec/fixtures/vcr_cassettes/age_query.yml
202
+ - spec/fixtures/vcr_cassettes/get_integer.yml
203
203
  - spec/fixtures/vcr_cassettes/just_get_the_count.yml
204
204
  - spec/fixtures/vcr_cassettes/query_limit.yml
205
205
  - spec/fixtures/vcr_cassettes/query_start.yml
@@ -234,8 +234,8 @@ specification_version: 4
234
234
  summary: Simple Client for the Formhub API
235
235
  test_files:
236
236
  - spec/api_connectior_spec.rb
237
- - spec/client_spec.rb
238
237
  - spec/fixtures/vcr_cassettes/age_query.yml
238
+ - spec/fixtures/vcr_cassettes/get_integer.yml
239
239
  - spec/fixtures/vcr_cassettes/just_get_the_count.yml
240
240
  - spec/fixtures/vcr_cassettes/query_limit.yml
241
241
  - spec/fixtures/vcr_cassettes/query_start.yml
data/spec/client_spec.rb DELETED
File without changes