flapjack-diner 2.0.0.pre.alpha.2 → 2.0.0.pre.alpha.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -176,29 +176,29 @@ describe Flapjack::Diner::Resources::Contacts, :pact => true do
176
176
  expect(Flapjack::Diner.context).to eq(:included => resultify(resp_included))
177
177
  end
178
178
 
179
- it 'returns a contact with media and rules' do
179
+ it 'returns a contact with media and acceptors' do
180
180
  resp_data = contact_json(contact_data).merge(:relationships => contact_rel(contact_data))
181
181
  resp_data[:relationships][:media][:data] = [
182
182
  {:type => 'medium', :id => email_data[:id]}
183
183
  ]
184
- resp_data[:relationships][:rules][:data] = [
185
- {:type => 'rule', :id => rule_data[:id]}
184
+ resp_data[:relationships][:acceptors][:data] = [
185
+ {:type => 'acceptor', :id => acceptor_data[:id]}
186
186
  ]
187
187
  resp_included = [
188
188
  medium_json(email_data).merge(:relationships => medium_rel(email_data)),
189
- rule_json(rule_data).merge(:relationships => rule_rel(rule_data))
189
+ acceptor_json(acceptor_data).merge(:relationships => acceptor_rel(acceptor_data))
190
190
  ]
191
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").
192
+ flapjack.given("a contact with one medium and one acceptor exists").
193
+ upon_receiving("a GET request for a single contact with media and acceptors").
194
194
  with(:method => :get, :path => "/contacts/#{contact_data[:id]}",
195
- :query => 'include=media%2Crules').
195
+ :query => 'include=media%2Cacceptors').
196
196
  will_respond_with(
197
197
  :status => 200,
198
198
  :headers => {'Content-Type' => 'application/vnd.api+json; supported-ext=bulk; charset=utf-8'},
199
199
  :body => {:data => resp_data, :included => resp_included})
200
200
 
201
- result = Flapjack::Diner.contacts(contact_data[:id], :include => ['media', 'rules'])
201
+ result = Flapjack::Diner.contacts(contact_data[:id], :include => ['media', 'acceptors'])
202
202
  expect(result).not_to be_nil
203
203
  expect(result).to eq(resultify(resp_data))
204
204
  expect(Flapjack::Diner.context).to eq(:included => [resultify(resp_included[0]), resultify(resp_included[1])])
@@ -0,0 +1,278 @@
1
+ require 'spec_helper'
2
+ require 'flapjack-diner'
3
+
4
+ describe Flapjack::Diner::Resources::Rejectors, :pact => true do
5
+
6
+ before(:each) do
7
+ Flapjack::Diner.base_uri('localhost:19081')
8
+ Flapjack::Diner.logger = nil
9
+ end
10
+
11
+ context 'create' do
12
+
13
+ it "submits a POST request for a rejector" do
14
+ req_data = rejector_json(rejector_data).merge(
15
+ :relationships => {
16
+ :contact => {
17
+ :data => {
18
+ :type => 'contact',
19
+ :id => contact_data[:id]
20
+ }
21
+ }
22
+ }
23
+ )
24
+ resp_data = rejector_json(rejector_data).merge(:relationships => rejector_rel(rejector_data))
25
+
26
+ flapjack.given("a contact exists").
27
+ upon_receiving("a POST request with one rejector").
28
+ with(:method => :post, :path => '/rejectors',
29
+ :headers => {'Content-Type' => 'application/vnd.api+json'},
30
+ :body => {:data => req_data}).
31
+ will_respond_with(
32
+ :status => 201,
33
+ :headers => {'Content-Type' => 'application/vnd.api+json; supported-ext=bulk; charset=utf-8'},
34
+ :body => {:data => resp_data}
35
+ )
36
+
37
+ result = Flapjack::Diner.create_rejectors(rejector_data.merge(:contact => contact_data[:id]))
38
+ expect(result).not_to be_nil
39
+ expect(result).to eq(resultify(resp_data))
40
+ end
41
+
42
+ it "submits a POST request for several rejectors" do
43
+ req_data = [rejector_json(rejector_data).merge(
44
+ :relationships => {
45
+ :contact => {
46
+ :data => {
47
+ :type => 'contact',
48
+ :id => contact_data[:id]
49
+ }
50
+ }
51
+ }
52
+ ), rejector_json(rejector_2_data).merge(
53
+ :relationships => {
54
+ :contact => {
55
+ :data => {
56
+ :type => 'contact',
57
+ :id => contact_data[:id]
58
+ }
59
+ }
60
+ }
61
+ )]
62
+ resp_data = [
63
+ rejector_json(rejector_data).merge(:relationships => rejector_rel(rejector_data)),
64
+ rejector_json(rejector_2_data).merge(:relationships => rejector_rel(rejector_2_data))
65
+ ]
66
+
67
+ flapjack.given("a contact exists").
68
+ upon_receiving("a POST request with two rejectors").
69
+ with(:method => :post, :path => '/rejectors',
70
+ :headers => {'Content-Type' => 'application/vnd.api+json; ext=bulk'},
71
+ :body => {:data => req_data}).
72
+ will_respond_with(
73
+ :status => 201,
74
+ :headers => {'Content-Type' => 'application/vnd.api+json; supported-ext=bulk; charset=utf-8'},
75
+ :body => {:data => resp_data}
76
+ )
77
+
78
+ result = Flapjack::Diner.create_rejectors(rejector_data.merge(:contact => contact_data[:id]),
79
+ rejector_2_data.merge(:contact => contact_data[:id]))
80
+ expect(result).not_to be_nil
81
+ expect(result).to eq(resultify(resp_data))
82
+ end
83
+
84
+ # TODO error due to invalid data
85
+
86
+ end
87
+
88
+ context 'read' do
89
+
90
+ it "submits a GET request for all rejectors" do
91
+ resp_data = [rejector_json(rejector_data).merge(:relationships => rejector_rel(rejector_data))]
92
+
93
+ flapjack.given("a rejector exists").
94
+ upon_receiving("a GET request for all rejectors").
95
+ with(:method => :get, :path => '/rejectors').
96
+ will_respond_with(
97
+ :status => 200,
98
+ :headers => {'Content-Type' => 'application/vnd.api+json; supported-ext=bulk; charset=utf-8'},
99
+ :body => {:data => resp_data} )
100
+
101
+ result = Flapjack::Diner.rejectors
102
+ expect(result).not_to be_nil
103
+ expect(result).to eq(resultify(resp_data))
104
+ end
105
+
106
+ it "submits a GET request for one rejector" do
107
+ resp_data = rejector_json(rejector_data).merge(:relationships => rejector_rel(rejector_data))
108
+
109
+ flapjack.given("a rejector exists").
110
+ upon_receiving("a GET request for a single rejector").
111
+ with(:method => :get, :path => "/rejectors/#{rejector_data[:id]}").
112
+ will_respond_with(
113
+ :status => 200,
114
+ :headers => {'Content-Type' => 'application/vnd.api+json; supported-ext=bulk; charset=utf-8'},
115
+ :body => {:data => resp_data}
116
+ )
117
+
118
+ result = Flapjack::Diner.rejectors(rejector_data[:id])
119
+ expect(result).not_to be_nil
120
+ expect(result).to eq(resultify(resp_data))
121
+ end
122
+
123
+ it "submits a GET request for several rejectors" do
124
+ resp_data = [
125
+ rejector_json(rejector_data).merge(:relationships => rejector_rel(rejector_data)),
126
+ rejector_json(rejector_2_data).merge(:relationships => rejector_rel(rejector_2_data))
127
+ ]
128
+
129
+ rejectors_data = [rejector_data.merge(:type => 'rejector'), rejector_2_data.merge(:type => 'rejector')]
130
+
131
+ flapjack.given("two rejectors exist").
132
+ upon_receiving("a GET request for two rejectors").
133
+ with(:method => :get, :path => "/rejectors",
134
+ :query => "filter%5B%5D=id%3A#{rejector_data[:id]}%7C#{rejector_2_data[:id]}").
135
+ will_respond_with(
136
+ :status => 200,
137
+ :headers => {'Content-Type' => 'application/vnd.api+json; supported-ext=bulk; charset=utf-8'},
138
+ :body => {:data => resp_data} )
139
+
140
+ result = Flapjack::Diner.rejectors(rejector_data[:id], rejector_2_data[:id])
141
+ expect(result).not_to be_nil
142
+ expect(result).to eq(resultify(resp_data))
143
+ end
144
+
145
+ it "can't find the rejector to read" do
146
+ flapjack.given("no data exists").
147
+ upon_receiving("a GET request for a single rejector").
148
+ with(:method => :get, :path => "/rejectors/#{rejector_data[:id]}").
149
+ will_respond_with(
150
+ :status => 404,
151
+ :headers => {'Content-Type' => 'application/vnd.api+json; supported-ext=bulk; charset=utf-8'},
152
+ :body => {:errors => [{
153
+ :status => '404',
154
+ :detail => "could not find Rejector record, id: '#{rejector_data[:id]}'"
155
+ }]}
156
+ )
157
+
158
+ result = Flapjack::Diner.rejectors(rejector_data[:id])
159
+ expect(result).to be_nil
160
+ expect(Flapjack::Diner.last_error).to eq([{:status => '404',
161
+ :detail => "could not find Rejector record, id: '#{rejector_data[:id]}'"}])
162
+ end
163
+
164
+ end
165
+
166
+ # # Not immediately relevant, no data fields to update until time_restrictions are fixed
167
+ # context 'update' do
168
+ # it 'submits a PUT request for a rejector' do
169
+ # flapjack.given("a rejector exists").
170
+ # upon_receiving("a PUT request for a single rejector").
171
+ # with(:method => :put,
172
+ # :path => "/rejectors/#{rejector_data[:id]}",
173
+ # :body => {:rejectors => {:id => rejector_data[:id], :time_restrictions => []}},
174
+ # :headers => {'Content-Type' => 'application/vnd.api+json'}).
175
+ # will_respond_with(
176
+ # :status => 204,
177
+ # :body => '' )
178
+
179
+ # result = Flapjack::Diner.update_rejectors(:id => rejector_data[:id], :time_restrictions => [])
180
+ # expect(result).to be_a(TrueClass)
181
+ # end
182
+
183
+ # it 'submits a PUT request for several rejectors' do
184
+ # flapjack.given("two rejectors exist").
185
+ # upon_receiving("a PUT request for two rejectors").
186
+ # with(:method => :put,
187
+ # :path => "/rejectors/#{rejector_data[:id]},#{rejector_2_data[:id]}",
188
+ # :body => {:rejectors => [{:id => rejector_data[:id], :time_restrictions => []},
189
+ # {:id => rejector_2_data[:id], :enabled => true}]},
190
+ # :headers => {'Content-Type' => 'application/vnd.api+json'}).
191
+ # will_respond_with(
192
+ # :status => 204,
193
+ # :body => '' )
194
+
195
+ # result = Flapjack::Diner.update_rejectors(
196
+ # {:id => rejector_data[:id], :time_restrictions => []},
197
+ # {:id => rejector_2_data[:id], :enabled => true})
198
+ # expect(result).to be_a(TrueClass)
199
+ # end
200
+
201
+ # it "can't find the rejector to update" do
202
+ # flapjack.given("no data exists").
203
+ # upon_receiving("a PUT request for a single rejector").
204
+ # with(:method => :put,
205
+ # :path => "/rejectors/#{rejector_data[:id]}",
206
+ # :body => {:rejectors => {:id => rejector_data[:id], :time_restrictions => []}},
207
+ # :headers => {'Content-Type' => 'application/vnd.api+json'}).
208
+ # will_respond_with(
209
+ # :status => 404,
210
+ # :headers => {'Content-Type' => 'application/vnd.api+json; charset=utf-8'},
211
+ # :body => {:errors => [{
212
+ # :status => '404',
213
+ # :detail => "could not find Rejector records, ids: '#{rejector_data[:id]}'"
214
+ # }]}
215
+ # )
216
+
217
+ # result = Flapjack::Diner.update_rejectors(:id => rejector_data[:id], :time_restrictions => [])
218
+ # expect(result).to be_nil
219
+ # expect(Flapjack::Diner.last_error).to eq([{:status => '404',
220
+ # :detail => "could not find Rejector records, ids: '#{rejector_data[:id]}'"}])
221
+ # end
222
+ # end
223
+
224
+ context 'delete' do
225
+
226
+ it "submits a DELETE request for a rejector" do
227
+ flapjack.given("a rejector exists").
228
+ upon_receiving("a DELETE request for a single rejector").
229
+ with(:method => :delete,
230
+ :path => "/rejectors/#{rejector_data[:id]}",
231
+ :body => nil).
232
+ will_respond_with(:status => 204,
233
+ :body => '')
234
+
235
+ result = Flapjack::Diner.delete_rejectors(rejector_data[:id])
236
+ expect(result).to be_a(TrueClass)
237
+ end
238
+
239
+ it "submits a DELETE request for several rejectors" do
240
+ rejectors_data = [{:type => 'rejector', :id => rejector_data[:id]},
241
+ {:type => 'rejector', :id => rejector_2_data[:id]}]
242
+
243
+ flapjack.given("two rejectors exist").
244
+ upon_receiving("a DELETE request for two rejectors").
245
+ with(:method => :delete,
246
+ :headers => {'Content-Type' => 'application/vnd.api+json; ext=bulk'},
247
+ :path => "/rejectors",
248
+ :body => {:data => rejectors_data}).
249
+ will_respond_with(:status => 204,
250
+ :body => '')
251
+
252
+ result = Flapjack::Diner.delete_rejectors(rejector_data[:id], rejector_2_data[:id])
253
+ expect(result).to be_a(TrueClass)
254
+ end
255
+
256
+ it "can't find the rejector to delete" do
257
+ flapjack.given("no data exists").
258
+ upon_receiving("a DELETE request for a single rejector").
259
+ with(:method => :delete,
260
+ :path => "/rejectors/#{rejector_data[:id]}",
261
+ :body => nil).
262
+ will_respond_with(
263
+ :status => 404,
264
+ :headers => {'Content-Type' => 'application/vnd.api+json; supported-ext=bulk; charset=utf-8'},
265
+ :body => {:errors => [{
266
+ :status => '404',
267
+ :detail => "could not find Rejector record, id: '#{rejector_data[:id]}'"
268
+ }]}
269
+ )
270
+
271
+ result = Flapjack::Diner.delete_rejectors(rejector_data[:id])
272
+ expect(result).to be_nil
273
+ expect(Flapjack::Diner.last_error).to eq([{:status => '404',
274
+ :detail => "could not find Rejector record, id: '#{rejector_data[:id]}'"}])
275
+ end
276
+ end
277
+
278
+ end
@@ -73,21 +73,21 @@ describe Flapjack::Diner::Resources::Relationships, :pact => true do
73
73
  it 'gets tags for a check with full tag and rule record' do
74
74
  included_data = [
75
75
  tag_json(tag_data).merge(:relationships => tag_rel(tag_data)),
76
- rule_json(rule_data).merge(:relationships => rule_rel(rule_data))
76
+ acceptor_json(acceptor_data).merge(:relationships => acceptor_rel(acceptor_data))
77
77
  ]
78
78
 
79
- flapjack.given("a check with a tag and a rule exists").
80
- upon_receiving("a GET request for all tags on a check, with full tag and rule records").
79
+ flapjack.given("a check with a tag and an acceptor exists").
80
+ upon_receiving("a GET request for all tags on a check, with full tag and acceptor records").
81
81
  with(:method => :get,
82
82
  :path => "/checks/#{check_data[:id]}/tags",
83
- :query => 'include=tags.rules').
83
+ :query => 'include=tags.acceptors').
84
84
  will_respond_with(
85
85
  :status => 200,
86
86
  :headers => {'Content-Type' => 'application/vnd.api+json; supported-ext=bulk; charset=utf-8'},
87
87
  :body => {:data => [{:id => tag_data[:name], :type => 'tag'}],
88
88
  :included => included_data})
89
89
 
90
- result = Flapjack::Diner.check_link_tags(check_data[:id], :include => 'rules')
90
+ result = Flapjack::Diner.check_link_tags(check_data[:id], :include => 'acceptors')
91
91
  expect(result).to eq([{:id => tag_data[:name], :type => 'tag'}])
92
92
  expect(Flapjack::Diner.context[:included]).to eq([resultify(included_data[0]),
93
93
  resultify(included_data[1])])
@@ -74,62 +74,62 @@ module FixtureData
74
74
  {
75
75
  :alerting_media => {
76
76
  :links => {
77
- :self => "http://example.org/checks/#{id}/relationships/alerting_media",
78
- :related => "http://example.org/checks/#{id}/alerting_media"
77
+ :self => "http://#{api_host}/checks/#{id}/relationships/alerting_media",
78
+ :related => "http://#{api_host}/checks/#{id}/alerting_media"
79
79
  }
80
80
  },
81
81
  :contacts => {
82
82
  :links => {
83
- :self => "http://example.org/checks/#{id}/relationships/contacts",
84
- :related => "http://example.org/checks/#{id}/contacts"
83
+ :self => "http://#{api_host}/checks/#{id}/relationships/contacts",
84
+ :related => "http://#{api_host}/checks/#{id}/contacts"
85
85
  }
86
86
  },
87
87
  :current_scheduled_maintenances => {
88
88
  :links => {
89
- :self => "http://example.org/checks/#{id}/relationships/current_scheduled_maintenances",
90
- :related => "http://example.org/checks/#{id}/current_scheduled_maintenances"
89
+ :self => "http://#{api_host}/checks/#{id}/relationships/current_scheduled_maintenances",
90
+ :related => "http://#{api_host}/checks/#{id}/current_scheduled_maintenances"
91
91
  }
92
92
  },
93
93
  :current_state => {
94
94
  :links => {
95
- :self => "http://example.org/checks/#{id}/relationships/current_state",
96
- :related => "http://example.org/checks/#{id}/current_state"
95
+ :self => "http://#{api_host}/checks/#{id}/relationships/current_state",
96
+ :related => "http://#{api_host}/checks/#{id}/current_state"
97
97
  }
98
98
  },
99
99
  :current_unscheduled_maintenance => {
100
100
  :links => {
101
- :self => "http://example.org/checks/#{id}/relationships/current_unscheduled_maintenance",
102
- :related => "http://example.org/checks/#{id}/current_unscheduled_maintenance"
101
+ :self => "http://#{api_host}/checks/#{id}/relationships/current_unscheduled_maintenance",
102
+ :related => "http://#{api_host}/checks/#{id}/current_unscheduled_maintenance"
103
103
  }
104
104
  },
105
105
  :latest_notifications => {
106
106
  :links => {
107
- :self => "http://example.org/checks/#{id}/relationships/latest_notifications",
108
- :related => "http://example.org/checks/#{id}/latest_notifications"
107
+ :self => "http://#{api_host}/checks/#{id}/relationships/latest_notifications",
108
+ :related => "http://#{api_host}/checks/#{id}/latest_notifications"
109
109
  }
110
110
  },
111
111
  :scheduled_maintenances => {
112
112
  :links => {
113
- :self => "http://example.org/checks/#{id}/relationships/scheduled_maintenances",
114
- :related => "http://example.org/checks/#{id}/scheduled_maintenances"
113
+ :self => "http://#{api_host}/checks/#{id}/relationships/scheduled_maintenances",
114
+ :related => "http://#{api_host}/checks/#{id}/scheduled_maintenances"
115
115
  }
116
116
  },
117
117
  :states => {
118
118
  :links => {
119
- :self => "http://example.org/checks/#{id}/relationships/states",
120
- :related => "http://example.org/checks/#{id}/states"
119
+ :self => "http://#{api_host}/checks/#{id}/relationships/states",
120
+ :related => "http://#{api_host}/checks/#{id}/states"
121
121
  }
122
122
  },
123
123
  :tags => {
124
124
  :links => {
125
- :self => "http://example.org/checks/#{id}/relationships/tags",
126
- :related => "http://example.org/checks/#{id}/tags"
125
+ :self => "http://#{api_host}/checks/#{id}/relationships/tags",
126
+ :related => "http://#{api_host}/checks/#{id}/tags"
127
127
  }
128
128
  },
129
129
  :unscheduled_maintenances => {
130
130
  :links => {
131
- :self => "http://example.org/checks/#{id}/relationships/unscheduled_maintenances",
132
- :related => "http://example.org/checks/#{id}/unscheduled_maintenances"
131
+ :self => "http://#{api_host}/checks/#{id}/relationships/unscheduled_maintenances",
132
+ :related => "http://#{api_host}/checks/#{id}/unscheduled_maintenances"
133
133
  }
134
134
  }
135
135
  }
@@ -162,10 +162,10 @@ module FixtureData
162
162
  def contact_rel(co_data)
163
163
  id = co_data[:id]
164
164
  {
165
- :blackholes => {
165
+ :acceptors => {
166
166
  :links => {
167
- :self => "http://#{api_host}/contacts/#{id}/relationships/blackholes",
168
- :related => "http://#{api_host}/contacts/#{id}/blackholes"
167
+ :self => "http://#{api_host}/contacts/#{id}/relationships/acceptors",
168
+ :related => "http://#{api_host}/contacts/#{id}/acceptors"
169
169
  }
170
170
  },
171
171
  :checks => {
@@ -180,10 +180,10 @@ module FixtureData
180
180
  :related => "http://#{api_host}/contacts/#{id}/media"
181
181
  }
182
182
  },
183
- :rules => {
183
+ :rejectors => {
184
184
  :links => {
185
- :self => "http://#{api_host}/contacts/#{id}/relationships/rules",
186
- :related => "http://#{api_host}/contacts/#{id}/rules"
185
+ :self => "http://#{api_host}/contacts/#{id}/relationships/rejectors",
186
+ :related => "http://#{api_host}/contacts/#{id}/rejectors"
187
187
  }
188
188
  }
189
189
  }
@@ -238,8 +238,8 @@ module FixtureData
238
238
  {
239
239
  :check => {
240
240
  :links => {
241
- :self => "http://example.org/#{type}_maintenances/#{id}/relationships/check",
242
- :related => "http://example.org/#{type}_maintenances/#{id}/check"
241
+ :self => "http://#{api_host}/#{type}_maintenances/#{id}/relationships/check",
242
+ :related => "http://#{api_host}/#{type}_maintenances/#{id}/check"
243
243
  }
244
244
  }
245
245
  }
@@ -283,6 +283,12 @@ module FixtureData
283
283
  def medium_rel(me_data)
284
284
  id = me_data[:id]
285
285
  {
286
+ :acceptors => {
287
+ :links => {
288
+ :self => "http://#{api_host}/media/#{id}/relationships/acceptors",
289
+ :related => "http://#{api_host}/media/#{id}/acceptors"
290
+ }
291
+ },
286
292
  :alerting_checks => {
287
293
  :links => {
288
294
  :self => "http://#{api_host}/media/#{id}/relationships/alerting_checks",
@@ -295,102 +301,102 @@ module FixtureData
295
301
  :related => "http://#{api_host}/media/#{id}/contact"
296
302
  }
297
303
  },
298
- :rules => {
304
+ :rejectors => {
299
305
  :links => {
300
- :self => "http://#{api_host}/media/#{id}/relationships/rules",
301
- :related => "http://#{api_host}/media/#{id}/rules"
306
+ :self => "http://#{api_host}/media/#{id}/relationships/rejectors",
307
+ :related => "http://#{api_host}/media/#{id}/rejectors"
302
308
  }
303
309
  }
304
310
  }
305
311
  end
306
312
 
307
- def rule_data
308
- @rule_data ||= {
313
+ def acceptor_data
314
+ @acceptor_data ||= {
309
315
  :id => '05983623-fcef-42da-af44-ed6990b500fa',
310
316
  :conditions_list => 'critical'
311
317
  }
312
318
  end
313
319
 
314
- def rule_2_data
315
- @rule_2_data ||= {
320
+ def acceptor_2_data
321
+ @acceptor_2_data ||= {
316
322
  :id => '20f182fc-6e32-4794-9007-97366d162c51',
317
323
  :conditions_list => 'warning'
318
324
  }
319
325
  end
320
326
 
321
- def rule_json(ru_data)
327
+ def acceptor_json(ac_data)
322
328
  {
323
- :id => ru_data[:id],
324
- :type => 'rule',
325
- :attributes => ru_data.reject {|k,v| :id.eql?(k) }
329
+ :id => ac_data[:id],
330
+ :type => 'acceptor',
331
+ :attributes => ac_data.reject {|k,v| :id.eql?(k) }
326
332
  }
327
333
  end
328
334
 
329
- def rule_rel(ru_data)
330
- id = ru_data[:id]
335
+ def acceptor_rel(ac_data)
336
+ id = ac_data[:id]
331
337
  {
332
338
  :contact => {
333
339
  :links => {
334
- :self => "http://example.org/rules/#{id}/relationships/contact",
335
- :related => "http://example.org/rules/#{id}/contact"
340
+ :self => "http://#{api_host}/acceptors/#{id}/relationships/contact",
341
+ :related => "http://#{api_host}/acceptors/#{id}/contact"
336
342
  }
337
343
  },
338
344
  :media => {
339
345
  :links => {
340
- :self => "http://example.org/rules/#{id}/relationships/media",
341
- :related => "http://example.org/rules/#{id}/media"
346
+ :self => "http://#{api_host}/acceptors/#{id}/relationships/media",
347
+ :related => "http://#{api_host}/acceptors/#{id}/media"
342
348
  }
343
349
  },
344
350
  :tags => {
345
351
  :links => {
346
- :self => "http://example.org/rules/#{id}/relationships/tags",
347
- :related => "http://example.org/rules/#{id}/tags"
352
+ :self => "http://#{api_host}/acceptors/#{id}/relationships/tags",
353
+ :related => "http://#{api_host}/acceptors/#{id}/tags"
348
354
  }
349
355
  }
350
356
  }
351
357
  end
352
358
 
353
- def blackhole_data
354
- @blackhole_data ||= {
359
+ def rejector_data
360
+ @rejector_data ||= {
355
361
  :id => '05983623-fcef-42da-af44-ed6990b500fa',
356
362
  :conditions_list => 'critical'
357
363
  }
358
364
  end
359
365
 
360
- def blackhole_2_data
361
- @blackhole_2_data ||= {
366
+ def rejector_2_data
367
+ @rejector_2_data ||= {
362
368
  :id => '20f182fc-6e32-4794-9007-97366d162c51',
363
369
  :conditions_list => 'warning'
364
370
  }
365
371
  end
366
372
 
367
- def blackhole_json(bl_data)
373
+ def rejector_json(re_data)
368
374
  {
369
- :id => bl_data[:id],
370
- :type => 'blackhole',
371
- :attributes => bl_data.reject {|k,v| :id.eql?(k) }
375
+ :id => re_data[:id],
376
+ :type => 'rejector',
377
+ :attributes => re_data.reject {|k,v| :id.eql?(k) }
372
378
  }
373
379
  end
374
380
 
375
- def blackhole_rel(bl_data)
376
- id = bl_data[:id]
381
+ def rejector_rel(re_data)
382
+ id = re_data[:id]
377
383
  {
378
384
  :contact => {
379
385
  :links => {
380
- :self => "http://example.org/blackholes/#{id}/relationships/contact",
381
- :related => "http://example.org/blackholes/#{id}/contact"
386
+ :self => "http://#{api_host}/rejectors/#{id}/relationships/contact",
387
+ :related => "http://#{api_host}/rejectors/#{id}/contact"
382
388
  }
383
389
  },
384
390
  :media => {
385
391
  :links => {
386
- :self => "http://example.org/blackholes/#{id}/relationships/media",
387
- :related => "http://example.org/blackholes/#{id}/media"
392
+ :self => "http://#{api_host}/rejectors/#{id}/relationships/media",
393
+ :related => "http://#{api_host}/rejectors/#{id}/media"
388
394
  }
389
395
  },
390
396
  :tags => {
391
397
  :links => {
392
- :self => "http://example.org/blackholes/#{id}/relationships/tags",
393
- :related => "http://example.org/blackholes/#{id}/tags"
398
+ :self => "http://#{api_host}/rejectors/#{id}/relationships/tags",
399
+ :related => "http://#{api_host}/rejectors/#{id}/tags"
394
400
  }
395
401
  }
396
402
  }
@@ -428,8 +434,8 @@ module FixtureData
428
434
  {
429
435
  :check => {
430
436
  :links => {
431
- :self => "http://example.org/states/#{id}/relationships/check",
432
- :related => "http://example.org/states/#{id}/check"
437
+ :self => "http://#{api_host}/states/#{id}/relationships/check",
438
+ :related => "http://#{api_host}/states/#{id}/check"
433
439
  }
434
440
  }
435
441
  }
@@ -458,10 +464,10 @@ module FixtureData
458
464
  def tag_rel(ta_data)
459
465
  id = ta_data[:name]
460
466
  {
461
- :blackholes => {
467
+ :acceptors => {
462
468
  :links => {
463
- :self => "http://#{api_host}/tags/#{id}/relationships/blackholes",
464
- :related => "http://#{api_host}/tags/#{id}/blackholes"
469
+ :self => "http://#{api_host}/tags/#{id}/relationships/acceptors",
470
+ :related => "http://#{api_host}/tags/#{id}/acceptors"
465
471
  }
466
472
  },
467
473
  :checks => {
@@ -470,10 +476,28 @@ module FixtureData
470
476
  :related => "http://#{api_host}/tags/#{id}/checks"
471
477
  }
472
478
  },
473
- :rules => {
479
+ :rejectors => {
480
+ :links => {
481
+ :self => "http://#{api_host}/tags/#{id}/relationships/rejectors",
482
+ :related => "http://#{api_host}/tags/#{id}/rejectors"
483
+ }
484
+ },
485
+ :scheduled_maintenances => {
486
+ :links => {
487
+ :self => "http://#{api_host}/tags/#{id}/relationships/scheduled_maintenances",
488
+ :related => "http://#{api_host}/tags/#{id}/scheduled_maintenances"
489
+ }
490
+ },
491
+ :states => {
492
+ :links => {
493
+ :self => "http://#{api_host}/tags/#{id}/relationships/states",
494
+ :related => "http://#{api_host}/tags/#{id}/states"
495
+ }
496
+ },
497
+ :unscheduled_maintenances => {
474
498
  :links => {
475
- :self => "http://#{api_host}/tags/#{id}/relationships/rules",
476
- :related => "http://#{api_host}/tags/#{id}/rules"
499
+ :self => "http://#{api_host}/tags/#{id}/relationships/unscheduled_maintenances",
500
+ :related => "http://#{api_host}/tags/#{id}/unscheduled_maintenances"
477
501
  }
478
502
  }
479
503
  }