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.
@@ -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 ClientTest < TwfyTest
3
+ class ClientSpec < Twfy::Spec
4
4
 
5
- def setup
6
- super
7
- @client = Twfy::Client.new(api_key)
8
- end
5
+ describe Twfy::Client, :vcr do
9
6
 
10
- def test_convert_url
11
- uri = @client.convert_url(url: 'http://www.publications.parliament.uk/pa/cm200506/cmhansrd/cm061018/debtext/61018-0002.htm#06101834000471')
12
- assert_kind_of URI::HTTP, uri
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
- def test_mp_and_mp_info
17
- mp = @client.mp(postcode: 'IP6 9PN')
18
- assert_kind_of Twfy::MP, mp
19
- assert_kind_of Twfy::Constituency, mp.constituency
20
- assert_kind_of OpenStruct, @client.mp_info(:id=>mp.person_id)
21
- end
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
- def test_mps
24
- mps = @client.mps
25
- assert_kind_of Array, mps
26
- mps.each do |mp|
27
- assert_kind_of Twfy::MP, mp
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
- def test_msps
32
- msps = @client.msps
33
- assert_kind_of Array, msps
34
- msps.each do |msp|
35
- assert_kind_of OpenStruct, msp
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
- def test_constituency_and_geometry
40
- c = @client.constituency(postcode: 'IP6 9PN')
41
- assert_kind_of Twfy::Constituency, c
42
- assert_kind_of Twfy::Geometry, @client.geometry(:name=>c.name)
43
- end
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
- def test_constituencies
46
- cs = @client.constituencies
47
- assert_kind_of Array, cs
48
- cs.each do |c|
49
- assert_kind_of Twfy::Constituency, c
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