twfy 1.1.0 → 1.1.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.
- checksums.yaml +4 -4
- data/.ruby-version +1 -0
- data/.travis.yml +1 -2
- data/lib/twfy.rb +1 -1
- data/lib/twfy/api.rb +1 -1
- data/lib/twfy/mp.rb +1 -1
- data/lib/twfy/version.rb +1 -1
- data/test/fixtures/vcr_cassettes/Twfy_Client/constituencies/works.yml +436 -0
- data/test/fixtures/vcr_cassettes/Twfy_Client/constituency/works.yml +46 -0
- data/test/fixtures/vcr_cassettes/Twfy_Client/convert_url/works.yml +44 -0
- data/test/fixtures/vcr_cassettes/Twfy_Client/geometry/works.yml +88 -0
- data/test/fixtures/vcr_cassettes/Twfy_Client/mp_and_mp_info/works.yml +607 -0
- data/test/fixtures/vcr_cassettes/Twfy_Client/mps/works.yml +4174 -0
- data/test/fixtures/vcr_cassettes/Twfy_Client/msps/works.yml +191 -0
- data/test/fixtures/vcr_cassettes/Twfy_DataElement/is_equivalent_to_use_a_simple_chain_or_direct_call.yml +1163 -0
- data/test/fixtures/vcr_cassettes/Twfy_DataElement/works_for_a_reflexive_chain.yml +99 -0
- data/test/fixtures/vcr_cassettes/Twfy_DataElement/works_for_a_round_trip_chain.yml +99 -0
- data/test/fixtures/vcr_cassettes/Twfy_DataElement/works_for_a_single_chain.yml +51 -0
- data/test/fixtures/vcr_cassettes/Twfy_DataElement/works_for_an_overkill_chain.yml +141 -0
- data/test/lib/twfy/client_test.rb +59 -38
- data/test/lib/twfy/data_element_test.rb +45 -42
- data/test/test_helper.rb +8 -15
- data/twfy.gemspec +3 -1
- metadata +76 -27
- data/test/fixtures/vcr_cassettes/client_test.yml +0 -2723
- data/test/fixtures/vcr_cassettes/data_element_test.yml +0 -240
@@ -0,0 +1,99 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://www.theyworkforyou.com/api/getMP?key=<API_KEY>&postcode=IP6%209PN&version=1.0.0
|
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
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Server:
|
22
|
+
- nginx
|
23
|
+
Date:
|
24
|
+
- Tue, 26 Jul 2016 02:48:06 GMT
|
25
|
+
Content-Type:
|
26
|
+
- text/javascript; charset=iso-8859-1
|
27
|
+
Content-Length:
|
28
|
+
- '917'
|
29
|
+
Connection:
|
30
|
+
- keep-alive
|
31
|
+
Access-Control-Allow-Origin:
|
32
|
+
- "*"
|
33
|
+
Last-Modified:
|
34
|
+
- Fri, 08 May 2015 06:57:04 +0100
|
35
|
+
X-Url:
|
36
|
+
- "/api/getMP?postcode=IP6+9PN&key=<API_KEY>&version=1.0.0"
|
37
|
+
Accept-Ranges:
|
38
|
+
- bytes
|
39
|
+
Age:
|
40
|
+
- '0'
|
41
|
+
body:
|
42
|
+
encoding: UTF-8
|
43
|
+
string: '{"member_id":"41191","house":"1","constituency":"Central Suffolk and
|
44
|
+
North Ipswich","party":"Conservative","entered_house":"2015-05-08","left_house":"9999-12-31","entered_reason":"general_election","left_reason":"still_in_office","person_id":"24756","lastupdate":"2015-05-08
|
45
|
+
06:57:04","title":"","given_name":"Daniel","family_name":"Poulter","full_name":"Daniel
|
46
|
+
Poulter","url":"/mp/24756/daniel_poulter/central_suffolk_and_north_ipswich","image":"/images/mpsL/24756.jpeg","image_height":118,"image_width":78,"office":[{"moffice_id":"uk.parliament.data/Member/3932/Committee/50","dept":"Energy
|
47
|
+
and Climate Change Committee","position":"Member","from_date":"2015-07-08","to_date":"9999-12-31","person":"24756","source":""},{"moffice_id":"uk.parliament.data/Member/3932/Committee/136","dept":"Scottish
|
48
|
+
Affairs Committee","position":"Member","from_date":"2015-07-06","to_date":"9999-12-31","person":"24756","source":""}]}'
|
49
|
+
http_version:
|
50
|
+
recorded_at: Tue, 26 Jul 2016 02:48:06 GMT
|
51
|
+
- request:
|
52
|
+
method: get
|
53
|
+
uri: https://www.theyworkforyou.com/api/getMP?constituency=Central%20Suffolk%20and%20North%20Ipswich&key=<API_KEY>&version=1.0.0
|
54
|
+
body:
|
55
|
+
encoding: US-ASCII
|
56
|
+
string: ''
|
57
|
+
headers:
|
58
|
+
Accept-Encoding:
|
59
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
60
|
+
Accept:
|
61
|
+
- "*/*"
|
62
|
+
User-Agent:
|
63
|
+
- Ruby
|
64
|
+
response:
|
65
|
+
status:
|
66
|
+
code: 200
|
67
|
+
message: OK
|
68
|
+
headers:
|
69
|
+
Server:
|
70
|
+
- nginx
|
71
|
+
Date:
|
72
|
+
- Tue, 26 Jul 2016 02:48:07 GMT
|
73
|
+
Content-Type:
|
74
|
+
- text/javascript; charset=iso-8859-1
|
75
|
+
Content-Length:
|
76
|
+
- '917'
|
77
|
+
Connection:
|
78
|
+
- keep-alive
|
79
|
+
Access-Control-Allow-Origin:
|
80
|
+
- "*"
|
81
|
+
Last-Modified:
|
82
|
+
- Fri, 08 May 2015 06:57:04 +0100
|
83
|
+
X-Url:
|
84
|
+
- "/api/getMP?constituency=Central+Suffolk+and+North+Ipswich&key=<API_KEY>&version=1.0.0"
|
85
|
+
Accept-Ranges:
|
86
|
+
- bytes
|
87
|
+
Age:
|
88
|
+
- '0'
|
89
|
+
body:
|
90
|
+
encoding: UTF-8
|
91
|
+
string: '{"member_id":"41191","house":"1","constituency":"Central Suffolk and
|
92
|
+
North Ipswich","party":"Conservative","entered_house":"2015-05-08","left_house":"9999-12-31","entered_reason":"general_election","left_reason":"still_in_office","person_id":"24756","lastupdate":"2015-05-08
|
93
|
+
06:57:04","title":"","given_name":"Daniel","family_name":"Poulter","full_name":"Daniel
|
94
|
+
Poulter","url":"/mp/24756/daniel_poulter/central_suffolk_and_north_ipswich","image":"/images/mpsL/24756.jpeg","image_height":118,"image_width":78,"office":[{"moffice_id":"uk.parliament.data/Member/3932/Committee/50","dept":"Energy
|
95
|
+
and Climate Change Committee","position":"Member","from_date":"2015-07-08","to_date":"9999-12-31","person":"24756","source":""},{"moffice_id":"uk.parliament.data/Member/3932/Committee/136","dept":"Scottish
|
96
|
+
Affairs Committee","position":"Member","from_date":"2015-07-06","to_date":"9999-12-31","person":"24756","source":""}]}'
|
97
|
+
http_version:
|
98
|
+
recorded_at: Tue, 26 Jul 2016 02:48:07 GMT
|
99
|
+
recorded_with: VCR 3.0.3
|
@@ -0,0 +1,99 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://www.theyworkforyou.com/api/getMP?key=<API_KEY>&postcode=IP6%209PN&version=1.0.0
|
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
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Server:
|
22
|
+
- nginx
|
23
|
+
Date:
|
24
|
+
- Tue, 26 Jul 2016 02:48:09 GMT
|
25
|
+
Content-Type:
|
26
|
+
- text/javascript; charset=iso-8859-1
|
27
|
+
Content-Length:
|
28
|
+
- '917'
|
29
|
+
Connection:
|
30
|
+
- keep-alive
|
31
|
+
Access-Control-Allow-Origin:
|
32
|
+
- "*"
|
33
|
+
Last-Modified:
|
34
|
+
- Fri, 08 May 2015 06:57:04 +0100
|
35
|
+
X-Url:
|
36
|
+
- "/api/getMP?postcode=IP6+9PN&key=<API_KEY>&version=1.0.0"
|
37
|
+
Accept-Ranges:
|
38
|
+
- bytes
|
39
|
+
Age:
|
40
|
+
- '4'
|
41
|
+
body:
|
42
|
+
encoding: UTF-8
|
43
|
+
string: '{"member_id":"41191","house":"1","constituency":"Central Suffolk and
|
44
|
+
North Ipswich","party":"Conservative","entered_house":"2015-05-08","left_house":"9999-12-31","entered_reason":"general_election","left_reason":"still_in_office","person_id":"24756","lastupdate":"2015-05-08
|
45
|
+
06:57:04","title":"","given_name":"Daniel","family_name":"Poulter","full_name":"Daniel
|
46
|
+
Poulter","url":"/mp/24756/daniel_poulter/central_suffolk_and_north_ipswich","image":"/images/mpsL/24756.jpeg","image_height":118,"image_width":78,"office":[{"moffice_id":"uk.parliament.data/Member/3932/Committee/50","dept":"Energy
|
47
|
+
and Climate Change Committee","position":"Member","from_date":"2015-07-08","to_date":"9999-12-31","person":"24756","source":""},{"moffice_id":"uk.parliament.data/Member/3932/Committee/136","dept":"Scottish
|
48
|
+
Affairs Committee","position":"Member","from_date":"2015-07-06","to_date":"9999-12-31","person":"24756","source":""}]}'
|
49
|
+
http_version:
|
50
|
+
recorded_at: Tue, 26 Jul 2016 02:48:09 GMT
|
51
|
+
- request:
|
52
|
+
method: get
|
53
|
+
uri: https://www.theyworkforyou.com/api/getMP?constituency=Central%20Suffolk%20and%20North%20Ipswich&key=<API_KEY>&version=1.0.0
|
54
|
+
body:
|
55
|
+
encoding: US-ASCII
|
56
|
+
string: ''
|
57
|
+
headers:
|
58
|
+
Accept-Encoding:
|
59
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
60
|
+
Accept:
|
61
|
+
- "*/*"
|
62
|
+
User-Agent:
|
63
|
+
- Ruby
|
64
|
+
response:
|
65
|
+
status:
|
66
|
+
code: 200
|
67
|
+
message: OK
|
68
|
+
headers:
|
69
|
+
Server:
|
70
|
+
- nginx
|
71
|
+
Date:
|
72
|
+
- Tue, 26 Jul 2016 02:48:10 GMT
|
73
|
+
Content-Type:
|
74
|
+
- text/javascript; charset=iso-8859-1
|
75
|
+
Content-Length:
|
76
|
+
- '917'
|
77
|
+
Connection:
|
78
|
+
- keep-alive
|
79
|
+
Access-Control-Allow-Origin:
|
80
|
+
- "*"
|
81
|
+
Last-Modified:
|
82
|
+
- Fri, 08 May 2015 06:57:04 +0100
|
83
|
+
X-Url:
|
84
|
+
- "/api/getMP?constituency=Central+Suffolk+and+North+Ipswich&key=<API_KEY>&version=1.0.0"
|
85
|
+
Accept-Ranges:
|
86
|
+
- bytes
|
87
|
+
Age:
|
88
|
+
- '3'
|
89
|
+
body:
|
90
|
+
encoding: UTF-8
|
91
|
+
string: '{"member_id":"41191","house":"1","constituency":"Central Suffolk and
|
92
|
+
North Ipswich","party":"Conservative","entered_house":"2015-05-08","left_house":"9999-12-31","entered_reason":"general_election","left_reason":"still_in_office","person_id":"24756","lastupdate":"2015-05-08
|
93
|
+
06:57:04","title":"","given_name":"Daniel","family_name":"Poulter","full_name":"Daniel
|
94
|
+
Poulter","url":"/mp/24756/daniel_poulter/central_suffolk_and_north_ipswich","image":"/images/mpsL/24756.jpeg","image_height":118,"image_width":78,"office":[{"moffice_id":"uk.parliament.data/Member/3932/Committee/50","dept":"Energy
|
95
|
+
and Climate Change Committee","position":"Member","from_date":"2015-07-08","to_date":"9999-12-31","person":"24756","source":""},{"moffice_id":"uk.parliament.data/Member/3932/Committee/136","dept":"Scottish
|
96
|
+
Affairs Committee","position":"Member","from_date":"2015-07-06","to_date":"9999-12-31","person":"24756","source":""}]}'
|
97
|
+
http_version:
|
98
|
+
recorded_at: Tue, 26 Jul 2016 02:48:11 GMT
|
99
|
+
recorded_with: VCR 3.0.3
|
@@ -0,0 +1,51 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://www.theyworkforyou.com/api/getMP?key=<API_KEY>&postcode=IP6%209PN&version=1.0.0
|
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
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Server:
|
22
|
+
- nginx
|
23
|
+
Date:
|
24
|
+
- Tue, 26 Jul 2016 02:48:08 GMT
|
25
|
+
Content-Type:
|
26
|
+
- text/javascript; charset=iso-8859-1
|
27
|
+
Content-Length:
|
28
|
+
- '917'
|
29
|
+
Connection:
|
30
|
+
- keep-alive
|
31
|
+
Access-Control-Allow-Origin:
|
32
|
+
- "*"
|
33
|
+
Last-Modified:
|
34
|
+
- Fri, 08 May 2015 06:57:04 +0100
|
35
|
+
X-Url:
|
36
|
+
- "/api/getMP?postcode=IP6+9PN&key=<API_KEY>&version=1.0.0"
|
37
|
+
Accept-Ranges:
|
38
|
+
- bytes
|
39
|
+
Age:
|
40
|
+
- '3'
|
41
|
+
body:
|
42
|
+
encoding: UTF-8
|
43
|
+
string: '{"member_id":"41191","house":"1","constituency":"Central Suffolk and
|
44
|
+
North Ipswich","party":"Conservative","entered_house":"2015-05-08","left_house":"9999-12-31","entered_reason":"general_election","left_reason":"still_in_office","person_id":"24756","lastupdate":"2015-05-08
|
45
|
+
06:57:04","title":"","given_name":"Daniel","family_name":"Poulter","full_name":"Daniel
|
46
|
+
Poulter","url":"/mp/24756/daniel_poulter/central_suffolk_and_north_ipswich","image":"/images/mpsL/24756.jpeg","image_height":118,"image_width":78,"office":[{"moffice_id":"uk.parliament.data/Member/3932/Committee/50","dept":"Energy
|
47
|
+
and Climate Change Committee","position":"Member","from_date":"2015-07-08","to_date":"9999-12-31","person":"24756","source":""},{"moffice_id":"uk.parliament.data/Member/3932/Committee/136","dept":"Scottish
|
48
|
+
Affairs Committee","position":"Member","from_date":"2015-07-06","to_date":"9999-12-31","person":"24756","source":""}]}'
|
49
|
+
http_version:
|
50
|
+
recorded_at: Tue, 26 Jul 2016 02:48:08 GMT
|
51
|
+
recorded_with: VCR 3.0.3
|
@@ -0,0 +1,141 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://www.theyworkforyou.com/api/getMP?key=<API_KEY>&postcode=IP6%209PN&version=1.0.0
|
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
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Server:
|
22
|
+
- nginx
|
23
|
+
Date:
|
24
|
+
- Tue, 26 Jul 2016 02:48:11 GMT
|
25
|
+
Content-Type:
|
26
|
+
- text/javascript; charset=iso-8859-1
|
27
|
+
Content-Length:
|
28
|
+
- '917'
|
29
|
+
Connection:
|
30
|
+
- keep-alive
|
31
|
+
Access-Control-Allow-Origin:
|
32
|
+
- "*"
|
33
|
+
Last-Modified:
|
34
|
+
- Fri, 08 May 2015 06:57:04 +0100
|
35
|
+
X-Url:
|
36
|
+
- "/api/getMP?postcode=IP6+9PN&key=<API_KEY>&version=1.0.0"
|
37
|
+
Accept-Ranges:
|
38
|
+
- bytes
|
39
|
+
Age:
|
40
|
+
- '0'
|
41
|
+
body:
|
42
|
+
encoding: UTF-8
|
43
|
+
string: '{"member_id":"41191","house":"1","constituency":"Central Suffolk and
|
44
|
+
North Ipswich","party":"Conservative","entered_house":"2015-05-08","left_house":"9999-12-31","entered_reason":"general_election","left_reason":"still_in_office","person_id":"24756","lastupdate":"2015-05-08
|
45
|
+
06:57:04","title":"","given_name":"Daniel","family_name":"Poulter","full_name":"Daniel
|
46
|
+
Poulter","url":"/mp/24756/daniel_poulter/central_suffolk_and_north_ipswich","image":"/images/mpsL/24756.jpeg","image_height":118,"image_width":78,"office":[{"moffice_id":"uk.parliament.data/Member/3932/Committee/50","dept":"Energy
|
47
|
+
and Climate Change Committee","position":"Member","from_date":"2015-07-08","to_date":"9999-12-31","person":"24756","source":""},{"moffice_id":"uk.parliament.data/Member/3932/Committee/136","dept":"Scottish
|
48
|
+
Affairs Committee","position":"Member","from_date":"2015-07-06","to_date":"9999-12-31","person":"24756","source":""}]}'
|
49
|
+
http_version:
|
50
|
+
recorded_at: Tue, 26 Jul 2016 02:48:11 GMT
|
51
|
+
- request:
|
52
|
+
method: get
|
53
|
+
uri: https://www.theyworkforyou.com/api/getMP?constituency=Central%20Suffolk%20and%20North%20Ipswich&key=<API_KEY>&version=1.0.0
|
54
|
+
body:
|
55
|
+
encoding: US-ASCII
|
56
|
+
string: ''
|
57
|
+
headers:
|
58
|
+
Accept-Encoding:
|
59
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
60
|
+
Accept:
|
61
|
+
- "*/*"
|
62
|
+
User-Agent:
|
63
|
+
- Ruby
|
64
|
+
response:
|
65
|
+
status:
|
66
|
+
code: 200
|
67
|
+
message: OK
|
68
|
+
headers:
|
69
|
+
Server:
|
70
|
+
- nginx
|
71
|
+
Date:
|
72
|
+
- Tue, 26 Jul 2016 02:48:12 GMT
|
73
|
+
Content-Type:
|
74
|
+
- text/javascript; charset=iso-8859-1
|
75
|
+
Content-Length:
|
76
|
+
- '917'
|
77
|
+
Connection:
|
78
|
+
- keep-alive
|
79
|
+
Access-Control-Allow-Origin:
|
80
|
+
- "*"
|
81
|
+
Last-Modified:
|
82
|
+
- Fri, 08 May 2015 06:57:04 +0100
|
83
|
+
X-Url:
|
84
|
+
- "/api/getMP?constituency=Central+Suffolk+and+North+Ipswich&key=<API_KEY>&version=1.0.0"
|
85
|
+
Accept-Ranges:
|
86
|
+
- bytes
|
87
|
+
Age:
|
88
|
+
- '0'
|
89
|
+
body:
|
90
|
+
encoding: UTF-8
|
91
|
+
string: '{"member_id":"41191","house":"1","constituency":"Central Suffolk and
|
92
|
+
North Ipswich","party":"Conservative","entered_house":"2015-05-08","left_house":"9999-12-31","entered_reason":"general_election","left_reason":"still_in_office","person_id":"24756","lastupdate":"2015-05-08
|
93
|
+
06:57:04","title":"","given_name":"Daniel","family_name":"Poulter","full_name":"Daniel
|
94
|
+
Poulter","url":"/mp/24756/daniel_poulter/central_suffolk_and_north_ipswich","image":"/images/mpsL/24756.jpeg","image_height":118,"image_width":78,"office":[{"moffice_id":"uk.parliament.data/Member/3932/Committee/50","dept":"Energy
|
95
|
+
and Climate Change Committee","position":"Member","from_date":"2015-07-08","to_date":"9999-12-31","person":"24756","source":""},{"moffice_id":"uk.parliament.data/Member/3932/Committee/136","dept":"Scottish
|
96
|
+
Affairs Committee","position":"Member","from_date":"2015-07-06","to_date":"9999-12-31","person":"24756","source":""}]}'
|
97
|
+
http_version:
|
98
|
+
recorded_at: Tue, 26 Jul 2016 02:48:12 GMT
|
99
|
+
- request:
|
100
|
+
method: get
|
101
|
+
uri: https://www.theyworkforyou.com/api/getGeometry?key=<API_KEY>&name=Central%20Suffolk%20and%20North%20Ipswich&version=1.0.0
|
102
|
+
body:
|
103
|
+
encoding: US-ASCII
|
104
|
+
string: ''
|
105
|
+
headers:
|
106
|
+
Accept-Encoding:
|
107
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
108
|
+
Accept:
|
109
|
+
- "*/*"
|
110
|
+
User-Agent:
|
111
|
+
- Ruby
|
112
|
+
response:
|
113
|
+
status:
|
114
|
+
code: 200
|
115
|
+
message: OK
|
116
|
+
headers:
|
117
|
+
Server:
|
118
|
+
- nginx
|
119
|
+
Date:
|
120
|
+
- Tue, 26 Jul 2016 03:25:33 GMT
|
121
|
+
Content-Type:
|
122
|
+
- text/javascript; charset=iso-8859-1
|
123
|
+
Content-Length:
|
124
|
+
- '359'
|
125
|
+
Connection:
|
126
|
+
- keep-alive
|
127
|
+
Access-Control-Allow-Origin:
|
128
|
+
- "*"
|
129
|
+
X-Url:
|
130
|
+
- "/api/getGeometry?name=Central+Suffolk+and+North+Ipswich&key=<API_KEY>&version=1.0.0"
|
131
|
+
Accept-Ranges:
|
132
|
+
- bytes
|
133
|
+
Age:
|
134
|
+
- '0'
|
135
|
+
body:
|
136
|
+
encoding: UTF-8
|
137
|
+
string: '{"max_e":636672.1,"srid_en":27700,"area":796226596.195,"max_n":283760.6,"min_lat":52.040694904,"max_lat":52.4043639353,"centre_n":263028.158547,"max_lon":1.46440065034,"centre_lon":1.22117494193,"min_n":242895.4,"parts":1,"centre_e":620106.539667,"min_e":602204.5,"min_lon":0.951560078518,"centre_lat":52.2215246073,"name":"Central
|
138
|
+
Suffolk and North Ipswich"}'
|
139
|
+
http_version:
|
140
|
+
recorded_at: Tue, 26 Jul 2016 03:25:33 GMT
|
141
|
+
recorded_with: VCR 3.0.3
|
@@ -1,53 +1,74 @@
|
|
1
1
|
require "test_helper"
|
2
2
|
|
3
|
-
class
|
3
|
+
class ClientSpec < Twfy::Spec
|
4
4
|
|
5
|
-
|
6
|
-
super
|
7
|
-
@client = Twfy::Client.new(api_key)
|
8
|
-
end
|
5
|
+
describe Twfy::Client, :vcr do
|
9
6
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
assert_equal "www.theyworkforyou.com", uri.host
|
14
|
-
end
|
7
|
+
before do
|
8
|
+
@client = Twfy::Client.new(api_key)
|
9
|
+
end
|
15
10
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
11
|
+
describe 'convert_url' do
|
12
|
+
it 'works' do
|
13
|
+
uri = @client.convert_url(url: 'http://www.publications.parliament.uk/pa/cm200506/cmhansrd/cm061018/debtext/61018-0002.htm#06101834000471')
|
14
|
+
assert_kind_of URI::HTTP, uri
|
15
|
+
assert_equal "www.theyworkforyou.com", uri.host
|
16
|
+
end
|
17
|
+
end
|
22
18
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
19
|
+
describe 'mp_and_mp_info' do
|
20
|
+
it 'works' do
|
21
|
+
mp = @client.mp(postcode: 'IP6 9PN')
|
22
|
+
assert_kind_of Twfy::MP, mp
|
23
|
+
assert_kind_of Twfy::Constituency, mp.constituency
|
24
|
+
assert_kind_of OpenStruct, @client.mp_info(:id=>mp.person_id)
|
25
|
+
end
|
28
26
|
end
|
29
|
-
end
|
30
27
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
28
|
+
describe 'mps' do
|
29
|
+
it 'works' do
|
30
|
+
mps = @client.mps
|
31
|
+
assert_kind_of Array, mps
|
32
|
+
mps.each do |mp|
|
33
|
+
assert_kind_of Twfy::MP, mp
|
34
|
+
end
|
35
|
+
end
|
36
36
|
end
|
37
|
-
end
|
38
37
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
38
|
+
describe 'msps' do
|
39
|
+
it 'works' do
|
40
|
+
msps = @client.msps
|
41
|
+
assert_kind_of Array, msps
|
42
|
+
msps.each do |msp|
|
43
|
+
assert_kind_of OpenStruct, msp
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
describe 'constituency' do
|
49
|
+
it 'works' do
|
50
|
+
c = @client.constituency(postcode: 'IP6 9PN')
|
51
|
+
assert_kind_of Twfy::Constituency, c
|
52
|
+
end
|
53
|
+
end
|
44
54
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
55
|
+
describe 'geometry' do
|
56
|
+
it 'works' do
|
57
|
+
c = @client.constituency(postcode: 'IP6 9PN')
|
58
|
+
assert_kind_of Twfy::Geometry, @client.geometry(:name=>c.name)
|
59
|
+
end
|
50
60
|
end
|
61
|
+
|
62
|
+
describe 'constituencies' do
|
63
|
+
it 'works' do
|
64
|
+
cs = @client.constituencies
|
65
|
+
assert_kind_of Array, cs
|
66
|
+
cs.each do |c|
|
67
|
+
assert_kind_of Twfy::Constituency, c
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
51
72
|
end
|
52
73
|
|
53
74
|
end
|