ngp_van 0.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 +7 -0
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +1 -0
- data/README.md +117 -0
- data/lib/ngp_van.rb +47 -0
- data/lib/ngp_van/client.rb +41 -0
- data/lib/ngp_van/client/activist_codes.rb +15 -0
- data/lib/ngp_van/client/canvass_responses.rb +19 -0
- data/lib/ngp_van/client/codes.rb +31 -0
- data/lib/ngp_van/client/district_fields.rb +15 -0
- data/lib/ngp_van/client/event_types.rb +15 -0
- data/lib/ngp_van/client/events.rb +31 -0
- data/lib/ngp_van/client/locations.rb +27 -0
- data/lib/ngp_van/client/minivan_exports.rb +15 -0
- data/lib/ngp_van/client/notes.rb +19 -0
- data/lib/ngp_van/client/people.rb +31 -0
- data/lib/ngp_van/client/printed_lists.rb +15 -0
- data/lib/ngp_van/client/signups.rb +31 -0
- data/lib/ngp_van/client/survey_questions.rb +15 -0
- data/lib/ngp_van/client/users.rb +19 -0
- data/lib/ngp_van/configuration.rb +74 -0
- data/lib/ngp_van/connection.rb +32 -0
- data/lib/ngp_van/default.rb +41 -0
- data/lib/ngp_van/error.rb +124 -0
- data/lib/ngp_van/request.rb +39 -0
- data/lib/ngp_van/response.rb +15 -0
- data/lib/ngp_van/response/raise_error.rb +17 -0
- data/lib/ngp_van/version.rb +19 -0
- data/spec/ngp_van/client/activist_codes_spec.rb +88 -0
- data/spec/ngp_van/client/canvass_responses_spec.rb +126 -0
- data/spec/ngp_van/client/codes_spec.rb +197 -0
- data/spec/ngp_van/client/district_fields_spec.rb +79 -0
- data/spec/ngp_van/client/event_types_spec.rb +69 -0
- data/spec/ngp_van/client/events_spec.rb +205 -0
- data/spec/ngp_van/client/locations_spec.rb +172 -0
- data/spec/ngp_van/client/minivan_exports_spec.rb +82 -0
- data/spec/ngp_van/client/notes_spec.rb +107 -0
- data/spec/ngp_van/client/people_spec.rb +227 -0
- data/spec/ngp_van/client/printed_lists_spec.rb +91 -0
- data/spec/ngp_van/client/signups_spec.rb +209 -0
- data/spec/ngp_van/client/survey_questions_spec.rb +83 -0
- data/spec/ngp_van/client/users_spec.rb +122 -0
- data/spec/ngp_van/configuration_spec.rb +116 -0
- data/spec/ngp_van/request_spec.rb +137 -0
- data/spec/ngp_van_spec.rb +29 -0
- data/spec/spec_helper.rb +11 -0
- data/spec/support/fixtures/activist_code.json +10 -0
- data/spec/support/fixtures/activist_codes.json +36 -0
- data/spec/support/fixtures/canvass_response.json +25 -0
- data/spec/support/fixtures/canvass_responses_contact_types.json +10 -0
- data/spec/support/fixtures/canvass_responses_input_types.json +26 -0
- data/spec/support/fixtures/canvass_responses_result_codes.json +26 -0
- data/spec/support/fixtures/code.json +18 -0
- data/spec/support/fixtures/code_supported_entities.json +5 -0
- data/spec/support/fixtures/codes.json +55 -0
- data/spec/support/fixtures/create_code.json +16 -0
- data/spec/support/fixtures/create_event.json +62 -0
- data/spec/support/fixtures/create_event_shift.json +5 -0
- data/spec/support/fixtures/create_location.json +9 -0
- data/spec/support/fixtures/create_signup.json +32 -0
- data/spec/support/fixtures/create_user_district_field_values.json +7 -0
- data/spec/support/fixtures/district_field.json +28 -0
- data/spec/support/fixtures/district_fields.json +22 -0
- data/spec/support/fixtures/event.json +139 -0
- data/spec/support/fixtures/event_type.json +75 -0
- data/spec/support/fixtures/event_types.json +77 -0
- data/spec/support/fixtures/events.json +86 -0
- data/spec/support/fixtures/location.json +19 -0
- data/spec/support/fixtures/locations.json +25 -0
- data/spec/support/fixtures/match_candidate.json +61 -0
- data/spec/support/fixtures/match_response.json +4 -0
- data/spec/support/fixtures/minivan_export.json +66 -0
- data/spec/support/fixtures/minivan_exports.json +72 -0
- data/spec/support/fixtures/note_categories.json +17 -0
- data/spec/support/fixtures/note_category.json +8 -0
- data/spec/support/fixtures/note_category_types.json +6 -0
- data/spec/support/fixtures/person.json +61 -0
- data/spec/support/fixtures/printed_list.json +52 -0
- data/spec/support/fixtures/printed_lists.json +58 -0
- data/spec/support/fixtures/signup.json +55 -0
- data/spec/support/fixtures/signup_statuses.json +26 -0
- data/spec/support/fixtures/signups.json +112 -0
- data/spec/support/fixtures/survey_question.json +36 -0
- data/spec/support/fixtures/survey_questions.json +85 -0
- data/spec/support/fixtures/update_code.json +22 -0
- data/spec/support/fixtures/update_event.json +61 -0
- data/spec/support/fixtures/update_signup.json +35 -0
- data/spec/support/fixtures/update_user_district_field_values.json +6 -0
- data/spec/support/fixtures/user_district_field_values.json +7 -0
- data/spec/support/path_helpers.rb +9 -0
- data/spec/support/rspec.rb +51 -0
- data/spec/support/url_helpers.rb +5 -0
- data/spec/support/webmock.rb +5 -0
- metadata +269 -0
- metadata.gz.sig +0 -0
@@ -0,0 +1,69 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
module NgpVan
|
6
|
+
class Client
|
7
|
+
RSpec.describe EventTypes do
|
8
|
+
let(:client) { NgpVan::Client.new }
|
9
|
+
|
10
|
+
describe '#event_types' do
|
11
|
+
let(:response) { fixture('event_types.json') }
|
12
|
+
let(:url) { build_url(client: client, path: 'events/types') }
|
13
|
+
|
14
|
+
before do
|
15
|
+
stub_request(:get, url)
|
16
|
+
.to_return(
|
17
|
+
body: response
|
18
|
+
)
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'requests the correct resource' do
|
22
|
+
client.event_types
|
23
|
+
expect(
|
24
|
+
a_request(:get, url)
|
25
|
+
).to have_been_made
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'returns an array of event types' do
|
29
|
+
event_types = client.event_types
|
30
|
+
expect(event_types).to be_a(Array)
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'returns the requested event types' do
|
34
|
+
event_types = client.event_types
|
35
|
+
expect(event_types.first['name']).to eq('Phone Bank')
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
describe '#event_type' do
|
40
|
+
let(:response) { fixture('event_type.json') }
|
41
|
+
let(:url) { build_url(client: client, path: 'events/types/143856') }
|
42
|
+
|
43
|
+
before do
|
44
|
+
stub_request(:get, url)
|
45
|
+
.to_return(
|
46
|
+
body: response
|
47
|
+
)
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'requests the correct resource' do
|
51
|
+
client.event_type(id: 143_856)
|
52
|
+
expect(
|
53
|
+
a_request(:get, url)
|
54
|
+
).to have_been_made
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'returns a event_type object' do
|
58
|
+
event_type = client.event_type(id: 143_856)
|
59
|
+
expect(event_type).to be_a(Hash)
|
60
|
+
end
|
61
|
+
|
62
|
+
it 'returns the requested event_type' do
|
63
|
+
event_type = client.event_type(id: 143_856)
|
64
|
+
expect(event_type['eventTypeId']).to eq(143_856)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,205 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
module NgpVan
|
6
|
+
# rubocop:disable Metrics/ClassLength
|
7
|
+
class Client
|
8
|
+
RSpec.describe Events do
|
9
|
+
let(:client) { NgpVan::Client.new }
|
10
|
+
|
11
|
+
describe '#create_event' do
|
12
|
+
let(:body) do
|
13
|
+
JSON.parse(File.read(fixture_path + '/create_event.json'))
|
14
|
+
end
|
15
|
+
|
16
|
+
let(:url) { build_url(client: client, path: 'events') }
|
17
|
+
|
18
|
+
before do
|
19
|
+
stub_request(:post, url)
|
20
|
+
.with(body: JSON.generate(body))
|
21
|
+
.to_return(
|
22
|
+
body: '1370',
|
23
|
+
status: 201,
|
24
|
+
headers: {
|
25
|
+
'Location' => build_url(client: client, path: '/events/1370')
|
26
|
+
}
|
27
|
+
)
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'requests the correct resource' do
|
31
|
+
client.create_event(body: body)
|
32
|
+
expect(
|
33
|
+
a_request(:post, url)
|
34
|
+
.with(
|
35
|
+
body: body
|
36
|
+
)
|
37
|
+
).to have_been_made
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'returns the created id' do
|
41
|
+
expect(client.create_event(body: body)).to eq(1370)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
describe '#create_event_shift' do
|
46
|
+
let(:body) do
|
47
|
+
JSON.parse(File.read(fixture_path + '/create_event_shift.json'))
|
48
|
+
end
|
49
|
+
|
50
|
+
let(:url) { build_url(client: client, path: 'events/234234/shifts') }
|
51
|
+
|
52
|
+
before do
|
53
|
+
stub_request(:post, url)
|
54
|
+
.with(body: JSON.generate(body))
|
55
|
+
.to_return(
|
56
|
+
body: '2162',
|
57
|
+
status: 201
|
58
|
+
)
|
59
|
+
end
|
60
|
+
|
61
|
+
it 'requests the correct resource' do
|
62
|
+
client.create_event_shift(id: 234_234, body: body)
|
63
|
+
expect(
|
64
|
+
a_request(:post, url)
|
65
|
+
.with(
|
66
|
+
body: body
|
67
|
+
)
|
68
|
+
).to have_been_made
|
69
|
+
end
|
70
|
+
|
71
|
+
it 'returns the created id' do
|
72
|
+
expect(
|
73
|
+
client.create_event_shift(id: 234_234, body: body)
|
74
|
+
).to eq(2162)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
describe '#event' do
|
79
|
+
let(:params) { { '$expand' => 'locations,codes' } }
|
80
|
+
let(:response) { fixture('event.json') }
|
81
|
+
let(:url) { build_url(client: client, path: 'events/1370') }
|
82
|
+
|
83
|
+
before do
|
84
|
+
stub_request(:get, url)
|
85
|
+
.with(query: params)
|
86
|
+
.to_return(
|
87
|
+
body: response
|
88
|
+
)
|
89
|
+
end
|
90
|
+
|
91
|
+
it 'requests the correct resource' do
|
92
|
+
client.event(id: 1_370, params: params)
|
93
|
+
expect(
|
94
|
+
a_request(:get, url)
|
95
|
+
.with(query: params)
|
96
|
+
).to have_been_made
|
97
|
+
end
|
98
|
+
|
99
|
+
it 'returns a event object' do
|
100
|
+
event = client.event(id: 1_370, params: params)
|
101
|
+
expect(event).to be_a(Hash)
|
102
|
+
end
|
103
|
+
|
104
|
+
it 'returns the requested event' do
|
105
|
+
event = client.event(id: 1_370, params: params)
|
106
|
+
expect(event['eventId']).to eq(1_370)
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
describe '#events' do
|
111
|
+
let(:params) do
|
112
|
+
{
|
113
|
+
startingAfter: '2015-05-31',
|
114
|
+
'$expand' => 'shifts',
|
115
|
+
'$top' => 2,
|
116
|
+
districtFieldValue: '003'
|
117
|
+
}
|
118
|
+
end
|
119
|
+
|
120
|
+
let(:response) { fixture('events.json') }
|
121
|
+
let(:url) { build_url(client: client, path: 'events') }
|
122
|
+
|
123
|
+
before do
|
124
|
+
stub_request(:get, url)
|
125
|
+
.with(query: params)
|
126
|
+
.to_return(
|
127
|
+
body: response
|
128
|
+
)
|
129
|
+
end
|
130
|
+
|
131
|
+
it 'requests the correct resource' do
|
132
|
+
client.events(params: params)
|
133
|
+
expect(
|
134
|
+
a_request(:get, url)
|
135
|
+
.with(query: params)
|
136
|
+
).to have_been_made
|
137
|
+
end
|
138
|
+
|
139
|
+
it 'returns an array of items' do
|
140
|
+
events = client.events(params: params)
|
141
|
+
expect(events['items']).to be_a(Array)
|
142
|
+
end
|
143
|
+
|
144
|
+
it 'returns the requested events' do
|
145
|
+
events = client.events(params: params)
|
146
|
+
expect(events['items'].first['eventId']).to eq(1_370)
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
describe '#update_event' do
|
151
|
+
let(:body) do
|
152
|
+
JSON.parse(File.read(fixture_path + '/update_event.json'))
|
153
|
+
end
|
154
|
+
|
155
|
+
let(:url) { build_url(client: client, path: 'events/1374') }
|
156
|
+
|
157
|
+
before do
|
158
|
+
stub_request(:put, url)
|
159
|
+
.with(body: JSON.generate(body))
|
160
|
+
.to_return(
|
161
|
+
body: '',
|
162
|
+
status: 204
|
163
|
+
)
|
164
|
+
end
|
165
|
+
|
166
|
+
it 'requests the correct resource' do
|
167
|
+
client.update_event(id: 1_374, body: body)
|
168
|
+
expect(
|
169
|
+
a_request(:put, url)
|
170
|
+
.with(
|
171
|
+
body: body
|
172
|
+
)
|
173
|
+
).to have_been_made
|
174
|
+
end
|
175
|
+
|
176
|
+
it 'returns an empty response body' do
|
177
|
+
expect(client.update_event(id: 1_374, body: body)).to eq('')
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
181
|
+
describe '#delete_event' do
|
182
|
+
let(:url) { build_url(client: client, path: 'events/1374') }
|
183
|
+
|
184
|
+
before do
|
185
|
+
stub_request(:delete, url)
|
186
|
+
.to_return(
|
187
|
+
body: '',
|
188
|
+
status: 204
|
189
|
+
)
|
190
|
+
end
|
191
|
+
|
192
|
+
it 'requests the correct resource' do
|
193
|
+
client.delete_event(id: 1_374)
|
194
|
+
expect(
|
195
|
+
a_request(:delete, url)
|
196
|
+
).to have_been_made
|
197
|
+
end
|
198
|
+
|
199
|
+
it 'returns an empty response body' do
|
200
|
+
expect(client.delete_event(id: 1_374)).to eq('')
|
201
|
+
end
|
202
|
+
end
|
203
|
+
end
|
204
|
+
end
|
205
|
+
end
|
@@ -0,0 +1,172 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
module NgpVan
|
6
|
+
# rubocop:disable Metrics/ClassLength
|
7
|
+
class Client
|
8
|
+
RSpec.describe Locations do
|
9
|
+
let(:client) { NgpVan::Client.new }
|
10
|
+
|
11
|
+
describe '#locations' do
|
12
|
+
let(:params) do
|
13
|
+
{
|
14
|
+
name: 'HQ'
|
15
|
+
}
|
16
|
+
end
|
17
|
+
|
18
|
+
let(:response) { fixture('locations.json') }
|
19
|
+
let(:url) { build_url(client: client, path: 'locations') }
|
20
|
+
|
21
|
+
before do
|
22
|
+
stub_request(:get, url)
|
23
|
+
.with(query: params)
|
24
|
+
.to_return(
|
25
|
+
body: response
|
26
|
+
)
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'requests the correct resource' do
|
30
|
+
client.locations(params: params)
|
31
|
+
expect(
|
32
|
+
a_request(:get, url)
|
33
|
+
.with(query: params)
|
34
|
+
).to have_been_made
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'returns an array of items' do
|
38
|
+
locations = client.locations(params: params)
|
39
|
+
expect(locations['items']).to be_a(Array)
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'returns the requested locations' do
|
43
|
+
locations = client.locations(params: params)
|
44
|
+
expect(locations['items'].first['locationId']).to eq(272)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
describe '#location' do
|
49
|
+
let(:params) { Hash.new }
|
50
|
+
let(:response) { fixture('location.json') }
|
51
|
+
let(:url) { build_url(client: client, path: 'locations/272') }
|
52
|
+
|
53
|
+
before do
|
54
|
+
stub_request(:get, url)
|
55
|
+
.with(query: params)
|
56
|
+
.to_return(
|
57
|
+
body: response
|
58
|
+
)
|
59
|
+
end
|
60
|
+
|
61
|
+
it 'requests the correct resource' do
|
62
|
+
client.location(id: 272, params: params)
|
63
|
+
expect(
|
64
|
+
a_request(:get, url)
|
65
|
+
.with(query: params)
|
66
|
+
).to have_been_made
|
67
|
+
end
|
68
|
+
|
69
|
+
it 'returns a location object' do
|
70
|
+
location = client.location(id: 272, params: params)
|
71
|
+
expect(location).to be_a(Hash)
|
72
|
+
end
|
73
|
+
|
74
|
+
it 'returns the requested location' do
|
75
|
+
location = client.location(id: 272, params: params)
|
76
|
+
expect(location['locationId']).to eq(272)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
describe '#find_or_create_location' do
|
81
|
+
let(:body) do
|
82
|
+
JSON.parse(File.read(fixture_path + '/create_location.json'))
|
83
|
+
end
|
84
|
+
|
85
|
+
let(:url) { build_url(client: client, path: 'locations/findOrCreate') }
|
86
|
+
|
87
|
+
before do
|
88
|
+
stub_request(:post, url)
|
89
|
+
.with(body: JSON.generate(body))
|
90
|
+
.to_return(
|
91
|
+
body: '272',
|
92
|
+
status: 201,
|
93
|
+
headers: {
|
94
|
+
'Location' => build_url(client: client, path: '/locations/272')
|
95
|
+
}
|
96
|
+
)
|
97
|
+
end
|
98
|
+
|
99
|
+
it 'requests the correct resource' do
|
100
|
+
client.find_or_create_location(body: body)
|
101
|
+
expect(
|
102
|
+
a_request(:post, url)
|
103
|
+
.with(
|
104
|
+
body: body
|
105
|
+
)
|
106
|
+
).to have_been_made
|
107
|
+
end
|
108
|
+
|
109
|
+
it 'returns the created code id' do
|
110
|
+
expect(client.find_or_create_location(body: body)).to eq(272)
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
describe '#create_location' do
|
115
|
+
let(:body) do
|
116
|
+
JSON.parse(File.read(fixture_path + '/create_location.json'))
|
117
|
+
end
|
118
|
+
|
119
|
+
let(:url) { build_url(client: client, path: 'locations') }
|
120
|
+
|
121
|
+
before do
|
122
|
+
stub_request(:post, url)
|
123
|
+
.with(body: JSON.generate(body))
|
124
|
+
.to_return(
|
125
|
+
body: '272',
|
126
|
+
status: 201,
|
127
|
+
headers: {
|
128
|
+
'Location' => build_url(client: client, path: '/locations/272')
|
129
|
+
}
|
130
|
+
)
|
131
|
+
end
|
132
|
+
|
133
|
+
it 'requests the correct resource' do
|
134
|
+
client.create_location(body: body)
|
135
|
+
expect(
|
136
|
+
a_request(:post, url)
|
137
|
+
.with(
|
138
|
+
body: body
|
139
|
+
)
|
140
|
+
).to have_been_made
|
141
|
+
end
|
142
|
+
|
143
|
+
it 'returns the created id' do
|
144
|
+
expect(client.create_location(body: body)).to eq(272)
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
describe '#delete_location' do
|
149
|
+
let(:url) { build_url(client: client, path: 'locations/272') }
|
150
|
+
|
151
|
+
before do
|
152
|
+
stub_request(:delete, url)
|
153
|
+
.to_return(
|
154
|
+
body: '',
|
155
|
+
status: 204
|
156
|
+
)
|
157
|
+
end
|
158
|
+
|
159
|
+
it 'requests the correct resource' do
|
160
|
+
client.delete_location(id: 272)
|
161
|
+
expect(
|
162
|
+
a_request(:delete, url)
|
163
|
+
).to have_been_made
|
164
|
+
end
|
165
|
+
|
166
|
+
it 'returns an empty response body' do
|
167
|
+
expect(client.delete_location(id: 272)).to eq('')
|
168
|
+
end
|
169
|
+
end
|
170
|
+
end
|
171
|
+
end
|
172
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
module NgpVan
|
6
|
+
class Client
|
7
|
+
RSpec.describe MinivanExports do
|
8
|
+
let(:client) { NgpVan::Client.new }
|
9
|
+
|
10
|
+
describe '#minivan_exports' do
|
11
|
+
let(:params) do
|
12
|
+
{
|
13
|
+
generatedAfter: '2012-10-01',
|
14
|
+
generatedBefore: '2012-11-01',
|
15
|
+
createdBy: '123',
|
16
|
+
name: 'GOTV',
|
17
|
+
hasSignup: true,
|
18
|
+
'$expand' => 'eventSignups,canvassers'
|
19
|
+
}
|
20
|
+
end
|
21
|
+
|
22
|
+
let(:response) { fixture('minivan_exports.json') }
|
23
|
+
let(:url) { build_url(client: client, path: 'minivanExports') }
|
24
|
+
|
25
|
+
before do
|
26
|
+
stub_request(:get, url)
|
27
|
+
.with(query: params)
|
28
|
+
.to_return(
|
29
|
+
body: response
|
30
|
+
)
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'requests the correct resource' do
|
34
|
+
client.minivan_exports(params: params)
|
35
|
+
expect(
|
36
|
+
a_request(:get, url)
|
37
|
+
.with(query: params)
|
38
|
+
).to have_been_made
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'returns an array of districts' do
|
42
|
+
minivan_exports = client.minivan_exports(params: params)
|
43
|
+
expect(minivan_exports['items']).to be_a(Array)
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'returns the requested district fields' do
|
47
|
+
minivan_exports = client.minivan_exports(params: params)
|
48
|
+
expect(minivan_exports['items'].first['minivanExportId']).to eq(2133)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
describe '#minivan_export' do
|
53
|
+
let(:response) { fixture('minivan_export.json') }
|
54
|
+
let(:url) { build_url(client: client, path: 'minivanExports/2133') }
|
55
|
+
|
56
|
+
before do
|
57
|
+
stub_request(:get, url)
|
58
|
+
.to_return(
|
59
|
+
body: response
|
60
|
+
)
|
61
|
+
end
|
62
|
+
|
63
|
+
it 'requests the correct resource' do
|
64
|
+
client.minivan_export(id: 2133)
|
65
|
+
expect(
|
66
|
+
a_request(:get, url)
|
67
|
+
).to have_been_made
|
68
|
+
end
|
69
|
+
|
70
|
+
it 'returns a minivan_export object' do
|
71
|
+
minivan_export = client.minivan_export(id: 2133)
|
72
|
+
expect(minivan_export).to be_a(Hash)
|
73
|
+
end
|
74
|
+
|
75
|
+
it 'returns the requested minivan_export' do
|
76
|
+
minivan_export = client.minivan_export(id: 2133)
|
77
|
+
expect(minivan_export['minivanExportId']).to eq(2133)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|