lib/flapjack/gateways/jsonapi/medium_methods.rb in flapjack-0.8.11 vs lib/flapjack/gateways/jsonapi/medium_methods.rb in flapjack-0.8.12
- old
+ new
@@ -78,18 +78,19 @@
media_data.each do |medium_data|
type = medium_data['type']
contact.set_address_for_media(type, medium_data['address'])
contact.set_interval_for_media(type, medium_data['interval'])
contact.set_rollup_threshold_for_media(type, medium_data['rollup_threshold'])
- medium_data[:id] = "#{contact.id}_#{type}"
- medium_data[:links] = {:contacts => [contact.id]}
+ medium_data['id'] = "#{contact.id}_#{type}"
end
semaphore.release
- status 201
+ media_ids = media_data.collect {|md| md['id']}
- '{"media":' + media_data.to_json + '}'
+ status 201
+ response.headers['Location'] = "#{base_url}/media/#{media_ids.join(',')}"
+ media_ids.to_json
end
# get one or more media records; media ids are, for Flapjack
# v1, composed of "#{contact.id}_#{media_type}"
app.get %r{^/media(?:/)?([^/]+)?$} do