flapjack-diner 1.4.0 → 2.0.0.a4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.rspec +1 -1
  4. data/README.md +620 -413
  5. data/flapjack-diner.gemspec +1 -1
  6. data/lib/flapjack-diner/argument_validator.rb +77 -7
  7. data/lib/flapjack-diner/configuration.rb +409 -0
  8. data/lib/flapjack-diner/index_range.rb +42 -0
  9. data/lib/flapjack-diner/log_formatter.rb +22 -0
  10. data/lib/flapjack-diner/query.rb +114 -0
  11. data/lib/flapjack-diner/relationships.rb +180 -0
  12. data/lib/flapjack-diner/request.rb +280 -0
  13. data/lib/flapjack-diner/resources.rb +64 -0
  14. data/lib/flapjack-diner/response.rb +91 -0
  15. data/lib/flapjack-diner/tools.rb +47 -251
  16. data/lib/flapjack-diner/utility.rb +16 -0
  17. data/lib/flapjack-diner/version.rb +1 -1
  18. data/lib/flapjack-diner.rb +54 -20
  19. data/spec/argument_validator_spec.rb +87 -28
  20. data/spec/flapjack-diner_spec.rb +42 -64
  21. data/spec/relationships_spec.rb +211 -0
  22. data/spec/resources/checks_spec.rb +219 -79
  23. data/spec/resources/contacts_spec.rb +179 -151
  24. data/spec/resources/events_spec.rb +208 -0
  25. data/spec/resources/maintenance_periods_spec.rb +177 -565
  26. data/spec/resources/media_spec.rb +157 -171
  27. data/spec/resources/metrics_spec.rb +45 -0
  28. data/spec/resources/rules_spec.rb +278 -0
  29. data/spec/resources/states_spec.rb +93 -0
  30. data/spec/resources/statistics_spec.rb +53 -0
  31. data/spec/resources/tags_spec.rb +243 -0
  32. data/spec/spec_helper.rb +16 -0
  33. data/spec/support/fixture_data.rb +541 -0
  34. metadata +33 -31
  35. data/.rubocop.yml +0 -21
  36. data/.rubocop_todo.yml +0 -135
  37. data/lib/flapjack-diner/resources/checks.rb +0 -64
  38. data/lib/flapjack-diner/resources/contacts.rb +0 -70
  39. data/lib/flapjack-diner/resources/entities.rb +0 -68
  40. data/lib/flapjack-diner/resources/maintenance_periods.rb +0 -82
  41. data/lib/flapjack-diner/resources/media.rb +0 -61
  42. data/lib/flapjack-diner/resources/notification_rules.rb +0 -66
  43. data/lib/flapjack-diner/resources/notifications.rb +0 -28
  44. data/lib/flapjack-diner/resources/pagerduty_credentials.rb +0 -59
  45. data/lib/flapjack-diner/resources/reports.rb +0 -33
  46. data/spec/pacts/flapjack-diner-flapjack.json +0 -4515
  47. data/spec/resources/entities_spec.rb +0 -181
  48. data/spec/resources/notification_rules_spec.rb +0 -341
  49. data/spec/resources/notifications_spec.rb +0 -208
  50. data/spec/resources/pagerduty_credentials_spec.rb +0 -237
  51. data/spec/resources/reports_spec.rb +0 -255
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
  require 'flapjack-diner'
3
3
 
4
- describe Flapjack::Diner::Resources::Contacts, :pact => true do
4
+ describe Flapjack::Diner::Resources, :pact => true do
5
5
 
6
6
  before(:each) do
7
7
  Flapjack::Diner.base_uri('localhost:19081')
@@ -11,74 +11,67 @@ describe Flapjack::Diner::Resources::Contacts, :pact => true do
11
11
  context 'create' do
12
12
 
13
13
  it "submits a POST request for a contact" do
14
- contact_data = [{:id => 'abc',
15
- :first_name => 'Jim',
16
- :last_name => 'Smith',
17
- :email => 'jims@example.com',
18
- :timezone => 'UTC' }]
14
+ req_data = contact_json(contact_data)
15
+ resp_data = req_data.merge(:relationships => contact_rel(contact_data))
19
16
 
20
- flapjack.given("no contact exists").
17
+ flapjack.given("no data exists").
21
18
  upon_receiving("a POST request with one contact").
22
19
  with(:method => :post, :path => '/contacts',
23
20
  :headers => {'Content-Type' => 'application/vnd.api+json'},
24
- :body => {:contacts => contact_data}).
21
+ :body => {:data => req_data}).
25
22
  will_respond_with(
26
23
  :status => 201,
27
- :headers => {'Content-Type' => 'application/vnd.api+json; charset=utf-8'},
28
- :body => ['abc'] )
24
+ :headers => {'Content-Type' => 'application/vnd.api+json; supported-ext=bulk; charset=utf-8'},
25
+ :body => {:data => resp_data})
29
26
 
30
27
  result = Flapjack::Diner.create_contacts(contact_data)
31
28
  expect(result).not_to be_nil
32
- expect(result).to eq(['abc'])
29
+ expect(result).to eq(resultify(resp_data))
33
30
  end
34
31
 
35
32
  it "submits a POST request for several contacts" do
36
- contact_data = [{:id => 'abc',
37
- :first_name => 'Jim',
38
- :last_name => 'Smith',
39
- :email => 'jims@example.com',
40
- :timezone => 'UTC'},
41
- {:id => 'def',
42
- :first_name => 'Joan',
43
- :last_name => 'Smith',
44
- :email => 'joans@example.com'}]
45
-
46
- flapjack.given("no contact exists").
33
+ req_data = [contact_json(contact_data), contact_json(contact_2_data)]
34
+ resp_data = [
35
+ req_data[0].merge(:relationships => contact_rel(contact_data)),
36
+ req_data[1].merge(:relationships => contact_rel(contact_2_data))
37
+ ]
38
+
39
+ flapjack.given("no data exists").
47
40
  upon_receiving("a POST request with two contacts").
48
41
  with(:method => :post, :path => '/contacts',
49
- :headers => {'Content-Type' => 'application/vnd.api+json'},
50
- :body => {:contacts => contact_data}).
42
+ :headers => {'Content-Type' => 'application/vnd.api+json; ext=bulk'},
43
+ :body => {:data => req_data}).
51
44
  will_respond_with(
52
45
  :status => 201,
53
- :headers => {'Content-Type' => 'application/vnd.api+json; charset=utf-8'},
54
- :body => ['abc', 'def'] )
46
+ :headers => {'Content-Type' => 'application/vnd.api+json; supported-ext=bulk; charset=utf-8'},
47
+ :body => {:data => resp_data})
55
48
 
56
- result = Flapjack::Diner.create_contacts(contact_data)
49
+ result = Flapjack::Diner.create_contacts(contact_data, contact_2_data)
57
50
  expect(result).not_to be_nil
58
- expect(result).to eq(['abc', 'def'])
51
+ expect(result).to eq(resultify(resp_data))
59
52
  end
60
53
 
61
54
  it "submits a POST request but a contact with that id exists" do
62
- contact_data = [{:id => 'abc',
63
- :first_name => 'Jim',
64
- :last_name => 'Smith',
65
- :email => 'jims@example.com',
66
- :timezone => 'UTC'}]
55
+ req_data = contact_json(contact_data)
67
56
 
68
- flapjack.given("a contact with id 'abc' exists").
57
+ flapjack.given("a contact exists").
69
58
  upon_receiving("a POST request with one contact").
70
59
  with(:method => :post, :path => '/contacts',
71
60
  :headers => {'Content-Type' => 'application/vnd.api+json'},
72
- :body => {:contacts => contact_data}).
61
+ :body => {:data => req_data}).
73
62
  will_respond_with(
74
63
  :status => 409,
75
- :headers => {'Content-Type' => 'application/vnd.api+json; charset=utf-8'},
76
- :body => {:errors => ["Contacts already exist with the following IDs: abc"]} )
64
+ :headers => {'Content-Type' => 'application/vnd.api+json; supported-ext=bulk; charset=utf-8'},
65
+ :body => {:errors => [{
66
+ :status => '409',
67
+ :detail => "Contacts already exist with the following ids: #{contact_data[:id]}"
68
+ }]}
69
+ )
77
70
 
78
71
  result = Flapjack::Diner.create_contacts(contact_data)
79
72
  expect(result).to be_nil
80
- expect(Flapjack::Diner.last_error).to eq(:status_code => 409,
81
- :errors => ['Contacts already exist with the following IDs: abc'])
73
+ expect(Flapjack::Diner.error).to eq([{:status => '409',
74
+ :detail => "Contacts already exist with the following ids: #{contact_data[:id]}"}])
82
75
  end
83
76
 
84
77
  end
@@ -88,33 +81,29 @@ describe Flapjack::Diner::Resources::Contacts, :pact => true do
88
81
  context 'GET all contacts' do
89
82
 
90
83
  it "has some data" do
91
- contact_data = {:id => 'abc',
92
- :first_name => 'Jim',
93
- :last_name => 'Smith',
94
- :email => 'jims@example.com',
95
- :timezone => 'UTC'}
84
+ resp_data = [contact_json(contact_data).merge(:relationships => contact_rel(contact_data))]
96
85
 
97
- flapjack.given("a contact with id 'abc' exists").
86
+ flapjack.given("a contact exists").
98
87
  upon_receiving("a GET request for all contacts").
99
88
  with(:method => :get, :path => '/contacts').
100
89
  will_respond_with(
101
90
  :status => 200,
102
- :headers => {'Content-Type' => 'application/vnd.api+json; charset=utf-8'},
103
- :body => {:contacts => [contact_data]} )
91
+ :headers => {'Content-Type' => 'application/vnd.api+json; supported-ext=bulk; charset=utf-8'},
92
+ :body => {:data => resp_data})
104
93
 
105
94
  result = Flapjack::Diner.contacts
106
95
  expect(result).not_to be_nil
107
- expect(result).to eq([contact_data])
96
+ expect(result).to eq(resultify(resp_data))
108
97
  end
109
98
 
110
99
  it "has no data" do
111
- flapjack.given("no contact exists").
100
+ flapjack.given("no data exists").
112
101
  upon_receiving("a GET request for all contacts").
113
102
  with(:method => :get, :path => '/contacts').
114
103
  will_respond_with(
115
104
  :status => 200,
116
- :headers => {'Content-Type' => 'application/vnd.api+json; charset=utf-8'},
117
- :body => {:contacts => []} )
105
+ :headers => {'Content-Type' => 'application/vnd.api+json; supported-ext=bulk; charset=utf-8'},
106
+ :body => {:data => []})
118
107
 
119
108
  result = Flapjack::Diner.contacts
120
109
  expect(result).not_to be_nil
@@ -127,170 +116,209 @@ describe Flapjack::Diner::Resources::Contacts, :pact => true do
127
116
  context 'GET a single contact' do
128
117
 
129
118
  it "finds the contact" do
130
- contact_data = {:id => 'abc',
131
- :first_name => 'Jim',
132
- :last_name => 'Smith',
133
- :email => 'jims@example.com',
134
- :timezone => 'UTC'}
119
+ resp_data = contact_json(contact_data).merge(:relationships => contact_rel(contact_data))
135
120
 
136
- flapjack.given("a contact with id 'abc' exists").
121
+ flapjack.given("a contact exists").
137
122
  upon_receiving("a GET request for a single contact").
138
- with(:method => :get, :path => '/contacts/abc').
123
+ with(:method => :get, :path => "/contacts/#{contact_data[:id]}").
139
124
  will_respond_with(
140
125
  :status => 200,
141
- :headers => {'Content-Type' => 'application/vnd.api+json; charset=utf-8'},
142
- :body => {:contacts => [contact_data]} )
126
+ :headers => {'Content-Type' => 'application/vnd.api+json; supported-ext=bulk; charset=utf-8'},
127
+ :body => {:data => resp_data})
143
128
 
144
- result = Flapjack::Diner.contacts('abc')
129
+ result = Flapjack::Diner.contacts(contact_data[:id])
145
130
  expect(result).not_to be_nil
146
- expect(result).to eq([contact_data])
131
+ expect(result).to eq(resultify(resp_data))
147
132
  end
148
133
 
149
134
  it "can't find the contact" do
150
- flapjack.given("no contact exists").
135
+ flapjack.given("no data exists").
151
136
  upon_receiving("a GET request for a single contact").
152
- with(:method => :get, :path => '/contacts/abc').
137
+ with(:method => :get, :path => "/contacts/#{contact_data[:id]}").
153
138
  will_respond_with(
154
139
  :status => 404,
155
- :headers => {'Content-Type' => 'application/vnd.api+json; charset=utf-8'},
156
- :body => {:errors => ["could not find contacts 'abc'"]} )
157
-
158
- result = Flapjack::Diner.contacts('abc')
140
+ :headers => {'Content-Type' => 'application/vnd.api+json; supported-ext=bulk; charset=utf-8'},
141
+ :body => {:errors => [{
142
+ :status => '404',
143
+ :detail => "could not find Contact record, id: '#{contact_data[:id]}'"
144
+ }]}
145
+ )
146
+
147
+ result = Flapjack::Diner.contacts(contact_data[:id])
159
148
  expect(result).to be_nil
160
- expect(Flapjack::Diner.last_error).to eq(:status_code => 404,
161
- :errors => ["could not find contacts 'abc'"])
149
+ expect(Flapjack::Diner.error).to eq([{:status => '404',
150
+ :detail => "could not find Contact record, id: '#{contact_data[:id]}'"}])
162
151
  end
163
152
 
164
153
  end
165
154
 
166
- end
155
+ context 'GET a single contact with included data' do
167
156
 
168
- context 'update' do
157
+ it 'returns a contact with media' do
158
+ resp_data = contact_json(contact_data).merge(:relationships => contact_rel(contact_data))
159
+ resp_data[:relationships][:media][:data] = [
160
+ {:type => 'medium', :id => email_data[:id]}
161
+ ]
162
+ resp_included = [medium_json(email_data)]
169
163
 
170
- it "submits a PATCH request for one contact" do
171
- flapjack.given("a contact with id 'abc' exists").
172
- upon_receiving("a PATCH request to change properties for a single contact").
173
- with(:method => :patch,
174
- :path => '/contacts/abc',
175
- :body => [{:op => 'replace', :path => '/contacts/0/timezone', :value => 'UTC'}],
176
- :headers => {'Content-Type'=>'application/json-patch+json'}).
177
- will_respond_with(:status => 204,
178
- :body => '')
164
+ flapjack.given("a contact with one medium exists").
165
+ upon_receiving("a GET request for a single contact with media").
166
+ with(:method => :get, :path => "/contacts/#{contact_data[:id]}",
167
+ :query => 'include=media').
168
+ will_respond_with(
169
+ :status => 200,
170
+ :headers => {'Content-Type' => 'application/vnd.api+json; supported-ext=bulk; charset=utf-8'},
171
+ :body => {:data => resp_data, :included => resp_included})
179
172
 
180
- result = Flapjack::Diner.update_contacts('abc', :timezone => 'UTC')
181
- expect(result).not_to be_nil
182
- expect(result).to be_truthy
183
- end
173
+ result = Flapjack::Diner.contacts(contact_data[:id], :include => 'media')
174
+ expect(result).not_to be_nil
175
+ expect(result).to eq(resultify(resp_data))
176
+ expect(Flapjack::Diner.context).to eq(:included => {'medium' => {email_data[:id] => resultify(resp_included.first)}})
177
+ end
184
178
 
185
- it "submits a PATCH request for several contacts" do
186
- flapjack.given("contacts with ids 'abc' and '872' exist").
187
- upon_receiving("a PATCH request to change properties for two contacts").
188
- with(:method => :patch,
189
- :path => '/contacts/abc,872',
190
- :body => [{:op => 'replace', :path => '/contacts/0/timezone', :value => 'UTC'}],
191
- :headers => {'Content-Type'=>'application/json-patch+json'}).
192
- will_respond_with(:status => 204,
193
- :body => '')
179
+ it 'returns a contact with media and rules' do
180
+ resp_data = contact_json(contact_data).merge(:relationships => contact_rel(contact_data))
181
+ resp_data[:relationships][:media][:data] = [
182
+ {:type => 'medium', :id => email_data[:id]}
183
+ ]
184
+ resp_data[:relationships][:rules][:data] = [
185
+ {:type => 'rule', :id => rule_data[:id]}
186
+ ]
187
+ resp_included = [
188
+ medium_json(email_data),
189
+ rule_json(rule_data)
190
+ ]
191
+
192
+ flapjack.given("a contact with one medium and one rule exists").
193
+ upon_receiving("a GET request for a single contact with media and rules").
194
+ with(:method => :get, :path => "/contacts/#{contact_data[:id]}",
195
+ :query => 'include=media%2Crules').
196
+ will_respond_with(
197
+ :status => 200,
198
+ :headers => {'Content-Type' => 'application/vnd.api+json; supported-ext=bulk; charset=utf-8'},
199
+ :body => {:data => resp_data, :included => resp_included})
194
200
 
195
- result = Flapjack::Diner.update_contacts('abc', '872', :timezone => 'UTC')
196
- expect(result).not_to be_nil
197
- expect(result).to be_truthy
201
+ result = Flapjack::Diner.contacts(contact_data[:id], :include => ['media', 'rules'])
202
+ expect(result).not_to be_nil
203
+ expect(result).to eq(resultify(resp_data))
204
+ expect(Flapjack::Diner.context).to eq(:included => {
205
+ 'medium' => {email_data[:id] => resultify(resp_included[0])},
206
+ 'rule' => {rule_data[:id] => resultify(resp_included[1])}
207
+ })
208
+
209
+ end
198
210
  end
211
+ end
199
212
 
200
- it "submits a PATCH request to change a link for one contact" do
201
- flapjack.given("a contact with id '872' exists").
202
- upon_receiving("a PATCH requestto change a link for a single contact").
213
+ context 'update' do
214
+
215
+ it 'submits a PATCH request for a contact' do
216
+ flapjack.given("a contact exists").
217
+ upon_receiving("a PATCH request for a single contact").
203
218
  with(:method => :patch,
204
- :path => '/contacts/872',
205
- :body => [{:op => 'add', :path => '/contacts/0/links/entities/-', :value => '1234'}],
206
- :headers => {'Content-Type'=>'application/json-patch+json'}).
207
- will_respond_with(:status => 204,
208
- :body => '')
219
+ :path => "/contacts/#{contact_data[:id]}",
220
+ :body => {:data => {:id => contact_data[:id], :type => 'contact', :attributes => {:name => 'Hello There'}}},
221
+ :headers => {'Content-Type' => 'application/vnd.api+json'}).
222
+ will_respond_with(
223
+ :status => 204,
224
+ :body => '' )
209
225
 
210
- result = Flapjack::Diner.update_contacts('872', :add_entity => '1234')
211
- expect(result).not_to be_nil
212
- expect(result).to be_truthy
226
+ result = Flapjack::Diner.update_contacts(:id => contact_data[:id], :name => 'Hello There')
227
+ expect(result).to be_a(TrueClass)
213
228
  end
214
229
 
215
- it "submits a PATCH request to change links for several contacts" do
216
- flapjack.given("contacts with ids 'abc' and '872' exist").
217
- upon_receiving("a PATCH request to change links for two contacts").
230
+ it 'submits a PATCH request for several contacts' do
231
+ flapjack.given("two contacts exist").
232
+ upon_receiving("a PATCH request for two contacts").
218
233
  with(:method => :patch,
219
- :path => '/contacts/abc,872',
220
- :body => [{:op => 'add', :path => '/contacts/0/links/entities/-', :value => '1234'}],
221
- :headers => {'Content-Type'=>'application/json-patch+json'}).
222
- will_respond_with(:status => 204,
223
- :body => '')
234
+ :path => "/contacts",
235
+ :headers => {'Content-Type' => 'application/vnd.api+json; ext=bulk'},
236
+ :body => {:data => [{:id => contact_data[:id], :type => 'contact', :attributes => {:name => 'Hello There'}},
237
+ {:id => contact_2_data[:id], :type => 'contact', :attributes => {:name => 'Goodbye Now'}}]}).
238
+ will_respond_with(
239
+ :status => 204,
240
+ :body => '' )
224
241
 
225
- result = Flapjack::Diner.update_contacts('abc', '872', :add_entity => '1234')
226
- expect(result).not_to be_nil
227
- expect(result).to be_truthy
242
+ result = Flapjack::Diner.update_contacts(
243
+ {:id => contact_data[:id], :name => 'Hello There'},
244
+ {:id => contact_2_data[:id], :name => 'Goodbye Now'})
245
+ expect(result).to be_a(TrueClass)
228
246
  end
229
247
 
230
- it "can't find a contact to update" do
231
- flapjack.given("no contact exists").
232
- upon_receiving("a PATCH request to change properties for a single contact").
248
+ it "can't find the contact to update" do
249
+ flapjack.given("no data exists").
250
+ upon_receiving("a PATCH request for a single contact").
233
251
  with(:method => :patch,
234
- :path => '/contacts/323',
235
- :body => [{:op => 'replace', :path => '/contacts/0/timezone', :value => 'UTC'}],
236
- :headers => {'Content-Type'=>'application/json-patch+json'}).
252
+ :path => "/contacts/#{contact_data[:id]}",
253
+ :body => {:data => {:id => contact_data[:id], :type => 'contact', :attributes => {:name => 'Hello There'}}},
254
+ :headers => {'Content-Type' => 'application/vnd.api+json'}).
237
255
  will_respond_with(
238
256
  :status => 404,
239
- :headers => {'Content-Type' => 'application/vnd.api+json; charset=utf-8'},
240
- :body => {:errors => ["could not find contacts '323'"]} )
241
-
242
- result = Flapjack::Diner.update_contacts('323', :timezone => 'UTC')
257
+ :headers => {'Content-Type' => 'application/vnd.api+json; supported-ext=bulk; charset=utf-8'},
258
+ :body => {:errors => [{
259
+ :status => '404',
260
+ :detail => "could not find Contact record, id: '#{contact_data[:id]}'"
261
+ }]}
262
+ )
263
+
264
+ result = Flapjack::Diner.update_contacts(:id => contact_data[:id], :name => 'Hello There')
243
265
  expect(result).to be_nil
244
- expect(Flapjack::Diner.last_error).to eq(:status_code => 404,
245
- :errors => ["could not find contacts '323'"])
266
+ expect(Flapjack::Diner.error).to eq([{:status => '404',
267
+ :detail => "could not find Contact record, id: '#{contact_data[:id]}'"}])
246
268
  end
247
-
248
269
  end
249
270
 
250
271
  context 'delete' do
272
+
251
273
  it "submits a DELETE request for one contact" do
252
- flapjack.given("a contact with id 'abc' exists").
274
+ flapjack.given("a contact exists").
253
275
  upon_receiving("a DELETE request for a single contact").
254
276
  with(:method => :delete,
255
- :path => '/contacts/abc',
277
+ :path => "/contacts/#{contact_data[:id]}",
256
278
  :body => nil).
257
279
  will_respond_with(:status => 204,
258
280
  :body => '')
259
281
 
260
- result = Flapjack::Diner.delete_contacts('abc')
261
- expect(result).not_to be_nil
262
- expect(result).to be_truthy
282
+ result = Flapjack::Diner.delete_contacts(contact_data[:id])
283
+ expect(result).to be_a(TrueClass)
263
284
  end
264
285
 
265
286
  it "submits a DELETE request for several contacts" do
266
- flapjack.given("contacts with ids 'abc' and '872' exist").
287
+ contacts_data = [{:type => 'contact', :id => contact_data[:id]},
288
+ {:type => 'contact', :id => contact_2_data[:id]}]
289
+
290
+ flapjack.given("two contacts exist").
267
291
  upon_receiving("a DELETE request for two contacts").
268
292
  with(:method => :delete,
269
- :path => '/contacts/abc,872',
270
- :body => nil).
293
+ :headers => {'Content-Type' => 'application/vnd.api+json; ext=bulk'},
294
+ :path => "/contacts",
295
+ :body => {:data => contacts_data}).
271
296
  will_respond_with(:status => 204,
272
297
  :body => '')
273
298
 
274
- result = Flapjack::Diner.delete_contacts('abc', '872')
275
- expect(result).not_to be_nil
276
- expect(result).to be_truthy
299
+ result = Flapjack::Diner.delete_contacts(contact_data[:id], contact_2_data[:id])
300
+ expect(result).to be_a(TrueClass)
277
301
  end
278
302
 
279
303
  it "can't find the contact to delete" do
280
- flapjack.given("no contact exists").
304
+ flapjack.given("no data exists").
281
305
  upon_receiving("a DELETE request for a single contact").
282
306
  with(:method => :delete,
283
- :path => '/contacts/abc',
307
+ :path => "/contacts/#{contact_data[:id]}",
284
308
  :body => nil).
285
309
  will_respond_with(
286
310
  :status => 404,
287
- :headers => {'Content-Type' => 'application/vnd.api+json; charset=utf-8'},
288
- :body => {:errors => ["could not find contacts 'abc'"]} )
289
-
290
- result = Flapjack::Diner.delete_contacts('abc')
311
+ :headers => {'Content-Type' => 'application/vnd.api+json; supported-ext=bulk; charset=utf-8'},
312
+ :body => {:errors => [{
313
+ :status => '404',
314
+ :detail => "could not find Contact record, id: '#{contact_data[:id]}'"
315
+ }]}
316
+ )
317
+
318
+ result = Flapjack::Diner.delete_contacts(contact_data[:id])
291
319
  expect(result).to be_nil
292
- expect(Flapjack::Diner.last_error).to eq(:status_code => 404,
293
- :errors => ["could not find contacts 'abc'"])
320
+ expect(Flapjack::Diner.error).to eq([{:status => '404',
321
+ :detail => "could not find Contact record, id: '#{contact_data[:id]}'"}])
294
322
  end
295
323
  end
296
324