ensconce 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +69 -0
- data/Rakefile +9 -0
- data/lib/ensconce.rb +10 -0
- data/lib/ensconce/adapters/adapter.rb +52 -0
- data/lib/ensconce/adapters/mydex_adapter.rb +75 -0
- data/lib/ensconce/adapters/yaml_file_adapter.rb +21 -0
- data/lib/ensconce/data_store.rb +41 -0
- data/lib/ensconce/hash_builder.rb +72 -0
- data/lib/ensconce/key_mappers/key_map.rb +35 -0
- data/lib/ensconce/key_mappers/mydex_key_map.rb +23 -0
- data/lib/ensconce/mangle.rb +31 -0
- data/lib/ensconce/version.rb +15 -0
- data/test/data/users.yml +9 -0
- data/test/ensconce/adapters/adapter_test.rb +22 -0
- data/test/ensconce/adapters/mydex_adapter_test.rb +49 -0
- data/test/ensconce/adapters/yaml_file_adapter_test.rb +31 -0
- data/test/ensconce/data_store_test.rb +72 -0
- data/test/ensconce/key_mappers/hash_builder_test.rb +102 -0
- data/test/ensconce/key_mappers/mydex_key_map_test.rb +20 -0
- data/test/ensconce/mangle_test.rb +25 -0
- data/test/fixtures/users.yml +9 -0
- data/test/fixtures/vcr_cassettes/datastore_after_mydex_adapter_test.yml +44 -0
- data/test/fixtures/vcr_cassettes/datastore_before_mydex_adapter_test.yml +85 -0
- data/test/fixtures/vcr_cassettes/datastore_get_Harry.yml +44 -0
- data/test/fixtures/vcr_cassettes/datastore_get_Mary.yml +44 -0
- data/test/fixtures/vcr_cassettes/datastore_get_Trevor.yml +44 -0
- data/test/fixtures/vcr_cassettes/datastore_push_Harry.yml +44 -0
- data/test/fixtures/vcr_cassettes/datastore_push_Mary.yml +44 -0
- data/test/fixtures/vcr_cassettes/datastore_push_Trevor.yml +44 -0
- data/test/fixtures/vcr_cassettes/datastore_test_get.yml +44 -0
- data/test/test_helper.rb +67 -0
- metadata +110 -0
@@ -0,0 +1,44 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://sbx-api.mydex.org/api/pds/pds/93.json?api_key=rN31O75AWviNYezE2vWsMDP6kS88Zc5P&con_id=93-1545&data_set=field_ds_personal_details&dataset=field_ds_personal_details&key=LlPwdnq38tMtCPP7u60HjTYy35MxAVkf&source_type=connection
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Faraday v0.8.6
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
14
|
+
Accept:
|
15
|
+
- ! '*/*'
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Server:
|
22
|
+
- nginx
|
23
|
+
Date:
|
24
|
+
- Mon, 17 Mar 2014 14:20:22 GMT
|
25
|
+
Content-Type:
|
26
|
+
- application/json
|
27
|
+
Transfer-Encoding:
|
28
|
+
- chunked
|
29
|
+
Connection:
|
30
|
+
- keep-alive
|
31
|
+
Expires:
|
32
|
+
- Sun, 19 Nov 1978 05:00:00 GMT
|
33
|
+
Last-Modified:
|
34
|
+
- Mon, 17 Mar 2014 14:20:22 +0000
|
35
|
+
Cache-Control:
|
36
|
+
- no-cache, must-revalidate, post-check=0, pre-check=0
|
37
|
+
Etag:
|
38
|
+
- ! '"1395066022"'
|
39
|
+
body:
|
40
|
+
encoding: US-ASCII
|
41
|
+
string: ! '{"field_ds_personal_details":{"instance_0":{"field_personal_faname":{"value":"","access":{"r":{"a":"1","s":"A"},"w":{"a":"1","s":"A"}}},"field_personal_fname":{"value":"Harry","access":{"r":{"a":"1","s":"A"},"w":{"a":"1","s":"A"}}},"field_personal_gender":{"value":"","access":{"r":{"a":"1","s":"A"},"w":{"a":"1","s":"A"}}},"field_personal_maname":{"value":"","access":{"r":{"a":"1","s":"A"},"w":{"a":"1","s":"A"}}},"field_personal_mname":{"value":"","access":{"r":{"a":"1","s":"A"},"w":{"a":"1","s":"A"}}},"field_personal_nickname":{"value":"","access":{"r":{"a":"1","s":"A"},"w":{"a":"1","s":"A"}}},"field_personal_suffix":{"value":"","access":{"r":{"a":"1","s":"A"},"w":{"a":"1","s":"A"}}},"field_personal_title":{"value":"","access":{"r":{"a":"1","s":"A"},"w":{"a":"1","s":"A"}}}}}}'
|
42
|
+
http_version:
|
43
|
+
recorded_at: Mon, 17 Mar 2014 14:20:27 GMT
|
44
|
+
recorded_with: VCR 2.4.0
|
@@ -0,0 +1,44 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://sbx-api.mydex.org/api/pds/pds/93.json?api_key=rN31O75AWviNYezE2vWsMDP6kS88Zc5P&con_id=93-1545&data_set=field_ds_personal_details&dataset=field_ds_personal_details&key=LlPwdnq38tMtCPP7u60HjTYy35MxAVkf&source_type=connection
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Faraday v0.8.6
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
14
|
+
Accept:
|
15
|
+
- ! '*/*'
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Server:
|
22
|
+
- nginx
|
23
|
+
Date:
|
24
|
+
- Mon, 17 Mar 2014 14:20:23 GMT
|
25
|
+
Content-Type:
|
26
|
+
- application/json
|
27
|
+
Transfer-Encoding:
|
28
|
+
- chunked
|
29
|
+
Connection:
|
30
|
+
- keep-alive
|
31
|
+
Expires:
|
32
|
+
- Sun, 19 Nov 1978 05:00:00 GMT
|
33
|
+
Last-Modified:
|
34
|
+
- Mon, 17 Mar 2014 14:20:23 +0000
|
35
|
+
Cache-Control:
|
36
|
+
- no-cache, must-revalidate, post-check=0, pre-check=0
|
37
|
+
Etag:
|
38
|
+
- ! '"1395066023"'
|
39
|
+
body:
|
40
|
+
encoding: US-ASCII
|
41
|
+
string: ! '{"field_ds_personal_details":{"instance_0":{"field_personal_faname":{"value":"","access":{"r":{"a":"1","s":"A"},"w":{"a":"1","s":"A"}}},"field_personal_fname":{"value":"Mary","access":{"r":{"a":"1","s":"A"},"w":{"a":"1","s":"A"}}},"field_personal_gender":{"value":"","access":{"r":{"a":"1","s":"A"},"w":{"a":"1","s":"A"}}},"field_personal_maname":{"value":"","access":{"r":{"a":"1","s":"A"},"w":{"a":"1","s":"A"}}},"field_personal_mname":{"value":"","access":{"r":{"a":"1","s":"A"},"w":{"a":"1","s":"A"}}},"field_personal_nickname":{"value":"","access":{"r":{"a":"1","s":"A"},"w":{"a":"1","s":"A"}}},"field_personal_suffix":{"value":"","access":{"r":{"a":"1","s":"A"},"w":{"a":"1","s":"A"}}},"field_personal_title":{"value":"","access":{"r":{"a":"1","s":"A"},"w":{"a":"1","s":"A"}}}}}}'
|
42
|
+
http_version:
|
43
|
+
recorded_at: Mon, 17 Mar 2014 14:20:28 GMT
|
44
|
+
recorded_with: VCR 2.4.0
|
@@ -0,0 +1,44 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://sbx-api.mydex.org/api/pds/pds/93.json?api_key=rN31O75AWviNYezE2vWsMDP6kS88Zc5P&con_id=93-1545&data_set=field_ds_personal_details&dataset=field_ds_personal_details&key=LlPwdnq38tMtCPP7u60HjTYy35MxAVkf&source_type=connection
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Faraday v0.8.6
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
14
|
+
Accept:
|
15
|
+
- ! '*/*'
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Server:
|
22
|
+
- nginx
|
23
|
+
Date:
|
24
|
+
- Mon, 17 Mar 2014 14:20:23 GMT
|
25
|
+
Content-Type:
|
26
|
+
- application/json
|
27
|
+
Transfer-Encoding:
|
28
|
+
- chunked
|
29
|
+
Connection:
|
30
|
+
- keep-alive
|
31
|
+
Expires:
|
32
|
+
- Sun, 19 Nov 1978 05:00:00 GMT
|
33
|
+
Last-Modified:
|
34
|
+
- Mon, 17 Mar 2014 14:20:23 +0000
|
35
|
+
Cache-Control:
|
36
|
+
- no-cache, must-revalidate, post-check=0, pre-check=0
|
37
|
+
Etag:
|
38
|
+
- ! '"1395066023"'
|
39
|
+
body:
|
40
|
+
encoding: US-ASCII
|
41
|
+
string: ! '{"field_ds_personal_details":{"instance_0":{"field_personal_faname":{"value":"","access":{"r":{"a":"1","s":"A"},"w":{"a":"1","s":"A"}}},"field_personal_fname":{"value":"Trevor","access":{"r":{"a":"1","s":"A"},"w":{"a":"1","s":"A"}}},"field_personal_gender":{"value":"","access":{"r":{"a":"1","s":"A"},"w":{"a":"1","s":"A"}}},"field_personal_maname":{"value":"","access":{"r":{"a":"1","s":"A"},"w":{"a":"1","s":"A"}}},"field_personal_mname":{"value":"","access":{"r":{"a":"1","s":"A"},"w":{"a":"1","s":"A"}}},"field_personal_nickname":{"value":"","access":{"r":{"a":"1","s":"A"},"w":{"a":"1","s":"A"}}},"field_personal_suffix":{"value":"","access":{"r":{"a":"1","s":"A"},"w":{"a":"1","s":"A"}}},"field_personal_title":{"value":"","access":{"r":{"a":"1","s":"A"},"w":{"a":"1","s":"A"}}}}}}'
|
42
|
+
http_version:
|
43
|
+
recorded_at: Mon, 17 Mar 2014 14:20:29 GMT
|
44
|
+
recorded_with: VCR 2.4.0
|
@@ -0,0 +1,44 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: put
|
5
|
+
uri: https://sbx-api.mydex.org/api/pds/pds/93.json?api_key=rN31O75AWviNYezE2vWsMDP6kS88Zc5P&con_id=93-1545&data_set=field_ds_personal_details&key=LlPwdnq38tMtCPP7u60HjTYy35MxAVkf&source_type=connection
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: ! '{"field_ds_personal_details":[{"field_personal_fname":"Harry","field_personal_faname":null,"field_personal_gender":null,"field_personal_maname":null,"field_personal_mname":null,"field_personal_nickname":null,"field_personal_suffix":null,"field_personal_title":null}]}'
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Faraday v0.8.6
|
12
|
+
Content-Type:
|
13
|
+
- application/json
|
14
|
+
Accept:
|
15
|
+
- ! '*/*'
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Server:
|
22
|
+
- nginx
|
23
|
+
Date:
|
24
|
+
- Mon, 17 Mar 2014 14:20:22 GMT
|
25
|
+
Content-Type:
|
26
|
+
- application/json
|
27
|
+
Transfer-Encoding:
|
28
|
+
- chunked
|
29
|
+
Connection:
|
30
|
+
- keep-alive
|
31
|
+
Expires:
|
32
|
+
- Sun, 19 Nov 1978 05:00:00 GMT
|
33
|
+
Last-Modified:
|
34
|
+
- Mon, 17 Mar 2014 14:20:21 +0000
|
35
|
+
Cache-Control:
|
36
|
+
- no-cache, must-revalidate, post-check=0, pre-check=0
|
37
|
+
Etag:
|
38
|
+
- ! '"1395066021"'
|
39
|
+
body:
|
40
|
+
encoding: US-ASCII
|
41
|
+
string: ! '{"success":1,"data":{"field_ds_personal_details":[{"field_personal_fname":"Harry","field_personal_faname":null,"field_personal_gender":null,"field_personal_maname":null,"field_personal_mname":null,"field_personal_nickname":null,"field_personal_suffix":null,"field_personal_title":null}]}}'
|
42
|
+
http_version:
|
43
|
+
recorded_at: Mon, 17 Mar 2014 14:20:27 GMT
|
44
|
+
recorded_with: VCR 2.4.0
|
@@ -0,0 +1,44 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: put
|
5
|
+
uri: https://sbx-api.mydex.org/api/pds/pds/93.json?api_key=rN31O75AWviNYezE2vWsMDP6kS88Zc5P&con_id=93-1545&data_set=field_ds_personal_details&key=LlPwdnq38tMtCPP7u60HjTYy35MxAVkf&source_type=connection
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: ! '{"field_ds_personal_details":[{"field_personal_fname":"Mary","field_personal_faname":null,"field_personal_gender":null,"field_personal_maname":null,"field_personal_mname":null,"field_personal_nickname":null,"field_personal_suffix":null,"field_personal_title":null}]}'
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Faraday v0.8.6
|
12
|
+
Content-Type:
|
13
|
+
- application/json
|
14
|
+
Accept:
|
15
|
+
- ! '*/*'
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Server:
|
22
|
+
- nginx
|
23
|
+
Date:
|
24
|
+
- Mon, 17 Mar 2014 14:20:22 GMT
|
25
|
+
Content-Type:
|
26
|
+
- application/json
|
27
|
+
Transfer-Encoding:
|
28
|
+
- chunked
|
29
|
+
Connection:
|
30
|
+
- keep-alive
|
31
|
+
Expires:
|
32
|
+
- Sun, 19 Nov 1978 05:00:00 GMT
|
33
|
+
Last-Modified:
|
34
|
+
- Mon, 17 Mar 2014 14:20:22 +0000
|
35
|
+
Cache-Control:
|
36
|
+
- no-cache, must-revalidate, post-check=0, pre-check=0
|
37
|
+
Etag:
|
38
|
+
- ! '"1395066022"'
|
39
|
+
body:
|
40
|
+
encoding: US-ASCII
|
41
|
+
string: ! '{"success":1,"data":{"field_ds_personal_details":[{"field_personal_fname":"Mary","field_personal_faname":null,"field_personal_gender":null,"field_personal_maname":null,"field_personal_mname":null,"field_personal_nickname":null,"field_personal_suffix":null,"field_personal_title":null}]}}'
|
42
|
+
http_version:
|
43
|
+
recorded_at: Mon, 17 Mar 2014 14:20:28 GMT
|
44
|
+
recorded_with: VCR 2.4.0
|
@@ -0,0 +1,44 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: put
|
5
|
+
uri: https://sbx-api.mydex.org/api/pds/pds/93.json?api_key=rN31O75AWviNYezE2vWsMDP6kS88Zc5P&con_id=93-1545&data_set=field_ds_personal_details&key=LlPwdnq38tMtCPP7u60HjTYy35MxAVkf&source_type=connection
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: ! '{"field_ds_personal_details":[{"field_personal_fname":"Trevor","field_personal_faname":null,"field_personal_gender":null,"field_personal_maname":null,"field_personal_mname":null,"field_personal_nickname":null,"field_personal_suffix":null,"field_personal_title":null}]}'
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Faraday v0.8.6
|
12
|
+
Content-Type:
|
13
|
+
- application/json
|
14
|
+
Accept:
|
15
|
+
- ! '*/*'
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Server:
|
22
|
+
- nginx
|
23
|
+
Date:
|
24
|
+
- Mon, 17 Mar 2014 14:20:23 GMT
|
25
|
+
Content-Type:
|
26
|
+
- application/json
|
27
|
+
Transfer-Encoding:
|
28
|
+
- chunked
|
29
|
+
Connection:
|
30
|
+
- keep-alive
|
31
|
+
Expires:
|
32
|
+
- Sun, 19 Nov 1978 05:00:00 GMT
|
33
|
+
Last-Modified:
|
34
|
+
- Mon, 17 Mar 2014 14:20:23 +0000
|
35
|
+
Cache-Control:
|
36
|
+
- no-cache, must-revalidate, post-check=0, pre-check=0
|
37
|
+
Etag:
|
38
|
+
- ! '"1395066023"'
|
39
|
+
body:
|
40
|
+
encoding: US-ASCII
|
41
|
+
string: ! '{"success":1,"data":{"field_ds_personal_details":[{"field_personal_fname":"Trevor","field_personal_faname":null,"field_personal_gender":null,"field_personal_maname":null,"field_personal_mname":null,"field_personal_nickname":null,"field_personal_suffix":null,"field_personal_title":null}]}}'
|
42
|
+
http_version:
|
43
|
+
recorded_at: Mon, 17 Mar 2014 14:20:29 GMT
|
44
|
+
recorded_with: VCR 2.4.0
|
@@ -0,0 +1,44 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://sbx-api.mydex.org/api/pds/pds/93.json?api_key=rN31O75AWviNYezE2vWsMDP6kS88Zc5P&con_id=93-1545&data_set=field_ds_personal_details&dataset=field_ds_personal_details&key=LlPwdnq38tMtCPP7u60HjTYy35MxAVkf&source_type=connection
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Faraday v0.8.6
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
14
|
+
Accept:
|
15
|
+
- ! '*/*'
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Server:
|
22
|
+
- nginx
|
23
|
+
Date:
|
24
|
+
- Mon, 17 Mar 2014 14:20:21 GMT
|
25
|
+
Content-Type:
|
26
|
+
- application/json
|
27
|
+
Transfer-Encoding:
|
28
|
+
- chunked
|
29
|
+
Connection:
|
30
|
+
- keep-alive
|
31
|
+
Expires:
|
32
|
+
- Sun, 19 Nov 1978 05:00:00 GMT
|
33
|
+
Last-Modified:
|
34
|
+
- Mon, 17 Mar 2014 14:20:21 +0000
|
35
|
+
Cache-Control:
|
36
|
+
- no-cache, must-revalidate, post-check=0, pre-check=0
|
37
|
+
Etag:
|
38
|
+
- ! '"1395066021"'
|
39
|
+
body:
|
40
|
+
encoding: US-ASCII
|
41
|
+
string: ! '{"field_ds_personal_details":{"instance_0":{"field_personal_faname":{"value":"","access":{"r":{"a":"1","s":"A"},"w":{"a":"1","s":"A"}}},"field_personal_fname":{"value":"Gillian","access":{"r":{"a":"1","s":"A"},"w":{"a":"1","s":"A"}}},"field_personal_gender":{"value":"","access":{"r":{"a":"1","s":"A"},"w":{"a":"1","s":"A"}}},"field_personal_maname":{"value":"","access":{"r":{"a":"1","s":"A"},"w":{"a":"1","s":"A"}}},"field_personal_mname":{"value":"","access":{"r":{"a":"1","s":"A"},"w":{"a":"1","s":"A"}}},"field_personal_nickname":{"value":"","access":{"r":{"a":"1","s":"A"},"w":{"a":"1","s":"A"}}},"field_personal_suffix":{"value":"","access":{"r":{"a":"1","s":"A"},"w":{"a":"1","s":"A"}}},"field_personal_title":{"value":"","access":{"r":{"a":"1","s":"A"},"w":{"a":"1","s":"A"}}}}}}'
|
42
|
+
http_version:
|
43
|
+
recorded_at: Mon, 17 Mar 2014 14:20:27 GMT
|
44
|
+
recorded_with: VCR 2.4.0
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require_relative '../lib/ensconce'
|
3
|
+
require 'yaml'
|
4
|
+
require 'fileutils'
|
5
|
+
require 'vcr'
|
6
|
+
|
7
|
+
# VCR records HTTP requests and replays them on future test. Speeds up testing
|
8
|
+
# and removes dependency on remote app being working and available during tests.
|
9
|
+
# However, they should be reset as required.
|
10
|
+
VCR.configure do |c|
|
11
|
+
cassette_path = 'fixtures/vcr_cassettes' # Remove files in this folder to reset vcr
|
12
|
+
c.cassette_library_dir = File.expand_path(cassette_path, File.dirname(__FILE__))
|
13
|
+
c.hook_into :webmock # or :fakeweb
|
14
|
+
end
|
15
|
+
|
16
|
+
class Test::Unit::TestCase
|
17
|
+
private
|
18
|
+
def fixture_path(element = nil)
|
19
|
+
add_element_to_relative_path element, 'fixtures'
|
20
|
+
end
|
21
|
+
|
22
|
+
def data_path(element = nil)
|
23
|
+
add_element_to_relative_path element, 'data'
|
24
|
+
end
|
25
|
+
|
26
|
+
def add_element_to_relative_path(element, relative_path)
|
27
|
+
path = []
|
28
|
+
path << File.expand_path(relative_path, File.dirname(__FILE__))
|
29
|
+
path << "#{element}.yml" if element
|
30
|
+
path.join('/')
|
31
|
+
end
|
32
|
+
|
33
|
+
def fixture
|
34
|
+
@fixture ||= load_fixtures
|
35
|
+
end
|
36
|
+
|
37
|
+
def load_fixtures
|
38
|
+
output = {}
|
39
|
+
fixtures = %w{users}
|
40
|
+
fixtures.each do |name|
|
41
|
+
template = fixture_path(name)
|
42
|
+
destination = data_path(name)
|
43
|
+
FileUtils.copy template, destination
|
44
|
+
output[name] = YAML.load_file template
|
45
|
+
end
|
46
|
+
return output
|
47
|
+
end
|
48
|
+
|
49
|
+
def current_data_for(name)
|
50
|
+
YAML.load_file data_path(name)
|
51
|
+
end
|
52
|
+
|
53
|
+
def settings
|
54
|
+
YAML.load_file File.expand_path('../settings.yml', File.dirname(__FILE__))
|
55
|
+
end
|
56
|
+
|
57
|
+
class TestUser
|
58
|
+
attr_accessor :key, :id, :con_id
|
59
|
+
|
60
|
+
def initialize(args = {})
|
61
|
+
@key = args[:key]
|
62
|
+
@id = args[:id]
|
63
|
+
@con_id = args[:con_id]
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
metadata
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ensconce
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Rob Nichols
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-03-17 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: faraday
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ! '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ! '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
description: Wraps connections to Personal Data Stores, to allow data stores to changed.
|
28
|
+
For example, to aid testing or swap data store provider
|
29
|
+
email:
|
30
|
+
- rob@undervale.co.uk
|
31
|
+
executables: []
|
32
|
+
extensions: []
|
33
|
+
extra_rdoc_files: []
|
34
|
+
files:
|
35
|
+
- lib/ensconce.rb
|
36
|
+
- lib/ensconce/hash_builder.rb
|
37
|
+
- lib/ensconce/version.rb
|
38
|
+
- lib/ensconce/key_mappers/key_map.rb
|
39
|
+
- lib/ensconce/key_mappers/mydex_key_map.rb
|
40
|
+
- lib/ensconce/adapters/yaml_file_adapter.rb
|
41
|
+
- lib/ensconce/adapters/adapter.rb
|
42
|
+
- lib/ensconce/adapters/mydex_adapter.rb
|
43
|
+
- lib/ensconce/data_store.rb
|
44
|
+
- lib/ensconce/mangle.rb
|
45
|
+
- MIT-LICENSE
|
46
|
+
- Rakefile
|
47
|
+
- README.rdoc
|
48
|
+
- test/fixtures/vcr_cassettes/datastore_push_Mary.yml
|
49
|
+
- test/fixtures/vcr_cassettes/datastore_push_Trevor.yml
|
50
|
+
- test/fixtures/vcr_cassettes/datastore_get_Mary.yml
|
51
|
+
- test/fixtures/vcr_cassettes/datastore_before_mydex_adapter_test.yml
|
52
|
+
- test/fixtures/vcr_cassettes/datastore_push_Harry.yml
|
53
|
+
- test/fixtures/vcr_cassettes/datastore_test_get.yml
|
54
|
+
- test/fixtures/vcr_cassettes/datastore_get_Trevor.yml
|
55
|
+
- test/fixtures/vcr_cassettes/datastore_after_mydex_adapter_test.yml
|
56
|
+
- test/fixtures/vcr_cassettes/datastore_get_Harry.yml
|
57
|
+
- test/fixtures/users.yml
|
58
|
+
- test/data/users.yml
|
59
|
+
- test/ensconce/key_mappers/mydex_key_map_test.rb
|
60
|
+
- test/ensconce/key_mappers/hash_builder_test.rb
|
61
|
+
- test/ensconce/adapters/mydex_adapter_test.rb
|
62
|
+
- test/ensconce/adapters/yaml_file_adapter_test.rb
|
63
|
+
- test/ensconce/adapters/adapter_test.rb
|
64
|
+
- test/ensconce/mangle_test.rb
|
65
|
+
- test/ensconce/data_store_test.rb
|
66
|
+
- test/test_helper.rb
|
67
|
+
homepage: https://github.com/reggieb/ensconce
|
68
|
+
licenses:
|
69
|
+
- MIT-LICENSE
|
70
|
+
metadata: {}
|
71
|
+
post_install_message:
|
72
|
+
rdoc_options: []
|
73
|
+
require_paths:
|
74
|
+
- lib
|
75
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
77
|
+
- - ! '>='
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '0'
|
80
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - ! '>='
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '0'
|
85
|
+
requirements: []
|
86
|
+
rubyforge_project:
|
87
|
+
rubygems_version: 2.1.10
|
88
|
+
signing_key:
|
89
|
+
specification_version: 4
|
90
|
+
summary: Personal Data Store Wrapper.
|
91
|
+
test_files:
|
92
|
+
- test/fixtures/vcr_cassettes/datastore_push_Mary.yml
|
93
|
+
- test/fixtures/vcr_cassettes/datastore_push_Trevor.yml
|
94
|
+
- test/fixtures/vcr_cassettes/datastore_get_Mary.yml
|
95
|
+
- test/fixtures/vcr_cassettes/datastore_before_mydex_adapter_test.yml
|
96
|
+
- test/fixtures/vcr_cassettes/datastore_push_Harry.yml
|
97
|
+
- test/fixtures/vcr_cassettes/datastore_test_get.yml
|
98
|
+
- test/fixtures/vcr_cassettes/datastore_get_Trevor.yml
|
99
|
+
- test/fixtures/vcr_cassettes/datastore_after_mydex_adapter_test.yml
|
100
|
+
- test/fixtures/vcr_cassettes/datastore_get_Harry.yml
|
101
|
+
- test/fixtures/users.yml
|
102
|
+
- test/data/users.yml
|
103
|
+
- test/ensconce/key_mappers/mydex_key_map_test.rb
|
104
|
+
- test/ensconce/key_mappers/hash_builder_test.rb
|
105
|
+
- test/ensconce/adapters/mydex_adapter_test.rb
|
106
|
+
- test/ensconce/adapters/yaml_file_adapter_test.rb
|
107
|
+
- test/ensconce/adapters/adapter_test.rb
|
108
|
+
- test/ensconce/mangle_test.rb
|
109
|
+
- test/ensconce/data_store_test.rb
|
110
|
+
- test/test_helper.rb
|